In 2005, TechRepublic
asked members to submit their favorite Network Administration scripts for possible publication. One of the first to make
a submission was Tina Shields.
Tina Shields’ script in her own words
I am a
network admin, and have been using SUS and then WSUS to keep my 50+ servers up
to date on Windows patches for the past few years. The desktop group used
Service Pack Manager for workstations, but it required too much management. So,
I assumed responsibility of updating 600+ workstations. I ran into some issues
with XP machines not having correct security identifiers for the Automatic
Updates and Background Intelligent Transfer Services (BITS), and old BITS jobs
from the previous version stuck in the queue. I wrote this script to
“clean up AU.” It works like a charm.
Table A
‘================================================================
‘ SCRIPT NAME: cleanau.vbs
‘ AUTHOR: TDShields,
‘ DATE: 8/18/2005
‘ COMMENT: To remove old BITS jobs
‘================================================================
Option Explicit
on error resume next
dim oAU, oBITS, oComputer
dim oCommand, oFSO, oShell
do while lcase(oComputer) <> “quit”
‘ gather input
oComputer = InputBox(“Enter the workstation’s name, or type quit to exit”)
‘ stop services
set oFSO = CreateObject(“Scripting.FileSystemObject”)
set oBITS = GetObject(“WinNT://” & oComputer & “/BITS”)
oBITS.stop
set oAU = GetObject(“WinNT://” & oComputer & “/wuauserv”)
oAU.stop
‘ delete old jobs
set oFSO = CreateObject(“Scripting,Filesystemobject”)
oFso.DeleteFile(“\\” & oComputer & “\c$\Documents and Settings\All Users\application data\microsoft\network\downloader\*.*” & chr(34)), DeleteReadOnly
‘ set security descriptors on services
Set oShell = CreateObject(“WScript.shell”)
oCommand = “sc \\” & oComputer & ” sdset bits ” & chr(34) &”D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)
(A;;CCLCSWLOCRRC;;;AU)
(A;;CCLCSWRPWPDTLOCRRC;;;PU)” & chr(34)
oShell.RunoCommand
oCommand = “sc \\” & oComputer & ” sdsetwuauserv ” & chr(34) & “D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)
(A;;CCLCSWLOCRRC;;;AU)
(A;;CCLCSWRPWPDTLOCRRC;;;PU)” & chr(34)
oShell.RunoCommand
‘ start services
oBITS.start
oAU.start
loop