Link to home
Start Free TrialLog in
Avatar of eulogy1211
eulogy1211

asked on

WSUS fix? Batch file needed to run once, then delete

Hello all -

I have WSUS running - after updating to 3.0, I currently have about 93 clients that aren't checking in.

During the troubleshooting process - I found network connectivity to be present, all looks well. I then ran the batch file listed below on a PC - and then forced a gpupdate and the client started checking in and pulling updates no problem. HOwever, I do not have the time, nor does the network admin to actually touch every one of these PCs to run this.

@echo on
net stop wuauserv
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
net start wuauserv
wuauclt /resetauthorization /detectnow


I have this batch file in a public share \\suserver\share1  for example.

I would like to be able to have a script that runs, that copies this file to the local machines from the suserver- runs it - then deletes itself. Is this possible?
Avatar of stea1mic
stea1mic
Flag of United States of America image

Have you thought about adding it to your login scripts?
Avatar of eulogy1211
eulogy1211

ASKER

Yes - I have.

I was worried about it rerunning multiple times on the PCs - that's why I wanted it to be deleted after the batch file ran.

I also don't think it would make a difference on PCs that are working fine under WSUS (about 60 are OK) - so I was planning on linking it via GP to the entire computers OU. But still having it deleted would be nice.
We did a very basic check for something similar.  We wanted to uninstall SMS clients, but only once.  So we had it check for a text file on the c:\ drive and skip processing if it was there, else it did the job and then created the file.

@ echo off

IF EXIST c:\done.txt (
      goto exit
) ELSE (


echo Uninstall SCCM Client
\\server\share\ccmsetup.exe /uninstall

echo Uninstall SMS Adv Client
\\server\share\ccmclean.exe /all /q

echo Remove SCCM Install Client Directory
IF EXIST c:\windows\system32\ccmsetup (
    rmdir /s /q c:\windows\system32\ccmsetup
    echo done > c:\done.txt
) ELSE (
    echo done > c:\done.txt
    goto next
)

:next
echo Remove SMS Adv Client Directory
IF EXIST c:\windows\system32\ccm (
    rmdir /s /q c:\windows\system32\ccm
    echo done > c:\done.txt
) ELSE (
    echo done > c:\done.txt
    goto exit
)
)
:exit
echo Complete
You could also run the commands remotely using PsExec.
http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx
ASKER CERTIFIED SOLUTION
Avatar of chandru_sol
chandru_sol
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much Chandru - I'm actually going on site Wednesday morning to attempt to implement this fix and hopefully have this resolved. I will then follow up with an update - once again thank you for your time, I appreciate it.
No worries. Let me know how you get on and if any help needed let me know

regards
Chandru
Did you give this a try?

regards
Chandru
I did in fact get it deployed - set it up as a logon script under Group Policy - THe notepad files are all located in the share I specified - however - the clients are still not showing up in the SUS Console :(

I will award the points to you for your effort and help, however, not a resolution yet sadly.
I must have a different issue then with WSUS, fix has been implemented - but still the same clients are not showing up in the sus console.
We will work to get the resolution

Did you find the machine SID in the share?

regards
Chandru
Could you help me clarify as to what part of the file name I'm looking at?

I have .txt documents for all clients that ran this script. Text within the document is obviously the hostname of the machine, from just skimming through real fast - I was looking at the first part of the subject - it appears all are unique - what exactly should I be looking  for?

I do really appreciate your help, Chandru! Thank you.
The text file will be the SID of the machine and the hostname will be the content of the text file

Can you delete the reg key client id checked in one of the machine which has got issues and see if that appears in the SUS once again?

No worries!

regards
Chandru