Wednesday, May 24, 2006

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----

Tuesday, May 2, 2006

VBScript to Set SMS Client Cache Size

Simple VBScript for setting the client cache size.

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

' Declare Variables
Dim checkCacheValue
Dim setCacheValue

' Set the Cache Size to check for (less than or equal to)
checkCacheValue = 1024

' If less than or equal to the checkCacheValue
' set the Cache Size to this
setCacheValue= 1024

Dim oUIResourceMgr
Dim oCache

Set oUIResourceMgr = CreateObject("UIResource.UIResourceMgr")
Set oCacheInfo = oUIResourceMgr.GetCacheInfo

' Set it if it's less than or equal to checkCacheValue
if oCacheInfo.TotalSize <= checkCacheValue then
oCacheInfo.TotalSize = setCacheValue
end if

'Return the error so SMS can report it
WScript.Quit(Err)
----End VBScript----

An SMS package doesn't appear on a lower level DP, what do you do?

A few things to try...

  • Make sure you've selected the DP to receive the package
  • Check the status messages (SMS_DISTRIBUTION_MANAGER is one component to check)
  • Check the logs on the SITE server (sms\logs\distmgr.log)