Hello Guys,
I have an little Problem maybe you could help me.
I want to make an GPUpdate with Autoit.
This time my Function looks like that, but this is not perfect.
Func gpUpdate()
$gpupdate = Run(@ComSpec & " /c gpupdate /force")
For $i = 0 To 30
If Not ProcessExists($gpupdate) Then
ExitLoop
EndIf
Sleep(1000)
Next
ProcessClose($gpupdate)
EndFunc ;==>gpUpdate")
I want to use an COM Object but I have no idea how to use this functions right way.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa374154(v=vs.85).aspx
maybe someone can write an example script/function?
I found this script already in web, but it only push the PC to update Group Policy an I don't know is it ready or not and does it requires an reboot.
Global Const $RP_FORCE = 1
$bMachine = 0
;[in] Specifies whether to refresh the computer policy or user policy. If this value is TRUE, the system refreshes the computer policy. If this value is FALSE, the system refreshes the user policy.
Dim $Return
$Return = DllCAll("Userenv.dll","int","RefreshPolicyEx","int",$bMachine,"int",$RP_FORCE)
If IsArray($Return) Then
ConsoleWrite("Function Returned: " & $Return[0] & @LF)
Msgbox(64,"The Function Returned:","The function returned : " & $Return[0] & @CRLF & "If the value returned was not zero then the function succeeded.")
Else
ConsoleWrite("DllCall didn't return an array. The call was therefore unsuccessful." & @LF)
MsgBox(16,"Error!","The Dll Call was unsuccessful because it did not return an array.")
EndIf
Thank you for your help
CK
PS: I know my english is not perfect but I hope you have unterstood my problem.