Introduction
I am a great fan of the program “pimp my ride”. This is a TV program where the producers take an old car and upgrade/rebuild it to a luxury standard car with a few “extras”.
Now you may ask what does this have to do with SMS 2003 to SCCM agent migration?
The answer is, this is similar in my view to what you do when you perform an in-place upgrade on the agent.
In this article I explain and expand on an approach and process to get a new luxury agent without using the “pimp my ride” approach (a.k.a in-place upgrade). NB I know on good authority that a lot of work was put into the in-place upgrade and it works. This is just an approach that looks at the alternative method of addressing the same task. We also build on the software distribution approach to the agent upgrade.
The prescribed approach is based on the notion that why upgrade your old car with parts from a new car, when you can scrape the old one and just use the new one as is?
Background
In this process we assume you already have an SMS 2003 infrastructure with SMS 2003 agents deployed. We also assume you have a new installation of an SCCM site. The process focuses on using software distribution to upgrade the SMS 2003 agent to an SCCM agent in a side by side migration scenario.
Summary of process
- Create a source folder for the upgrade files
- Create a software distribution package to copy the source files to a local directory on all clients
- Create a software distribution advertisement which initiates the upgrade process
- The upgrade process cleanly removes the old agent including the certificates, then initiates a new installation of the SCCM agent. The agent is also assigned to the new SCCM site in the process.
Detailed steps
Required Software and Utilities:
- Client installation files from the SCCM site (to reduce size remove non required language files from the pre-requisite files) –%SiteServerName%SMS_%sitecode%Client
- The following from the SMS2003 Toolkit – ccmclean.exe and delcert.exe
- Custom batch file to uninstall SMS2003 (includes old cert deletion) and install SCCM client – (See sample script)
SCCM Site prerequisites:
- Create site boundaries – subnets recommended
- Set site to manual approval of clients
- Set site to only accept SCCM clients
SMS2003 Site prerequisites:
- Create Copy Source Package and Program
- Create a package source folder (e.g., SMS-SCCM-Migrate) with a subfolder called sources
- Copy the required upgrade files to the sources subfolder (including CCCMClean and Delcert) and place the script in the root folder
- Program command line %systemroot%system32cscript.exe copySources.vbs – CopySources.vbs is a custom script written by Joe Erskine
See end of article for Script
You need to modify the parameters in the batch file (e.g., your MP FQDN etc)
- The migration process does not return a program successfully run under the SMS2003 site. Confirmation of success is when the client reports into the SCCM site for approval.
- Use the fallback status point reports to track status of installation.
This approach has an additional benefit in that your agent health can be validated by the initial software distribution to copy the source file to the client.
Copy Sources:
‘==========================================================================
‘
‘ VBScript Source File
‘
‘ NAME: copySources.vbs
‘
‘ AUTHOR: Joe Erskine
‘
‘
‘ DATE: 18/07/2006
‘
‘ VERSION: 1.0
‘
‘ COMMENT: SMS script to copy sources files. Set path for destination in strTargetPath and place
‘ fiels/folders to be copied to location in a sub-folder called SOURCE in the package source directory
‘ E.g. If package source is C:Test, place this script in C:Test and files/folders to transfer in C:TestSource
‘
‘ USAGE: cscript copySources.vbs
‘
‘==============
‘Version Control
‘===============
‘
‘Ver #:
‘Modified By:
‘Date Modified:
‘Details:
‘===================
‘End Version Control
‘===================
‘==========================================================================
Option Explicit
On Error Resume Next
‘======================
‘User Defined Variables
‘======================
Dim strTargetPath ‘<- Path to copy files/folders to, Created if it doesn’t exist
Dim strWinDir ‘<- Windows Installation Directory
‘Get the Windows Installation Directory path
strWinDir = fGetWindowsDirectory()
‘<- If you need to copy to Windows directory then use:
‘ strTargetPath = strWindir & “Your Path Here”
‘ E.g. strTargetPath = strWindir & “System32MyFiles”
strTargetPath = “C:InstallSMS-SCCM-Migrate”
‘==============
‘Global Objects
‘==============
Dim objFS
Dim objItem
Dim objFolder
Dim objShell
Dim objNetwork
Dim colItems
Dim strScriptPath
Dim strCacheRoot
Dim strSource
Dim intError : intError = 0
Dim strComment
Const FOR_READING = 1
Const FOR_WRITING = 2
Const FOR_APPENDING = 8
Const CMD_MINIMIZED = 2
Const CMD_WAIT = True
Const OVERWRITE_EXISTING = True
‘=====
‘START
‘=====
strScriptPath = Left(WScript.ScriptFullName,_
Len(WScript.ScriptFullName) – Len(WScript.ScriptName))
strSource = strScriptPath & “Source”
strCacheRoot = Left(strScriptPath,(Len(strScriptPath)) – 1)
strComment = “SMS Source Files Transfer Script” & vbNewLine
strComment = strComment _
& “************************************************************” & vbNewLine
strComment = strComment & “Start Time:” & vbTab & Now & vbNewLine
strComment = strComment & “Source Folder:” & vbTab & strSource & vbNewLine
strComment = strComment & “Target Folder:” & vbTab & strTargetPath & vbNewLine
strComment = strComment _
& “************************************************************” & vbNewLine
Set objFS = CreateObject(“Scripting.FileSystemObject”)
Set objShell = CreateObject(“WScript.Shell”)
Set objNetwork = CreateObject(“WScript.Network”)
If objFs.FileExists(WScript.ScriptFullName) Then objFs.DeleteFile(WScript.ScriptFullName)
WScript.Echo strScriptPath
WScript.Echo strCacheRoot
If Len(strTargetPath) > 0 Then
If objFS.FolderExists(strTargetPath) Then
Else
‘Target folder doesn’t exists so create it
strComment = strComment & “Creating Folder:” & vbTab & strTargetPath & vbNewLine
objShell.Run “%comspec% /c MD ” & “””” & strTargetPath & “”””,CMD_MINIMIZED,CMD_WAIT
WScript.Sleep 2000
If Not objFS.FolderExists(strTargetPath) Then
intError = intError + 1
strComment = strComment & “ERROR: Unable to create target folder -> ” & strTargetPath & vbNewLine
End If
End If
If intError = 0 Then
If Right(strTargetPath,1) = “” Then
Else
strTargetPath = strTargetPath & “”
End If
Set objFolder = objFS.GetFolder(strSource)
For Each objItem In objFolder.Files
If objFS.FileExists(strTargetPath & “” & objItem.Name) Then
strComment = strComment & “ERROR: Target file already exists -> ” _
& strTargetPath & “” & objItem.Name & vbNewLine
strComment = strComment & vbTab & “- Skipping move operation” & vbNewLine
Else
strComment = strComment & “Moving -> ” _
& objItem.Path & vbNewLine
WScript.Echo objItem.Path
Err.Clear
objFS.MoveFile objItem.Path,strTargetPath
If Err <> 0 Then
strComment = strComment & vbTab _
& ” – ERROR: ” & Err.Number & Err.Descripton & vbNewLine
intError = intError + 1
End If
End If
Next
For Each objItem In objFolder.SubFolders
If objFS.FolderExists(strTargetPath & “” & objItem.Name) Then
strComment = strComment & “ERROR: Target folder already exists -> ” _
& strTargetPath & “” & objItem.Name & vbNewLine
strComment = strComment & vbTab & “- Deleting target folder” & vbNewLine
objFS.DeleteFolder(strTargetPath & “” & objItem.Name)
Else
strComment = strComment & “Moving -> ” _
& objItem.Path & vbNewLine
WScript.Echo objItem.Path
Err.Clear
objFS.MoveFolder objItem.Path,strTargetPath
If Err <> 0 Then
strComment = strComment & vbTab _
& ” – ERROR: ” & Err.Number & Err.Descripton & vbNewLine
intError = intError + 1
End If
End If
Next
Set objFolder = Nothing
Else
intError = intError + 1
End If
Else
strComment = strComment & “ERROR:” & vbTab _
& “No Target path specified” & vbNewLine
End If
strComment = strComment _
& “************************************************************” & vbNewLine
strComment = strComment & “Exit Code:” & vbTab & intError & vbNewLine
strComment = strComment & “************************************************************”
Call fLogEvent(strComment)
Set objShell = Nothing
Set objFS = Nothing
Set objNetwork = Nothing
WScript.Quit(intError)
‘===
‘END
‘===
‘==========
‘Functions
‘=========
‘******************************************************************************
‘* Name: fLogEvent(strventInfo)
‘* Function: Write Script run time log to the Application Event Log
‘******************************************************************************
Function fLogEvent(strEventInfo)
objShell.LogEvent 4,strEventInfo,”” & objNetwork.ComputerName
End Function
‘******************************************************************************
‘* Name: fGetWindowsDirectory()
‘* Function: Returns a string with the Windows Installation directory
‘******************************************************************************
Function fGetWindowsDirectory()
Dim colItems
Dim objItem
Dim objWMIService
Dim strValue
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!.rootcimv2”)
Set colItems = objWMIService.ExecQuery(“Select * From Win32_OperatingSystem”)
For Each objItem in colItems
strValue = objItem.WindowsDirectory
Next
Set objWMIService = Nothing
fGetWindowsDirectory = strValue
End Function