Looks like you need to import the CM module first. Should be in the console 
directory in program files if I remember correctly.
Daniel Ratliff

-----Original Message-----
From: Marcum, John [[email protected]<mailto:[email protected]>]
Sent: Monday, July 15, 2013 07:56 PM Eastern Standard Time
To: SMS List ([email protected])
Subject: [mssms] Matts ConfigMgr 2012 SP1 Package Source Modifier

Has anyone used these scripts before? In the old and new paths should I enter 
the trailing backslashes?

http://blogs.technet.com/b/configmgrdogs/archive/2013/05/09/package-amp-application-source-modification-scripts.aspx

On the package script I get an error when I run it. I am running the script 
directly on the primary site server. When prompted I enter my site code which 
is ‘PS1’

Here’s the script as I edited it. (Of course I removed the server name for 
privacy)

$SiteCode=Read-Host"Enter your ConfigMgr Site code (XXX)"
 $SiteCode=$SiteCode+":"
 Set-Location$SiteCode
$PackageArray= Get-CMPackage
 $OldPath="\\OMYOLDSERVERNAME\packages$\"
 $NewPath="\\MYNEWSERVERNAME\index\NSV\PackageSource\"
ForEach ($Packagein$PackageArray)
 {
 $ChangePath=$Package.PkgSourcePath.Replace($OldPath, $NewPath)
 Set-CMPackage -Name $Package.Name -Path $ChangePath
 Write-Host$Package.Name " has been changed to "$ChangePath
 }


Here’s the error I get:

Set-Location : Cannot find drive. A drive with the name 'PS1' does not exist.
At C:\Users\myusername\Desktop\Change_Package_Source.ps1:14 char:2
+  Set-Location $SiteCode
+  ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (PS1:String) [Set-Location], 
DriveNotFoundException
    + FullyQualifiedErrorId : 
DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Get-CMPackage : The term 'Get-CMPackage' is not recognized as the name of a 
cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the
path is correct and try again.
At C:\Users\jmarcum_da\Desktop\Change_Package_Source.ps1:16 char:17
+ $PackageArray = Get-CMPackage
+                 ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-CMPackage:String) [], 
CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException




________________________________

Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.


The information transmitted is intended only for the person or entity to which 
it is addressed
and may contain CONFIDENTIAL material.  If you receive this 
material/information in error,
please contact the sender and delete or destroy the material/information.

Reply via email to