ConfigMgr migration script – Driver source path conversion

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 https://t3chn1ck.wordpress.com
# 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
   }
}

5 thoughts on “ConfigMgr migration script – Driver source path conversion

Add yours

  1. Hi Nick,

    thanks a lot for your script.
    I’ve been looking for days now how to change the SourcePath of my Drivers at my SCCM.
    I thought that your script will do my task but unfortunatly I only get the “Not changed” case. The script can access the drivers but it don’t change the SourcePath.
    Do you have an idea what I made wrong or what I can do to make it working?
    I would be really happy if you could help me or give me an direction.

    Best regards

    Michael

    1. I’m glad that this content is still useful 7 years later!! I’m uncertain if there were some underlying PowerShell code changes from SCCM 2012 R2 to the newer ConfigMgr current branch which might impact this. If you find the answer, I’m sure that others would like to know the solution for future use!

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑