VBScript to enable BITS

Sometimes people like to turn off BITS as a security lockdown. When that happens SMS can have issues. Here's a quick and dirty script sample to do the job.

----Begin VBScript----
On Error Resume Next

For i = 1 to 30
If Len(i) = 1 then number = "0" & i
If Len(i) = 2 then number = i

computerName = "name of your computer"

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
WScript.Echo computerName & " " & Err

If Err = 0 Then

Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'BITS'")

If Err = 0 Then


WScript.Echo computerName & vbCrLf

For Each objService in colServiceList
errReturnCode = objService.Change( , , , , "Automatic")
WScript.Echo vbTab & "Changed " & objService.Name & " to automatic"
objService.StartService()
Next
End If

Set colServiceList = nothing


End If

Set objWMIService = nothing

Next
----End VBScript----

Comments

Popular posts from this blog

SMS "Program failed (run time exceeded)" 10070

SMS "Waiting for User Condition" 10036

SMS "Waiting for content" 10035