Update-GroupPolicy : add option for /force

Topics: Archive - General
Apr 22, 2014 at 2:22 PM

It should be great to have a parameter for launching the gpupdate with /force
I have an application that needs some specific NTFS right to function. So after the install, users can't launch it before rebooting their PC, except if I could execute a gpupdate /force

what do you think ?
Apr 22, 2014 at 3:48 PM

Execute-process -filepath gpupdate -arguments "/force" -WindowStyle Hidden

seems to work
Apr 22, 2014 at 3:55 PM
I'm loath to include this because if you have Group Policy Preferences, they can sometimes request a logout when using the /Force parameter. This will essentially cause your script to freeze up while it waits for a Yes / No answer.

If you have success with the above method, I'd continue to use it. But be aware that the introduction of GPPrefs may cause this to hang.

Apr 22, 2014 at 10:25 PM
You're right, I had not thought about this problem

otherwise, is it possible, during the post install, to act as if the setup request a reboot to complete the installation so that the user is notified that it must reboot to finish the install, even if the setup in himself not even asked?
Apr 29, 2014 at 1:47 PM
Yup, just use Show-InstallationRestartPrompt :)
May 2, 2014 at 2:05 PM
Thanks I will try that :)
May 11, 2014 at 8:41 PM
I think we can do this :
Execute-process -filepath "$envWindir\system32\cmd.exe" -arguments "/c echo n | gpupdate /target:computer /force" -WindowStyle Hidden
Execute-process -filepath "$envWindir\system32\cmd.exe" -arguments "/c echo n | gpupdate /target:user/force" -WindowStyle Hidden
May 14, 2014 at 1:19 PM
Tested this and seems to work fine so I've included this in the latest commit.
May 14, 2014 at 1:38 PM
Cool cheers