Pages

Remote Activation of SMS Agent on Client

Remote Activation of SMS Agent on Client


In an SMS enviroment you must have the SMS Agent running on the client or you can't do anything. In a strickly user enviroment this doesn't matter since the user can't turn it off, but if you have a user that has admin rights to his/her machine then they have the power to turn you off. Finding them is simple enough, look at the computers that haven't sent in an inventory in quite a while, heart beat or other options. The problem is getting that service restarted. Here is a vbscript that will turn the service back on for a number of computers.-------------------------Const SW_NORMAL = 1'change comps to match the number of computers in your arrayDim Comps(1) Comps(0)="computer1"Comps(1)="Computer2"for each strComputer in Comps strCommand = "net start ccmexec"Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2")Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_objConfig.ShowWindow = SW_NORMALSet objProcess = objWMIService.Get("Win32_Process")intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)'remark lines if you don't want to see the success or failure of the programIf intReturn <> 0 ThenWscript.Echo "Process could not be created." & _vbNewLine & "Command line: " & strCommand & _vbNewLine & "Return value: " & intReturnElseWscript.Echo "Process created." & _vbNewLine & "Command line: " & strCommand & _vbNewLine & "Process ID: " & intProcessID End IfNext

Source for this Post

----------------------------This is simple but effective. You can run it manually or set it as a Scheduled Task on the server.Remember you must have admin rights on the computer to run this, so we are talking about an local admin account or domain admin.

0 comments:

Post a Comment