st4vr0s Posted October 31, 2008 Share Posted October 31, 2008 Hi, I have a very very basic script which reads, Run ("Regedit.exe /s import C:\WSUSUpdateII\ConfigureWSUS.reg") Sleep 5000 Run ("C:\WSUSUpdateII\RunWSUS.bat") which basically imports .... Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate] "WUServer"="http://server" "WUStatusServer"="http://server" "ElevateNonAdmins"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] "UseWUServer"=dword:00000001 "AutoInstallMinorUpdates"=dword:00000001 "DetectionFrequencyEnabled"=dword:00000001 "DetectionFrequency"=dword:00000001 "NoAutoUpdate"=dword:00000000 "AUOptions"=dword:00000003 "ScheduledInstallDay"=dword:00000000 "ScheduledInstallTime"=dword:00000009 "RescheduleWaitTimeEnabled"=dword:00000001 "RescheduleWaitTime"=dword:00000001 Into the registry, then runs the bat file.... @echo off Set KEY="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" REG ADD %KEY% /V "WUServer" /t REG_SZ /d "http://server:80" /f REG ADD %KEY% /V "WUStatusServer" /t REG_SZ /d "http://server:80" /f REG ADD %KEY% /V "ElevateNonAdmins" /t REG_DWORD /d "1" /f SET KEY="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" REG ADD %KEY% /V "UseWUServer" /t REG_DWORD /d "1" /f REG ADD %KEY% /V "AutoInstallMinorUpdates" /t REG_DWORD /d "1" /f REG ADD %KEY% /V "DetectionFrequencyEnabled" /t REG_DWORD /d "1" /f REG ADD %KEY% /V "DetectionFrequency" /t REG_DWORD /d "1" /f REG ADD %KEY% /V "NoAutoUpdate" /t REG_DWORD /d "0" /f REG ADD %KEY% /V "AUOptions" /t REG_DWORD /d "3" /f REG ADD %KEY% /V "ScheduledInstallDay" /t REG_DWORD /d "0" /f REG ADD %KEY% /V "ScheduledInstallTime" /t REG_DWORD /d "9" /f REG ADD %KEY% /V "RescheduleWaitTimeEnabled" /t REG_DWORD /d "1" /f REG ADD %KEY% /V "RescheduleWaitTime" /t REG_DWORD /d "1" /f Net Stop wuauserv net start wuauserv wuauclt /detectnow /resetauthorisation /downloadnowfast copy "\\server\distribution$\applications\WSUSUpdateII\removeWSUS.reg" "%ALLUSERSPROFILE%\desktop" dir c:\ /s >nul dir c:\ /s >nul netstat -an |find "192.168.1.200:80" If I keep the sleep in I get an error message but when removed it seems to work. The reason for the sleep is to make sure the import is complete before it runs the .bat file. Any suggestions on the best way to achieve this? Thanks Link to comment Share on other sites More sharing options...
Derak Posted October 31, 2008 Share Posted October 31, 2008 Have you tried WinWait() ? It pauses your script until the specified window is opened. [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent] Link to comment Share on other sites More sharing options...
Danny35d Posted October 31, 2008 Share Posted October 31, 2008 The reason for the sleep is to make sure the import is complete before it runs the .bat file.In that case change Run() function for RunWait(). AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
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