Video Screencast Help

Delete/retire a computer via VBS

Created: 12 Nov 2012 | 4 comments


Is there a VBS script out there to automatically delete or retire a computer from Altiris 7.1.  Long term thinking would be the ability to massively delete multiple computers at a time.   This would be used for computers that were set to be recycled.     

I have purging maintenance set up, what I looking for is a "on demand" solution.   

Comments 4 CommentsJump to latest comment

TORB's picture


I created this script to delete computers from a txt file (one computer pr line). Modify as needed.

' Migration - remove computers from old Altiris, when using new solution
' Written october 2012 by Torbjørn Remmen Syscom
On Error Resume Next
' Database connection
set db_new = createObject("adodb.connection") "provider=sqloledb;data source=databaseserver;initial catalog=symantec_cmdb;user id=SQLUser;password=SQLpasswod"

' Loop Windows XP

Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\temp\windowxp.txt",1)
Dim strLine

do while not objFileToRead.AtEndOfStream
     strLine = objFileToRead.ReadLine()
     sql = "select guid from vCMDBComputer where name like '"  & strLine & "' "

    set rs_new = db_new.execute(sql)

  db_new.execute("insert into itemtodelete(guid) values('" & rs_new(0) & "') ")

msgbox "Done"

Jeremy V's picture

Anyone have a retire computers from file script...

NS 7.1.8280