Showing posts with label BITS. Show all posts
Showing posts with label BITS. Show all posts

Thursday, October 23, 2008

Upgrade BITS

As companies move from SMS 2003 to SCCM one of the items frequently mentioned is the desire to predeploy the latest version of BITS (Background Intelligent Transfer Service).  This makes it possible to deploy the client without requiring a reboot.  However, Microsoft didn't really provide a method for doing the BITS deployment.  So I wrote my own.  Download the latest versions of BITS from: 2000, XP, 2003, x64- XP and 2003

They will need to be in a subdirectory named bin of this script.  The script will require a drive letter to run, so when you create the program be sure to specify that option.  The nice thing about this script is that you can deploy to everybody, and it will only upgrade those that need it.

'==========================================================================
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.0
'
' NAME: Install_Bits.vbs
' AUTHOR: Bill Phillips , ESRI
' DATE : 10/22/2008
'
' COMMENT:
'==========================================================================
On Error Resume Next
Dim strOSName, strSPName, strComputerType, systemroot, detectfile
Dim objFile, strFileVersion, strInstallFile


Set objShell = CreateObject ("Wscript.Shell")
set objEnv = objShell.Environment("Process")
systemroot = objEnv("SYSTEMROOT")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExp = new regexp 'Create the RegExp object


detectOS()
detectFileversion(systemroot & "\system32\QMgr.dll")
compareBITSVersion(strFileVersion)
installBITS()

' ********************************************************************************
'Detect OS Function
'********************************************************************************
Function detectOS()
For Each objOS In GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
strOSName = objOS.Caption
strSPName = "SP" & objOS.ServicePackMajorVersion
Next

For Each objComputer In GetObject("winmgmts:").InstancesOf ("Win32_ComputerSystem")
strComputerType = objComputer.systemtype
Next

'need to normalize data (too many different versions of windows)
objExp.Pattern = "2000"
If objEXP.Test (strOSName) Then
strOSName = "win2k"
End If

objExp.Pattern = "XP"
If objEXP.Test (strOSName) Then
strOSName = "winXP"
End If

objExp.Pattern = "2003"
If objEXP.Test (strOSName) Then
strOSName = "w2k3"
End If

objExp.Pattern = "Vista"
If objEXP.Test (strOSName) Then
strOSName = "Vista"
End If

objExp.Pattern = "2008"
If objEXP.Test (strOSName) Then
strOSName = "w2k8"
End If
End Function

Function detectFileversion(detectfile)
If objFSO.FileExists(detectfile) Then
Set objFile = objFSO.GetFile(detectfile)
strFileVersion = objFSO.GetFileVersion(detectfile)
End If

End Function

Function compareBITSVersion(strFileVersion)
Select Case strFileVersion
' Case for Windows 2000 Server and Pro
Case "6.6.2600.1596"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Windows XP SP2
'Case "6.7.2600.3143"
Case "Fake"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Windows XP SP3
Case "6.7.2600.5512"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Server 2003 SP1
Case "6.6.3790.1830"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Server 2003 SP2
Case "6.6.3790.3959"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Vista RTM
Case "7.0.6000.16386"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1

' Case for Vista and Server 2008 SP1 x32 & x64
'Case "7.0.6001.18000"
Case "fake"
'wscript.echo "BitsVersion Passed"
WScript.quit
WScript.Sleep 1
' Case for failure
Case Else
'WScript.Echo "Bits Failed"
selectBITSinstall()
End Select
End Function

Function selectBITSinstall()
Select Case strComputerType
Case "x64-based PC"
Select Case strOSName
Case "w2k3"
strInstallFile = "WindowsServer2003.WindowsXP-KB923845-x64-ENU.exe"
Case "winXP"
strInstallFile = "WindowsServer2003.WindowsXP-KB923845-x64-ENU.exe"
End Select
Case "X86-based PC"
Select Case strOSName
Case "win2k"
strInstallFile = "Windows2000-KB842773-x86-ENU.exe"
Case "winXP"
strInstallFile = "WindowsXP-KB923845-x86-ENU.exe"
Case "w2k3"
strInstallFile = "WindowsServer2003-KB923845-x86-ENU.exe"
End Select
End Select

' no match found so quitting
If strInstallFile = "" Then
WScript.Quit
End If

End Function

Function installBITS()
'Turn off prompt for unknown locations
objEnv("SEE_MASK_NOZONECHECKS") = 1


objShell.Run ("bin\" & strInstallFile & " /passive /norestart /overwriteoem")', 1, True

'Turn prompt back On
objEnv.Remove("SEE_MASK_NOZONECHECKS")
End Function

Thursday, February 8, 2007

BITS Bites me

So we are trying to push out the client to a couple of our Regional Offices (RO’s). Our preferred method (meaning method used by the old admin) is to use the free client health tool by 1E. http://www.1e.com/Downloads/FreeTools/index.aspx

The advantage of this tool is that it is a startup script that checks to see if SMS is working properly. If it isn’t working properly (or isn’t installed), then it re-installs it. It works better than the built in client push method since you can control who gets the startup script via group policy. It also will email the designated admin if it can’t install properly and give you a reason.

Lucky for me, my email box received 20 emails today about out of date BITS (Background Intelligent Transfer Service). SMS can’t download and run a package if BITS doesn’t work properly. According to Microsoft, the most current version of BITS is 3.0 (http://www.1e.com/Downloads/FreeTools/index.aspx)

Now if only there was a place to download BITS 3.0 for distribution... Best I could find was BITS 2.0 here: http://www.microsoft.com/downloads/details.aspx?familyid=B93356B1-BA43-480F-983D-EB19368F9047&displaylang=en

If anybody knows more info, please let me know.