it-infra
asked on
How to write a script and run it on Group Policy?
Hello All,
I'm running WSUS and for some reasons I wanna run the following:
1- Net Stop WUAUServ
2- Delete C:\Windows\SoftwareDistrib ution
3- Net Start WUAUServ
These 3 commands will stop updating service, delete updates that might be corrupted then restart the service, how to write such a script and how to implement it on Group Policy?
Thanks
I'm running WSUS and for some reasons I wanna run the following:
1- Net Stop WUAUServ
2- Delete C:\Windows\SoftwareDistrib
3- Net Start WUAUServ
These 3 commands will stop updating service, delete updates that might be corrupted then restart the service, how to write such a script and how to implement it on Group Policy?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
EE:
Do the numbers really have to be that big? Screen HOG, sorry guys, first time I've tried that
Do the numbers really have to be that big? Screen HOG, sorry guys, first time I've tried that
ASKER
@tmassa99
Will that work with earlier OS like XP? cuz I got this note:
"PowerShell scripts requires at least Windows 7 or Windows Server 2008."
However I found this article: http://social.technet.microsoft.com/Forums/en/winserverGP/thread/a8921d68-5115-448a-b489-16b941a971f6
So is the above script written to work on legacy OS too?
Thanks
Will that work with earlier OS like XP? cuz I got this note:
"PowerShell scripts requires at least Windows 7 or Windows Server 2008."
However I found this article: http://social.technet.microsoft.com/Forums/en/winserverGP/thread/a8921d68-5115-448a-b489-16b941a971f6
So is the above script written to work on legacy OS too?
Thanks
This is a VBScript, so it will work on either
ASKER
I modified the code to be a batch as follow:
I configured it to be on startup however I wanna do it only once on a specific time, is there a way to do it? Like I wanna run the script on 6 PM everyday.
Thanks
net stop wuauserv
rd /s /q %windir%\SoftwareDistribution
net start wuauserv
%windir%\system32\wuauclt.exe /detectnow
I configured it to be on startup however I wanna do it only once on a specific time, is there a way to do it? Like I wanna run the script on 6 PM everyday.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In ADUC create or edit a GPO.
2. Go to the Computer or User Configuration, depending on how you want your script to run.
3. Under Window Settings > Scripts you'll see StartUp and Shutdown (or Logon and Logoff). Double-click the event you want and "Add..." the script