ConfigMgr migration script – Driver source path conversion

Posted on Updated on

Use the following PowerShell script to convert driver files’ source path from an old server location to the new location.

Updated 5/5/14: fixed creation of $ChangePath variable to account for mixed-case of the $OldPath and $NewPath.

# By
# Version 1.1

# Site Code + :
Set-Location "GAL:"

# Note: max query limit is 1000 items, need to increase value as appropriate
Set-CMQueryResultMaximum 2000

$DriverArray = Get-CMDriver
$OldPath = "\\2007SERVER\source$"
$NewPath = "\\2012SERVER\cmsource$"

ForEach ($Driver in $DriverArray){
   $OldPkgPath = $Driver.ContentSourcePath.ToLower()

   If ($OldPkgPath.StartsWith($OldPath)){
      $ChangePath = $OldPkgPath.Replace($OldPath.ToLower(), $NewPath.ToUpper())

      Set-CMDriver -Id $Driver.CI_ID -DriverSource $ChangePath
      Write-Host "Changed: " $Driver.CI_ID " to " $ChangePath -f Green
   } Else {
      Write-Host "Not changed: " $Driver.CI_ID " of " $OldPkgPath -f DarkYellow


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s