Admiral208 Posted May 6, 2011 Posted May 6, 2011 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. Or is there a way that I can make these registry changes only once with GP Prefs.? Any help much appreciated. James
Steve21 Posted May 6, 2011 Posted May 6, 2011 Unless it's changed it should be as simple as: :BEGIN IF NOT EXIST C:\wsus.txt GOTO NOTFOUND :FOUND (put code here) :NOTFOUND 1
itguy101 Posted May 6, 2011 Posted May 6, 2011 (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 May 6, 2011 by itguy101 1
itguy101 Posted May 6, 2011 Posted May 6, 2011 im not too certain if you need the pause in there though
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now