Update-GroupPolicy : add option for /force

Topics: Archive - General
Apr 22, 2014 at 3:22 PM
Hi,

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 4:48 PM
ok

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

seems to work
Coordinator
Apr 22, 2014 at 4: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.

Dan
Apr 22, 2014 at 11: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?
Coordinator
Apr 29, 2014 at 2:47 PM
Yup, just use Show-InstallationRestartPrompt :)
May 2, 2014 at 3:05 PM
Thanks I will try that :)
May 11, 2014 at 9: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
Coordinator
May 14, 2014 at 2:19 PM
Tested this and seems to work fine so I've included this in the latest commit.
Coordinator
May 14, 2014 at 2:38 PM
Cool cheers

Seán