here is an example of updating part of a field in SQL

UPDATE v_Package

SET PkgSourcePath = Replace(PkgSourcePath,'\Part of path that needs
replaced','\what you want to replace it with')

Where PkgSourcePath Like 'The part that needs replaced%'


On Mon, Jul 15, 2013 at 6:54 PM, Marcum, John <[email protected]> wrote:

>  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 ($Package in $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.
>
>



Reply via email to