Eman Posted December 7, 2004 Share Posted December 7, 2004 Hello,I've recently installed the latest beta for Windows Update Services (along with BITS 2.0) onto a Windows 2003 machine. I then went to 3 different client machines to configure them to point to the new WUS server according to Step 5 in the WUS "Step by Step Guide to Getting Started". One of the clients has XP sp2, one has 2003, and one has 2000 sp4 on it. After I made the gpedit.msc changes, the XP machine showed up in the WUS Admin interface (the web-based one) under "Computers". So that was good.However, the 2003 and 2000 machines did not, and I can't figure out why. I've rebooted them, double-checked the gpedit settings, etc. But to no avail.All 3 clients sit in the same room, under the same network configuration - so all 3 have access to the WUS server. All 3 clients use the same logins, all with Admin priveliges on them.Does anyone have any suggestions? I realize this is a new product (beta still), but hopefully I can find someone here to help.Thanks! Link to comment Share on other sites More sharing options...
BeenThereB4 Posted December 7, 2004 Share Posted December 7, 2004 I worked on this for a while before I went back to SUS as WUS was too buggy for me. Anyway, this script (which I modified for WUS) worked to get Win2000 machines (SP4) working. Try it.'This script will do the following; 'Backup the Windows Update server settings already on the system. 'Set the system to point to the Internal setup server and reset last run states. 'check to see if the BITS speed control is enabled on the system and ask if want it disabled during update. 'Restart the Update service so that it will perform an update. 'Wait for the update to begin. 'reset the settings back to what they were before the script was launched.'Written by Rick J. Jones'Versioning 'V1 10/21/2003 First Version 'V2 10/21/2003 Fixed error handle in FileLastModified Function and removed un-needed functions 'V3 10/27/2004 Added BITS speed governor override abilityOption Explicitconst ScriptVer = "SUS Update Now V3"Public arrNewRegistrySettings'The 2 entries of "http://yourserver.address.com" needs to be adjusted to your server's address in the following sectionarrNewRegistrySettings = Array ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUServer", "http://win2003", "REG_SZ", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUStatusServer", "http://win2003","REG_SZ", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoUpdate", 0, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\AUOptions", 4, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\ScheduledInstallDay", 0, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\ScheduledInstallTime", 2, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\UseWUServer", 1, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\RescheduleWaitTime", 1, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoRebootWithLoggedOnUsers", 0, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUState", 2, "REG_DWORD", "",_ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions", 4, "REG_DWORD", "")_ MainSub Main Dim LastUpdated, CurrentUpdate, DoneMessage, Limiter, TurnOffLimiter 'check to see if the script has not been altered to point to a different server if arrNewRegistrySettings(1) = "http://yourserver.address.com" or arrNewRegistrySettings(5) = "http://yourserver.address.com" then DoneMessage = MsgboxWithTimeout ("You need to modify the script to point to your internal SUS server!" & vbcrlf & "Exiting script in 40 seconds.", 40, ScriptVer & " - Script Alteration Needed",0) wscript.quit end if 'Check for Local Administrative rights, it is NEEDED for this script! if ComputerLocalGroupAdministrativeRights() = False Then DoneMessage = MsgboxWithTimeout ("This account does not have Local Administrative rights, exiting script",30,ScriptVer & " - Need Local Admin Rights",0) exit sub end if 'check to see if Bandwidth Limiter turned on Limiter = ComputerRegistryRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\BITS\EnableBITSMaxBandwidth") if Limiter = 1 then TurnOffLimiter = msgbox ("This machine has a Bandwidth Limit enabled for BITS, do you want to disable it?",vbYesNo , ScriptVer & " - Disable BITS speed limit?") 'check the response to see if going to disable limitor if TurnOffLimiter=vbYes then 'set limitor as disabled ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\BITS\EnableBITSMaxBandwidth",0,"REG_DWORD" 'Stop Bits service Run "Net Stop bits", True end if end if 'Stop the Windows Update Service Run "Net Stop wuauserv", True 'Update the registry with all the edits in the array above (I could not add to array) UpdateRegistry(True) 'Reset this date to any past due date ComputerRegistryWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallDate", "2004-11-11 01:00:00", "REG_SZ" 'Enable Minor Updates ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\AutoInstallMinorUpdate", "1", "REG_DWORD" 'Enable Reboot ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootRelaunchTimeoutEnabled", "1", "REG_DWORD" 'Minimize Reboot Time ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootWarningTimeout", "1", "REG_DWORD" 'Delete the Last Update registry entry ComputerRegistryDelete ("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\LastWaitTimeout") 'Pause for 5 seconds wscript.sleep 5000 'get the Item.xml file last modified date/time since that contains the catalog of approved updates on the server at last update 'LastUpdated = FileLastModified ("C:\Program Files\WindowsUpdate\item.xml") 'Restart the Windows Update Service Run "Net start bits", True Run "Net start wuauserv", True DoneMessage = MsgboxWithTimeout ("System will now pull the update patches in 5 minutes.",10,ScriptVer & " - SUS Updates Set",0) 'Pause for 20 Minutes wscript.sleep 1200000 'Stop the Windows Update Service Run "Net Stop wuauserv", True 'Update the registry again UpdateRegistry(True) 'Reset this date to any past due date ComputerRegistryWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallDate", "2004-11-11 01:00:00", "REG_SZ" 'Enable Reboot ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootRelaunchTimeoutEnabled", "1", "REG_DWORD" 'Minimize Reboot Time ComputerRegistryWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootWarningTimeout", "1", "REG_DWORD" 'Restart the Windows Update Service Run "Net start wuauserv", True'end of mainend SubSub UpdateRegistry(BoolBackup) Dim RegInstance, RegistryWriteError, RegistryReadData, LogData 'Load the registry up with new settings if it is set for RegInstance = lbound(arrNewRegistrySettings) to ubound(arrNewRegistrySettings) step 4 if BoolBackup = True then 'This is in Backup Mode 'read the registry current setting RegistryReadData = ComputerRegistryRead (arrNewRegistrySettings(RegInstance)) 'if they don't match, then update it with the new settings if RegistryReadData <> arrNewRegistrySettings(RegInstance + 1) then RegistryWriteError = ComputerRegistryWrite (arrNewRegistrySettings(RegInstance), arrNewRegistrySettings(RegInstance + 1 ), arrNewRegistrySettings(RegInstance + 2) ) 'update the tracking of what was changed arrNewRegistrySettings(RegInstance+3) = RegistryReadData end if else 'This is in Restore Mode 'read the registry current setting RegistryReadData = ComputerRegistryRead (arrNewRegistrySettings(RegInstance)) 'if they don't match, then update it with the Backed-up settings if RegistryReadData <> arrNewRegistrySettings(RegInstance + 3) then RegistryWriteError = ComputerRegistryWrite (arrNewRegistrySettings(RegInstance), arrNewRegistrySettings(RegInstance + 1 ), arrNewRegistrySettings(RegInstance + 3) ) end if end if nextEnd SubSub FileDelete(filespec) 'Function 'Input 'Output 'Revisions Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") on error resume next objFSO.DeleteFile(filespec) on error goto 0End SubFunction FileLastModified(filespec) 'Function 'Input 'Output 'Revisions on error resume next Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(filespec) FileLastModified = f.DateLastModifiedEnd FunctionSub Run(strApp, boolWait) 'Function 'Run a program hidden 'Input 'strApp = Application to run 'BoolWait = True/False if the program should wait for the return. 'Revisions 'Original version created by Rick J. Jones Dim WSHShell, COMSPEC, WSHEnvironment Set WSHShell = CreateObject("WScript.Shell") Set WSHEnvironment = WSHShell.Environment("Process") COMSPEC = WshEnvironment("COMSPEC") on error resume next wshShell.Run COMSPEC & " /C " & strApp,0,boolWait on error goto 0end subFunction MsgboxWithTimeout( Message, seconds, Title, Buttons ) 'intButton = object.Popup(strText,nSecondsToWait,Title,Buttons) 'Button Types 'Value Description '0 Show OK button. '1 Show OK and Cancel buttons. '2 Show Abort, Retry, and Ignore buttons. '3 Show Yes, No, and Cancel buttons. '4 Show Yes and No buttons. '5 Show Retry and Cancel buttons. 'Icon Types 'Value Description '16 Show "Stop Mark" icon. '32 Show "Question Mark" icon. '48 Show "Exclamation Mark" icon. '64 Show "Information Mark" icon. '4096 System modal. On Win16 systems, all applications are suspended until 'the user responds to the message box. On Win32 systems, this constant 'provides an application modal message box that always remains on top 'of any other programs you may have running. 'The return value denotes the number of the button that the user clicked. 'If the user does not click a button before nSecondsToWait seconds, return is set to -1. 'Value Description '1 OK button '2 Cancel button '3 Abort button '4 Retry button '5 Ignore button '6 Yes button '7 No button on error resume next Dim WshShell set WshShell = CreateObject("WScript.Shell") 'Display the popup message with timeout MsgboxWithTimeout = WshShell.Popup (Message, seconds, Title, Buttons)End FunctionFunction ComputerLocalGroupAdministrativeRights 'Function 'This function will return true/false if the user 'context running the script is an administrator or not 'Output 'True = User is an administrator on the system 'False = User is NOT an administrator on the system 'Revision History '8/27/2003 First version by Rick J. Jones AT&T Desktop Engineering '9/29/2003 Added Registry attempt for NT systems that don't have the ADCE client installed. Dim WSHNetwork, objUser, ComputerName, WSHShell 'Turn off error trapping On Error Resume Next Set WSHShell = CreateObject("WScript.Shell") Set WSHNetwork = CreateObject("WScript.Network") 'Get computer name ComputerName = WshNetwork.ComputerName 'connect to the local administrator user account Set objUser = GetObject("WinNT://" & ComputerName & "/Administrator,user") 'NT4 without the ADCE loaded will return the following error if err.number = -2147221020 then 'Attempt Registry Write to a section that only an administrator should have access too WSHShell.Regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AdminTest", "AdminTest", "REG_SZ" 'Read the data back out RegData = WSHShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AdminTest") 'check its contents if RegData = "AdminTest" then 'the registry contains the data it should so this is success, delete the test area WSHShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AdminTest" 'return positive results ComputerLocalGroupAdministrativeRights = True exit function else 'Data did not successfully populate, return negaive results ComputerLocalGroupAdministrativeRights = False exit function end if end if 'Get all properties from the account objUser.GetInfo 'attempt to set the properties back to the account objUser.SetInfo 'If the user is in the local administrators group then there will be no error If Err.Number = 0 Then 'successful update ComputerLocalGroupAdministrativeRights = True else 'error encountered attempting update ComputerLocalGroupAdministrativeRights = False End IfEnd FunctionFunction ComputerRegistryRead (Key) 'Function: 'Read from the registry and return the contents of the key 'Input: 'Fully Qualified Key with the Name 'return: 'Data within the Key if present Dim WSHShell Set WSHShell = CreateObject("WScript.Shell") on error resume next ComputerRegistryRead = WSHShell.RegRead(Key)End FunctionFunction ComputerRegistryWrite (Key, Value, KeyType) 'Function 'Write data to the registry 'Input 'Key = the registry key 'shortcut abbreviations can be used 'Valid types are; 'HKCU = HKEY_CURRENT_USER 'KHLM = HKEY_LOCAL_MACHINE 'HKCR = KHEY_CLASSES_ROOT 'Value = the value to place in the key 'strings must be in quotes 'KeyType = the type of key. 'Valid key types are; '"REG_SZ" = String '"REG_EXPAND_SZ" = String with macros ' = Variant array of strings is not supported '"REG_DWORD" = Long integer '"REG_BINARY" = Variant arry of bytes 'Output 'returns an array of the error and description 'ComputerRegistryWrite(0) = the error number 'ComputerRegistryWrite(1) = the description 'Revisions '9/8/2003 Rick J. Jones Added comments and function return of error in an array Dim WSHShell Set WSHShell = CreateObject("WScript.Shell") on error resume next WSHShell.Regwrite Key, Value, KeyType 'return any errors ComputerRegistryWrite = array( err.number, err.Description )End FunctionSub ComputerRegistryDelete (Key) 'Function 'Deletes a registry entry 'Input 'Fully qualified key to be deleted Dim WSHShell Set WSHShell = CreateObject("WScript.Shell") on error resume next WSHShell.RegDelete KeyEnd Sub'******************************************************************************Sub RebootConst FORCED_REBOOT = 6Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," & _ "(Shutdown)}!\\" & g_strComputer & "\root\cimv2")Set colOSes = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")objTextStream.WriteLine "Attempting to reboot ..."CopyLogFor Each objOS In colOSes 'Only one objOS in collection intReturn = objOS.Win32Shutdown(FORCED_REBOOT) If intReturn <> 0 Then Set objTextStream = objFSO.OpenTextFile(g_strLogFile, FOR_APPENDING, True) objTextStream.WriteLine Now objTextStream.WriteLine "Error: Unable to reboot. " & VbCrLf & _ "Return code: " & intReturn CopyLog End IfNextEnd Sub'****************************************************************************** Link to comment Share on other sites More sharing options...
Eman Posted December 7, 2004 Author Share Posted December 7, 2004 Wow, thanks for the code - I might give that a shot on my 2000 machine. I assume you run this on the client? (Or run on the WUS server?)Not encouraging to hear WUS as buggy though.I'm mystified why my 2003 client did not show up either. I guess I can understand 2000, since it's older, but since WUS was kinda built for 2003, it seems that it would support that client easily.Question: is BITS required on the client machines as well? I only installed it on the server. Link to comment Share on other sites More sharing options...
BeenThereB4 Posted December 8, 2004 Share Posted December 8, 2004 (edited) Run it on the 2000 client. The first thing that will happen is BITs will get upgraded to the 2.0 beta. After a reboot, the rest of the updates will install. Don't forget to change the two places to refer to your server where it now says "win2003". Edited December 8, 2004 by BeenThereB4 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