We help IT Professionals succeed at work.
Get Started

Need a VBSCRIPT or CMD to find one or two strings in a text file then execute either Script for that string

684 Views
Last Modified: 2012-08-13
I need a Script, Vbscript or CMD to search the last 15 lines of c:\windows\windowsupdate.log and if found, run either or Both of the scripts below:

'80070002'

Resetaut.bat:
@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

'080070057'

Bitspurge.cmd:
setlocal
set que=%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader
net stop BITS
Ipconfig /FlushDNS
if exist "%que%\qmgr0.old" del /q "%que%\qmgr0.old"
if exist "%que%\qmgr1.old" del /q "%que%\qmgr1.old"
Rename "%que%\qmgr0.dat" qmgr0.old
Rename "%que%\qmgr1.dat" qmgr1.old
net start BITS
endlocal

Thanks!
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE