次の方法で共有


Configuration Manager Powershell: Changing Package Source Location Part 2

Hello Everyone!

This is a follow up to a blog I posted previously, Changing Package Source Location

I was recently on-site with another customer that was migrating from an existing Configuration Manager 2012 environment to a new Configuration Manager 2012 R2 environment.  We needed to move their source files and update source locations not just for Packages this time, but for Applications, Drivers, and Driver Packages. 

This post will focus on the commands that I used (similar to the previous blog) to change the source path for the Drivers and Driver Packages. 

Like in the previous post, we will need to start by accessing the Configuration Manager PowerShell provider

Now, like before, we want to export the current data to a CSV file so when can manipulate it

For Drivers:

Get-CMDriver | select LocalizedDisplayName, ContentSourcePath, CI_ID | Export-Csv $home\documents\Drivers.csv

For Driver Packages:

Get-CMDriverPackage | select Name, PkgSourcePath, PackageID | Export-Csv $home\documents\DriverPackages.csv

Now you can open the CSV files with notepad (or any other CSV editor) and do a find/replace for your source path \\server\share\

Once you have updated both of your CSV files, its time to import them.

For Drivers:

Import-Csv $home\documents\drivers.csv | %{Set-CMDriver -Id $_.CI_ID -DriverSource $_.ContentSourcePath}

For Driver Packages:

Import-Csv $home\Documents\DriverPackages.csv | %{Set-CMDriverPackage -Id $_.PackageID -DriverPackageSource $_.PkgSourcePath}

And your done!  Good Luck!

Comments

  • Anonymous
    January 30, 2017
    Does this script require that I be on a specific server to run? I got the export to csv fine. Changed the locations, saved the CSV file and then ran the Import-Csv on both files, the one for drivers took quite a while to return to the command prompt but the paths to the drivers when I close and open the console still show the old locations. I am running this on 1610, did that change things?Thank you!
  • Anonymous
    January 30, 2017
    Update, after a brain cramp I figured out the issue. I had to move the CSV files through one drive to my computer and on the copy back to the server I ended up with the old files. This worked Great. Next Question, why isn't this part of the migration wizards in SCCM now?Thank you! Answered
    • Anonymous
      February 16, 2017
      The comment has been removed
  • Anonymous
    August 24, 2017
    This worked great. Thanks! Be aware that it took about 20-30mins to complete when working with a list of 1200 drivers so no need to worry.