Jump to content

Recommended Posts

Posted

Morning!

 

I want to run this script on all our PC's as a login script.

 

@echo off 
Echo Save the batch file "AU_Clean_SID.cmd". This batch file will do the following: 
Echo 1.    Stops the wuauserv service 
Echo 2.    Deletes the AccountDomainSid registry key (if it exists) 
Echo 3.    Deletes the PingID registry key (if it exists) 
Echo 4.    Deletes the SusClientId registry key (if it exists) 
Echo 5.    Restarts the wuauserv service 
Echo 6.    Resets the Authorization Cookie 
Echo 6.    More information on [url]http://msmvps.com/Athif[/url] 
Pause 
@echo on 
net stop wuauserv 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f 
net start wuauserv 
wuauclt /resetauthorization /detectnow 
Pause 

 

Can some clever fellow modify it so that it checks for a text file called WSUS.txt on the root of c:\. If the file is present, dont run the script, if the file doesnt exist, runs the script.

 

I have zero idea how to do this and my earlier attempt failed miserably. :confused:

 

Or is there a way that I can make these registry changes only once with GP Prefs.?

 

Any help much appreciated.

 

James

Posted (edited)

IF EXIST C:\WSUS.txt goto SkipWSUS

net stop wuauserv

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f

net start wuauserv

wuauclt /resetauthorization /detectnow

echo done > C:\WSUS.txt

:SkipWSUS

This skips the middle section if the file already exists. If it doesnt, it will run your code then create the file.

Edited by itguy101
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...