Create Prestage Content Files for All Distributed Data

Oh, hey! I didn’t see you there. Come see what I’m doing.

 

I had a client request to create prestage content for every production package, application, OS image, etc. They are in the midst of a project in which they are replacing most of their Distribution Points, but the pipe into the new DPs will be limited. Therefore, standard distribution methods will not cut it. So, we elected to enable the DPs for prestage content and load it all once onsite.

 

Naturally, we could have selected each individual package, application, etc. and used the console to create the .pkgx files, but where’s the fun in that? This has to be easily scriptable, especially with the Publish-CMPrestageContent cmdlet, right? Wellllllllllllllll…

 

I scoured the web for any scripts that may already exist. After all, there’s no need to recreate the wheel. I came across this post by the well-known David O’Brien. However, I need wanted something a little more simplistic, with fewer parameters; I’m just trying to grab everything available and create content files. Also, the script was a little outdated (required you to run in an x86 PS session), so I figured I should take a stab at writing my own to fit my client’s needs.

 

The script (below) does the following:

 

  • Accepts two parameters, “DestinationPath” and “SourceDP” (I plan on adding functionality later to allow for single Prestage Content file creation)
  • Uses WMI and the namespace root\SMS\site_<site code> and various classes to gather all packages, driver packages, OS images (did not add OS installers yet), boot images, etc.
    • To gather applications, I instead use the Get-CMApplication cmdlet
  • Creates a couple directories based on your input
    • Root directory based on the parameter
    • Content directory underneath defined path in which the .pkgx files are written
  • Copies extractcontent.exe (needed to unpack on the destination DPs) to the defined destination directory
  • Creates a batch file with the necessary command parameters to run the extractcontent.exe and places it on the defined destination directory
  • Gathers all available content for Prestage Content creation and creates files based on availability on the parameter-defined source DP
    • Packages
    • Applications
    • Software Update Deployment Packages
    • Driver Packages
    • OS Images
    • Boot Images
  • Writes to a log file titled “PrestageContent_<short date and time>.log”, which exists in c:\windows\temp
  • Cooks you breakfast in the morning

 

NOTE: This script must be run on a machine with the console installed (i.e. full access to the CM module). Also, be sure that the content of which you would like to create prestage files exists on the source DP (script will not fail, but no file will be created unless content has been distributed). Also, pardon the blog formatting… still getting used to this plugin.

 

By |2019-01-25T08:33:34+00:00August 12th, 2015|PowerShell, SCCM|1 Comment

About the Author:

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS