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


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

    Michael Wolf said:
    August 11, 2021 at 3:20 am

    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


      N. Moseley responded:
      August 14, 2021 at 6:54 am

      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 Reply

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

You are commenting using your 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