Opps. Sorry about that Dom. The location where that post is on the moderators forum. I keep making that mistake with regards to that post.
I've copied the script here for you to use. You'll obviously need to modify it for your environment. Sorry for the bad link earlier.
Here is a scrub script that you can push out to your managed machines, to uninstall/reinstall and/or redirect them to a new server while you rebuild your existing box, if you so desire.
You'll need to do a few things, such as change the server names to your own, change the GUIDs at the end of the script to match your own, and prep copies of "AeXAgentUtil.exe" & "AeXNSC.exe" into a folder named "AltirisTeamSourceFiles$" on your source server.
'ScrubScript.vbs
'By XXXXXXXXXXXX
' with error handling and logging by XXXXXXXXXXXX
Option Explicit
On Error Resume Next
Dim wshShell, objFso, eFLdr, tFldr
Dim strWindir, objFolder, objFile
Dim strComputerName, strFileDateTime
Dim dtmThisDay, dtmThisMonth, dtmThisYear
Dim dtmThisHour, dtmThisMinute, dtmThisSecond
Dim strFileName, strMessage
Dim strUserName, strUserDomain, strUserProfile
Dim strLogonServer, strTemp, strTmp
Dim strMissingFileSource, strLogCollectionShare
Dim strSource, strDestination, strCMD
strMissingFileSource = "
\\migrationsrv\AltirisTeamSourceFiles$\"
strLogCollectionShare = "
\\migrationsrv\AltirisTeamScriptLogs$\"
set wshShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
'Create folder structure for holding logs for this script, if necessary:
strWindir = wshShell.ExpandEnvironmentStrings("%Windir%\")
If NOT (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete")) then _
Set objFolder = objFso.CreateFolder(strWindir & "AltirisTeamInfo-DoNotDelete")
If NOT (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs")) then _
Set objFolder = objFso.CreateFolder(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs")
If NOT (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript")) then _
Set objFolder = objFso.CreateFolder(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript")
'Create and open log file for this execution of this script:
strComputerName = wshShell.ExpandEnvironmentStrings("%ComputerName%" )
dtmThisDay = Day(Now)
If (Len(dtmThisDay) = "1") Then dtmThisDay = "0" & dtmThisDay
dtmThisMonth = Month(Now)
If (Len(dtmThisMonth) = "1") Then dtmThisMonth = "0" & dtmThisMonth
dtmThisYear = Year(Now)
dtmThisHour = Hour(Now)
If (Len(dtmThisHour) = "1") Then dtmThisHour = "0" & dtmThisHour
dtmThisMinute = Minute(Now)
If (Len(dtmThisMinute) = "1") Then dtmThisMinute = "0" & dtmThisMinute
dtmThisSecond = Second(Now)
If (Len(dtmThisSecond) = "1") Then dtmThisSecond = "0" & dtmThisSecond
strFileDateTime = "--" & _
dtmThisYear & "-" & _
dtmThisMonth & "-" & _
dtmThisDay & "--" & _
dtmThisHour & "-" & _
dtmThisMinute & "-" & _
dtmThisSecond
strFileName = strComputerName & "--ScrubScript" & strFileDateTime & ".txt"
Set objFile = objFSO.CreateTextFile(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript\" & _
strFileName,TRUE)
'***Start of Logging
strMessage = "START OF LOG: " & strFileName & "."
objFile.Writeline strMessage : CheckError
objFile.Writeline " " : CheckError
'Copy log to share on NS server to indicate script started:
strMessage = " 001: Copy log to share on NS server to indicate script started."
objFile.Writeline strMessage : CheckError
'Create Server folder structure for holding logs for this script, if necessary:
If NOT (objFso.FolderExists(strLogCollectionShare & "ScriptLogs")) then _
Set objFolder = objFso.CreateFolder(strLogCollectionShare & "ScriptLogs")
If NOT (objFso.FolderExists(strLogCollectionShare & "ScriptLogs\ScrubScript")) then _
Set objFolder = objFso.CreateFolder(strLogCollectionShare & "ScriptLogs\ScrubScript")
strSource = strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript\" & _
strFileName & "-START"
strDestination = strLogCollectionShare & "ScriptLogs\ScrubScript\"
strCMD = "xcopy.exe " & strSource & " " & strDestination & " /V /Y /Q"
WshShell.Run strCMD, 2, True 'Run minimized and wait
'Diagnostic information
strMessage = " 010: Diagnostic information:"
objFile.Writeline strMessage : CheckError
strUserName = wshShell.ExpandEnvironmentStrings("%UserName%")
strUserDomain = wshShell.ExpandEnvironmentStrings("%UserDomain%")
strUserProfile = wshShell.ExpandEnvironmentStrings("%UserProfile%")
strLogonServer = wshShell.ExpandEnvironmentStrings("%LogonServer%")
strTemp = wshShell.ExpandEnvironmentStrings("%Temp%")
strTmp = wshShell.ExpandEnvironmentStrings("%Tmp%")
strMessage = _
" UserName = " & strUserName & "; " & _
"UserDomain = " & strUserDomain & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" UserProfile = " & strUserProfile & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" LogonServer = " & strLogonServer & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" Temp = " & strTemp & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" Tmp = " & strTmp & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" MissingFileSource = " & strMissingFileSource & "."
objFile.Writeline strMessage : CheckError
strMessage = _
" LogCollectionShare = " & strLogCollectionShare & "."
objFile.Writeline strMessage : CheckError
objFile.Writeline " " : CheckError
'Begin meaningful ScrubScript execution:
strMessage = " 020: Begin meaningful ScrubScript execution."
objFile.Writeline strMessage : CheckError
'**********
'Make sure the files needed to install and uninstall the Altiris client
' are present on the local system before proceeding further.
strMessage = " 030: Make sure the files needed to install and uninstall the Altiris client"
objFile.Writeline strMessage : CheckError
strMessage = " are present on the local system before proceeding further."
objFile.Writeline strMessage : CheckError
'Check for aexagentutil.exe:
If (objFso.FileExists("c:\windows\temp\aexagentutil.e xe")) then
strMessage = " 031: The file c:\windows\temp\aexagentutil.exe is present locally."
objFile.Writeline strMessage : CheckError
Else
strMessage = " 032: The file c:\windows\temp\aexagentutil.exe is not present locally."
objFile.Writeline strMessage : CheckError
strSource = strMissingFileSource & "\aexagentutil.exe"
strDestination = "c:\windows\temp\"
strCMD = "xcopy.exe " & strSource & " " & strDestination & " /V /Y /Q"
strMessage = " 033: Copying the file locally with the following command:"
objFile.Writeline strMessage : CheckError
strMessage = " " & strCMD & "."
objFile.Writeline strMessage : CheckError
WshShell.Run strCMD, 2, True : CheckError 'Run minimized and wait
If (objFso.FileExists("c:\windows\temp\aexagentutil.e xe")) then
strMessage = " 035: The file c:\windows\temp\aexagentutil.exe is now present locally."
objFile.Writeline strMessage : CheckError
Else
strMessage = " 036: The file c:\windows\temp\aexagentutil.exe is still not present locally."
objFile.Writeline strMessage : CheckError
strMessage = " Continuing regardless."
objFile.Writeline strMessage : CheckError
End If
End If
'Check for aexnsc.exe:
If (objFso.FileExists("c:\windows\temp\aexnsc.exe")) then
strMessage = " 041: The file c:\windows\temp\aexnsc.exe is present locally."
objFile.Writeline strMessage : CheckError
Else
strMessage = " 042: The file c:\windows\temp\aexnsc.exe is not present locally."
objFile.Writeline strMessage : CheckError
strSource = strMissingFileSource & "\aexnsc.exe"
strDestination = "c:\windows\temp\"
strCMD = "xcopy.exe " & strSource & " " & strDestination & " /V /Y /Q"
strMessage = " 043: Copying the file locally with the following command:"
objFile.Writeline strMessage : CheckError
strMessage = " " & strCMD & "."
objFile.Writeline strMessage : CheckError
WshShell.Run strCMD, 2, True : CheckError 'Run minimized and wait
If (objFso.FileExists("c:\windows\temp\aexnsc.exe")) then
strMessage = " 045: The file c:\windows\temp\aexnsc.exe is now present locally."
objFile.Writeline strMessage : CheckError
Else
strMessage = " 046: The file c:\windows\temp\aexnsc.exe is still not present locally."
objFile.Writeline strMessage : CheckError
strMessage = " Continuing regardless."
objFile.Writeline strMessage : CheckError
End If
End If
eFldr = "C:\Program Files\Altiris\eXpress"
tFldr = "C:\windows\temp"
'Remove Altiris AClient from the command line, if AClient.exe is present
If (objFso.FileExists("c:\program files\altiris\AClient\AClient.exe")) then
strMessage = " 051: The file c:\program files\altiris\AClient\AClient.exe is present locally."
objFile.Writeline strMessage : CheckError
strMessage = " 052: Remove Altiris AClient from the command line using the following command:"
objFile.Writeline strMessage : CheckError
strMessage = " wshShell.Run 'c:\program files\altiris\AClient\AClient.exe -remove -silent', 2, True"
objFile.Writeline strMessage : CheckError
wshShell.Run """c:\program files\altiris\AClient\AClient.exe"" -remove -silent", 2, True : CheckError
Else
strMessage = " 053: The file c:\program files\altiris\AClient\AClient.exe is not present locally."
objFile.Writeline strMessage : CheckError
strMessage = " The AClient will not be removed using c:\program files\altiris\AClient\AClient.exe."
objFile.Writeline strMessage : CheckError
End If
'Remove Altiris Agent from the command line
strMessage = " 055: Remove Altiris Agent from the command line using the following command:"
objFile.Writeline strMessage : CheckError
strMessage = " wshShell.Run 'c:\windows\temp\aexagentutil.exe /uninstallagents /clean', 2, True"
objFile.Writeline strMessage : CheckError
wshShell.Run "c:\windows\temp\aexagentutil.exe /uninstallagents /clean", 2, True : CheckError 'Run minimized and wait
'Delete c:\program files\altiris\eXpress folder, if necessary
strMessage = " 060: Delete c:\program files\altiris\eXpress folder, if necessary."
objFile.Writeline strMessage : CheckError
if (objFso.FolderExists("c:\program files\altiris\express")) then
objFso.DeleteFolder eFldr : CheckError
end if
'Delete 25 Altiris registry keys
strMessage = " 070: Delete 25 Altiris registry keys."
objFile.Writeline strMessage : CheckError
wshShell.Run "reg.exe delete HKLM\Software\Altiris /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXSynchAgent.Schedu ledTaskHandler /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXSynchAgent.Schedu ledTaskHandler.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\AeXTaskSynchAgent.AeXSynchEx ecution /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\AeXTaskSynchAgent.AeXSynchEx ecution.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Monitor /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Monitor.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Profile /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Profile.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Receiver /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Receiver. 1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Sender /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Sender.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Settings /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Settings. 1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Transport /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXNetwork.Transport .1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXPackageDelivery /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXPackageDelivery.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXSWDAgent.Schedule dTaskHandler /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.AeXSWDAgent.Schedule dTaskHandler.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.Synch /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Classes\Altiris.Synch.1 /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uni nstall\{2851123E-5786-41BE-A3F1-A9B21E499EEB} /f", 2, True : CheckError 'Run minimized and wait
wshShell.Run "reg.exe delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uni nstall\{92F2A534-C3E4-4B18-BEBD-329F5E848C8B} /f", 2, True : CheckError 'Run minimized and wait
'Recreate and reconfigure Altiris Agent from the command line
strMessage = " 080: Recreate and reconfigure Altiris Agent from the command line using the following command:"
objFile.Writeline strMessage : CheckError
strMessage = " wshShell.Run 'c:\windows\temp\aexnsc.exe -a -s ns=migrationsrv.altiris.lab NOSTARTMENU NOTRAYICON /ADDREMOVE /s', 2, True"
objFile.Writeline strMessage : CheckError
wshShell.Run "c:\windows\temp\aexnsc.exe -a -s ns=migrationsrv.altiris.lab NOSTARTMENU NOTRAYICON /ADDREMOVE /s", 2, True : CheckError 'Run minimized and wait
'Delete 3 Altiris files from c:\windows\temp folder, if necessary
strMessage = " 087: Delete 3 Altiris files from c:\windows\temp folder, if necessary."
objFile.Writeline strMessage : CheckError
if (objFso.FileExists("c:\windows\temp\AexAgentUtil.e xe")) then
objFso.DeleteFile("c:\windows\temp\AeXAgentUtil.ex e") : CheckError
end if
if (objFso.FileExists("c:\windows\temp\AeXNSC.exe")) then
objFso.DeleteFile("c:\windows\temp\AeXNSC.exe") : CheckError
end if
if (objFso.FileExists("c:\windows\temp\ScrubScript.vb s")) then
objFso.DeleteFile("c:\windows\temp\ScrubScript.vbs ") : CheckError
end if
'Finish meaningful ScrubScript execution:
strMessage = " 090: Finish meaningful ScrubScript execution."
objFile.Writeline strMessage : CheckError
dtmThisDay = Day(Now)
If (Len(dtmThisDay) = "1") Then dtmThisDay = "0" & dtmThisDay
dtmThisMonth = Month(Now)
If (Len(dtmThisMonth) = "1") Then dtmThisMonth = "0" & dtmThisMonth
dtmThisYear = Year(Now)
dtmThisHour = Hour(Now)
If (Len(dtmThisHour) = "1") Then dtmThisHour = "0" & dtmThisHour
dtmThisMinute = Minute(Now)
If (Len(dtmThisMinute) = "1") Then dtmThisMinute = "0" & dtmThisMinute
dtmThisSecond = Second(Now)
If (Len(dtmThisSecond) = "1") Then dtmThisSecond = "0" & dtmThisSecond
strFileDateTime = "--" & _
dtmThisYear & "-" & _
dtmThisMonth & "-" & _
dtmThisDay & "--" & _
dtmThisHour & "-" & _
dtmThisMinute & "-" & _
dtmThisSecond
'***End of Logging
objFile.Writeline " " : CheckError
strMessage = "END OF LOG: " & strComputerName & "--ScrubScript" & strFileDateTime & "."
objFile.Writeline strMessage : CheckError
objFile.Close
'Copy log to share on NS server:
'Create Server folder structure for holding logs for this script, if necessary:
If NOT (objFso.FolderExists(strLogCollectionShare & "ScriptLogs")) then _
Set objFolder = objFso.CreateFolder(strLogCollectionShare & "ScriptLogs")
If NOT (objFso.FolderExists(strLogCollectionShare & "ScriptLogs\ScrubScript")) then _
Set objFolder = objFso.CreateFolder(strLogCollectionShare & "ScriptLogs\ScrubScript")
strSource = strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript\" & _
strFileName
strDestination = strLogCollectionShare & "ScriptLogs\ScrubScript\"
strCMD = "xcopy.exe " & strSource & " " & strDestination & " /V /Y /Q"
WshShell.Run strCMD, 2, True 'Run minimized and wait
'Delete folder structure for holding logs for this script:
If (objFso.FileExists(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript\" & _
"*.*")) then _
Set objFile = objFso.DeleteFile(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript\" & _
"*.*")
If (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript")) then _
Set objFolder = objFso.DeleteFolder(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs\ScrubScript")
If (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs")) then _
Set objFolder = objFso.DeleteFolder(strWindir & "AltirisTeamInfo-DoNotDelete" & "\ScriptLogs")
If (objFso.FolderExists(strWindir & "AltirisTeamInfo-DoNotDelete")) then _
Set objFolder = objFso.DeleteFolder(strWindir & "AltirisTeamInfo-DoNotDelete")
'Sleep for 30 seconds
Wscript.Sleep 30000
'Release objects
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
Set WshShell = Nothing
Sub CheckError
Dim strMessage, strErrNumber, strErrDescription
If Err = 0 Then Exit Sub
strErrNumber = Hex(Err)
strErrDescription = " "
If strErrNumber = "8002009" Then strErrDescription = "Error Setting Default Printer"
If strErrNumber = "80020005" Then strErrDescription = "Type mismatch"
If strErrNumber = "800401E4" Then strErrDescription = "Syntax error"
If strErrNumber = "80040E14" Then strErrDescription = "One or more errors occurred during processing of command"
If strErrNumber = "80040E37" Then strErrDescription = "Table does not exist"
If strErrNumber = "80041001" Then strErrDescription = "Call Failed"
If strErrNumber = "80041010" Then strErrDescription = "Spelling mistake in a keyword"
If strErrNumber = "80041021" Then strErrDescription = "Syntax error in WMI winmgmts \\"
If strErrNumber = "80070002" Then strErrDescription = "File not found"
If strErrNumber = "80070005" Then strErrDescription = "Access denied"
If strErrNumber = "80070035" Then strErrDescription = "The network PATH cannot be found"
If strErrNumber = "80070043" Then strErrDescription = "The network NAME cannot be found"
If strErrNumber = "80070055" Then strErrDescription = "The local device name is already in use"
If strErrNumber = "8007007B" Then strErrDescription = "The filename, directory or volume is incorrect"
If strErrNumber = "800704B0" Then strErrDescription = "The specified device name is invalid"
If strErrNumber = "800704B2" Then strErrDescription = "An attempt was made to remember a device ......."
If strErrNumber = "800704B3" Then strErrDescription = "No network provider accepted the given network path"
If strErrNumber = "800704CA" Then strErrDescription = "This network connection does not exist"
If strErrNumber = "800704C3" Then strErrDescription = "Multiple Connections to a server or shared resource..."
If strErrNumber = "800704CF" Then strErrDescription = "The network location cannot be reached"
If strErrNumber = "8007052E" Then strErrDescription = "Logon Failure: unknown user name or bad password"
If strErrNumber = "80070709" Then strErrDescription = "The Printer name is invalid"
If strErrNumber = "80070961" Then strErrDescription = "This network connection has files open or requests pending"
If strErrNumber = "80071329" Then strErrDescription = "Object Already Exists"
If strErrNumber = "8007202B" Then strErrDescription = "A referral was returned from the server"
If strErrNumber = "80072030" Then strErrDescription = "There is no such object on the server"
If strErrNumber = "80072032" Then strErrDescription = "LDAP syntax error. Possibly a missing element e.g. cn="
If strErrNumber = "80072035" Then strErrDescription = "The server is unwilling to process the request"
If strErrNumber = "8007203A" Then strErrDescription = "The server is not operational"
WScript.echo "ERROR:"
WScript.echo Err.Number & " " & strErrNumber & "; " & strErrDescription
strMessage = "ERROR: " & Err.Number & " " & strErrNumber & "; " & strErrDescription
objFile.Writeline " "
objFile.Writeline strMessage
objFile.Writeline " "
Err.Clear
End Sub