1
BEGIN
2
INSERT INTO retiredassets (ClientID,LocationID,NAME,OS,Windir,VERSION,BiosName,BiosVer,BiosMFG,BiosFlash,USB,Tape,Sound,SCSI,SERIAL,Parallel,COMMENT,MEMORY,Video,Processors,Nic,DNSInfo,LocalAddress,RouterAddress,Modems,AssetTag,Assetdate,RetiredDate,RetireComments,ComputerID,`Password`) (SELECT ClientID,LocationID,NAME,OS,Windir,VERSION,BiosName,BiosVer,BiosMFG,BiosFlash,USB,Tape,Sound,SCSI,SERIAL,Parallel,COMMENT,(SELECT GROUP_CONCAT(CONCAT(Size,':',MemoryType,':',0,':',Speed,':',0,':',0) SEPARATOR '|') FROM Inv_memoryslots WHERE Size>0 AND computerid=computers.computerid),Video,(SELECT GROUP_CONCAT(CONCAT(NAME,':0:',Speed,':',32,':',Family,':',L2Cache,':',Manufacturer,':',SerialNumber,':0:0') SEPARATOR '|') FROM inv_processor WHERE Enabled>0 AND computerid=computers.computerid),Nic,DNSInfo,LocalAddress,RouterAddress,Modems,AssetTag,Assetdate,NOW(),COMMENT,CID,`Password` FROM Computers WHERE ComputerID=CID) ON DUPLICATE KEY UPDATE `ClientID`=VALUES(`ClientID`),`LocationID`=VALUES(`LocationID`),`NAME`=VALUES(`NAME`),`OS`=VALUES(`OS`),`Windir`=VALUES(`Windir`),`VERSION`=VALUES(`VERSION`),`BiosName`=VALUES(`BiosName`),`BiosVer`=VALUES(`BiosVer`),`BiosMFG`=VALUES(`BiosMFG`),`BiosFlash`=VALUES(`BiosFlash`),`USB`=VALUES(`USB`),`Tape`=VALUES(`Tape`),`Sound`=VALUES(`Sound`),`SCSI`=VALUES(`SCSI`),`SERIAL`=VALUES(`SERIAL`),`Parallel`=VALUES(`Parallel`),`COMMENT`=VALUES(`COMMENT`),`MEMORY`=VALUES(`MEMORY`),`Video`=VALUES(`Video`),`Processors`=VALUES(`Processors`),`Nic`=VALUES(`Nic`),`DNSInfo`=VALUES(`DNSInfo`),`LocalAddress`=VALUES(`LocalAddress`),`RouterAddress`=VALUES(`RouterAddress`),`Modems`=VALUES(`Modems`),`AssetTag`=VALUES(`AssetTag`),`Assetdate`=VALUES(`AssetTag`),`RetiredDate`=VALUES(`RetiredDate`),`RetireComments`=VALUES(`RetireComments`),`Password`=VALUES(`Password`);
3
DELETE FROM computers WHERE ComputerID=CID;
4
DELETE FROM defragmentation WHERE ComputerID=CID;
5
DELETE FROM drives WHERE ComputerID=CID;
6
DELETE FROM errorlogs WHERE ComputerID=CID;
7
DELETE FROM eventlogs WHERE ComputerID=CID;
8
DELETE FROM network WHERE ComputerID=CID;
9
DELETE FROM networkdrives WHERE ComputerID=CID;
10
DELETE FROM hotfix WHERE ComputerID=CID;
11
DELETE FROM printers WHERE ComputerID=CID;
12
DELETE FROM processes WHERE ComputerID=CID;
13
DELETE FROM smartattributes WHERE ComputerID=CID;
14
DELETE FROM software WHERE ComputerID=CID;
15
DELETE FROM services WHERE ComputerID=CID;
16
DELETE FROM autostartup WHERE ComputerID=CID;
17
DELETE FROM subgroups WHERE ComputerID=CID;
18
DELETE FROM subgroupwchildren WHERE ComputerID=CID;
19
DELETE FROM computerconfig WHERE ComputerID=CID;
20
DELETE FROM scheduledscripts WHERE ComputerID=CID;
21
DELETE FROM pendingscripts WHERE ComputerID=CID;
22
DELETE FROM runningscripts WHERE ComputerID=CID;
23
DELETE FROM scheduledtasks WHERE ComputerID=CID;
24
DELETE FROM autofixignore WHERE ComputerID=CID;
25
DELETE FROM agentignore WHERE ComputerID=CID;
26
DELETE FROM agentcomputerdata WHERE ComputerID=CID;
27
DELETE FROM datacache WHERE ComputerID=CID;
28
DELETE FROM h_commands WHERE ComputerID=CID;
29
DELETE FROM h_computers WHERE ComputerID=CID;
30
DELETE FROM h_processes WHERE ComputerID=CID;
31
DELETE FROM h_redirector WHERE ComputerID=CID;
32
DELETE FROM h_scripts WHERE ComputerID=CID;
33
DELETE FROM h_eventlogs WHERE ComputerID=CID;
34
DELETE FROM agents WHERE checkaction>0 AND ComputerID=CID;
35
DELETE FROM Alerts WHERE ComputerID=CID;
36
DELETE FROM Databasealerts WHERE ComputerID=CID;
37
DELETE FROM h_apps WHERE ComputerID=CID;
38
DELETE FROM extrafielddata WHERE ID=CID AND ExtraFieldID IN (SELECT ID FROM ExtraField WHERE Form=1);
39
DELETE FROM heartbeatcomputers WHERE ComputerID=CID;
40
DELETE FROM inv_bios WHERE ComputerID=CID;
41
DELETE FROM inv_chassis WHERE ComputerID=CID;
42
DELETE FROM inv_devices WHERE ComputerID=CID;
43
DELETE FROM inv_memoryslots WHERE ComputerID=CID;
44
DELETE FROM inv_networkcard WHERE ComputerID=CID;
45
DELETE FROM inv_operatingsystem WHERE ComputerID=CID;
46
DELETE FROM inv_probefansensor WHERE ComputerID=CID;
47
DELETE FROM inv_processor WHERE ComputerID=CID;
48
DELETE FROM inv_systemslots WHERE ComputerID=CID;
49
DELETE FROM inv_videocard WHERE ComputerID=CID;
50
DELETE FROM antivirusthreats WHERE ComputerID=CID;
51
DELETE FROM computerpatchingstats WHERE ComputerID=CID;
52
DELETE FROM computerpatchpolicies WHERE ComputerID=CID;
53
DELETE FROM patchgroupapprovalpolicies WHERE ComputerLevelOverride=CID;
54
DELETE FROM patchgrouppolicies WHERE ComputerLevelOverride=CID;
55
DELETE FROM patchhistory WHERE ComputerID=CID;
56
DELETE FROM PatchingDeviceComplianceData WHERE ComputerID=CID;
57
END