Thursday, November 25, 2010

VB Script to run gpupdate.exe /force silently without a reboot

If you use Gpupdate.exe /force in your logon scripts ypu would've of found by now that sometimes if not most often when running gpupdate.exe you are asked to either logoff or reboot to apply configuration settings. You've also probably found that there is no exact command like 'Gpupdate.exe /Force /Silent.'

The below VBscript below will run Gpupdate.exe /force without any user interaction it will also not show any log off or reboot requests.

To implement this in a logon script place the code below into its own SilentGPupdate.vbs file. Then call it from your logon script, I've set the WshShell.Run not to wait to finish each command because gpupdate.exe can run in its own space and time (doing this will keep your login times quick).

'VB Script for Refreshing GroupPolicy Settings silently
'Script Version: 0.2
'Created: 25/11/2010
'Created By:

'Define Variables and Objects.
Set WshShell = CreateObject("Wscript.Shell")

'Note: Gpupdate command has to be run twice as the ECHO command can't answer more than one question.

'Refresh the USER policies and also answer no to logoff if asked.
Result = WshShell.Run("cmd /c echo n | gpupdate /target:user /force",0,true)

'Refresh the Computer policies and answer no to reboot.
Result = WshShell.Run("cmd /c echo n | gpupdate /target:computer /force",0,true)

'Hand back the errorlevel

Props to Craig for pointing out that if you name the script gpupdate.vbs you will cause a loop.

Wednesday, November 24, 2010

General BITS troubleshooting

Iboyd has a great writeup on how and where to check various BITS settings in SCCM.

One line in his post rings very true
"With BITS, you have to remember that, in simple terms, you’re downloading files from an over-glorified website. That means that your file transfers are dependent on the IIS instance running on the distribution point."