Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help Logging with WMI SCCM Script

$
0
0

I have found a script to help me migrate some of my packages from SCCM 2007 to SCCM 2012.  It doesnt always seem to work so I would like to export the results to an excel sheet or a log.  I have no idea how to do that however.  Does anyone know the best way to do that?

$sitecode = "SITE CODE"
$source = "Old Path"
$dest = "New Path"

$packages = Get-WMIObject -namespace "root\sms\site_$sitecode" -class SMS_Package
foreach ($package in $packages) {
  $id = $package.PackageID
  $single = Get-WMIObject -namespace "root\sms\site_$sitecode" -class SMS_Package -filter "PackageID='$id'"

  foreach ($object in $single) {
    $path = $object.PkgSourcePath.Replace($source, $dest)
    $object.PkgSourcePath = $path
    $object.Put()
  }
}


"You can't fix stupid!"


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>