How to reconfigure the NS Agent via script


Article ID: 180329


Updated On:


Management Platform (Formerly known as Notification Server)




How do I reconfigure the agent to get a new GUID and reset previous content (via VB script)?

Run the follow script via DS job or any other remote method:


' Description:
' Script to reconfigure Altiris Agent in situation where lack of communication or guid duplications make
' imposible reinstall or configure agents.
' This script will Check:
' 1.) Correct Server configuration
' 2.) Will reset guid
' 3.) Will Restart Altiris Agent service
' 4.) Will clean (deletes) Queue and Policies files
' 5.) Will force basic inventory and policy updates (ignoring blockouts)
' Platform: Script tested on NS Agent versions: 6.0.1508 and 6.0.1121
Option Explicit
Dim FSO, WshShell, oShell, objApp, AltirisIns, Server, Path, Policies, Software, client, policymgr, ignoreBlockouts, sendIfUnchanged, serverconf, webconf, cliguid
Dim output
Set WshShell = wscript.createobject("")
'Will look where is the agent location
AltirisIns=WshShell.RegRead ("HKLM\Software\Altiris\Altiris Agent\InstallDir")
'Will look for the server directory
Server=WshShell.RegRead ("HKLM\Software\Altiris\Altiris Agent\Servers\")

' NOTICE: Change <server_name> to your NS FQDN. Ie: MY_NS_SERVER.MY_DOMAIN.COM
If Server <> "<server_name>" then
 set client = wscript.createobject ( "Altiris.AeXNSClient" )
 serverconf = "<server_name>"
 webconf = "
 client.PutServer serverconf, webconf
End If
set objApp = wshshell.Exec ("cmd /c call " &chr(34) &AltirisIns &chr(34) +"\AeXAgentUtil.exe /resetguid")
output = objApp.StdOut.ReadAll
If objApp.ExitCode=0 Then
    'Restarts Altiris Agent Service
    set objApp = wshshell.Exec ("cmd /c call " &chr(34) &AltirisIns &chr(34) +"\AeXAgentUtil.exe /stop")
    output = objApp.StdOut.ReadAll
    If objApp.ExitCode=0 Then
     set objApp = wshshell.Exec ("cmd /c call " &chr(34) &AltirisIns &chr(34) +"\AeXAgentUtil.exe /start")
         output = objApp.StdOut.ReadAll
    End If 
End If
set FSO=createobject("scripting.filesystemobject")
'Deletes files in Client Policies
Policies=AltirisIns+"\Client Policies\*.*"
FSO.deletefile Policies
'Set to delete everything under queue\<server name>
'Deletes files in Queue
FSO.deletefile Path
set client = wscript.createobject ( "Altiris.AeXNSClient" )
'Force Basic Inventory
ignoreBlockouts = 1
sendIfUnchanged = 1
client.SendBasicInventory sendIfUnchanged, ignoreBlockouts
'Force Policy Update
client.UpdatePolicies ignoreBlockouts

Set WshShell = Nothing