Batch file to configure WSUS in Workgroup

1

I'd like to create a Batch file that I can then remotely execute on machines in a workgroup in order to point them at a WSUS installation. I understand it is via the use registry keys:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\WUServer
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\WUStatusServer

And then the following key set to 1:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU

Then to run a wuauclt /reportnow and /detectnow.

Is this possible via batch? Can you create and edit registry keys via batch files?

Thanks!

PnP

Posted 2012-11-07T20:10:19.870

Reputation: 923

Answers

3

Kindly use below commands to create batch file.

REM Stop the Automatic Updates service
net stop wuauserv

REM Stop the Windows Management Instrumentation service
net stop winmgmt

REM Backup ReportingEvents.log.  Then, delete the contents of
REM  %systemroot%\SoftwareDistribution and
REM  %systemroot%\system32\WBEM\Repository
copy %systemroot%\softwaredistribution\reportingevents.log %homedrive%\
del /f /q %systemroot%\softwaredistribution\*.*
move %homedrive%\reportingevents.log %systemroot%\softwaredistribution

REM Delete SusClientID and AccountDomainSid keys from
REM  HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate
SET WU_KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate
reg delete %WU_KEY% /v SusClientID
reg delete %WU_KEY% /v AccountDomainSid
SET WU_KEY=

REM Start the Automatic Updates service
net start wuauserv

REM Start the Windows Management Instrumentation service
net start winmgmt

REM Force a group policy update
gpupdate /force

REM Roll the WU Client...
wuauclt /resetauthorization /detectnow

Amrinder Singh

Posted 2012-11-07T20:10:19.870

Reputation: 69