|
;See the UDF: fnWMIService - Use the Win32_Service class of WMI to control services ;http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=83246 ;To do the remote execution of the "wuauclt /resetauthorization /detectnow" look at this UDF ;RemoteExec() - execute a process on remote PCs ;http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=83206 If Not @LogonMode Break On EndIf Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') $SO=SetOption('WrapAtEOL','On')
Dim $sComputer, $sComputers, $Key, $Nul ;Put all computers into an array. $sComputers = Split("wrender-lap", "fe-crosstec") $key = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\"
;Execute the command bellow on each computewr from the array filled above. For Each $sComputer In $sComputers ;Delete the registry keys. $Nul = DelValue("\\"+$sComputer+"\"+$Key,'AccountDomainSid') ?@ERROR ?@SERROR Sleep 2 $Nul = DelValue("\\"+$sComputer+"\"+$Key,'PingID') ?@ERROR ?@SERROR Sleep 2 $Nul = DelValue("\\"+$sComputer+"\"+$Key,'SusClientId') ?@ERROR ?@SERROR Sleep 2 ;Stop and start the windows update service so new stuff gets initialized. $Nul = fnWMIService('wuauserv','stop',$sComputer) $Nul = fnWMIService('wuauserv','start',$sComputer) Next Function fnWMIService($sService,$sMethod,Optional $sComputer) Dim $objWMI,$objSrvc,$nul If Not $sComputer $sComputer=@WKSTA EndIf $objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+"\root\cimv2") If @ERROR<0 Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf $objSrvc = $objWMI.ExecQuery('Select * from Win32_Service WHERE Name = "'+$sService+'"') For Each $objSrvc in $objSrvc $nul=Execute("$"+"fnWMIService = $"+"objSrvc."+$sMethod) Next EndFunction
|