Your company's ad could live here and reach over 50,000 people a month!

Share This Post

Status Filter Rule for automatically enabling Nomad as your Alternate Content Provider

If you use 1e Nomad, like we do, and you have lots of Admins in your console adding packages, like we do, has it ever happened where an admin simply doesn’t remember to check the “Enable Nomad Branch” checkbox on a package?  If that situation applies to you, here’s a status filter rule, and a powershell script to have your Primary Site automatically enable that Nomad is checked in ConfigMgr07, when a new package is created.

Note that this routine is NOT mine.  99% of this routine is from Greg Ramsey, I’m just blogging it so that I have it written down for myself, so that the next time I need this I know where my instructions are.  <grin>

Basic Steps:

  1. PowerShell must be on your primary site server, and enabled.
  2. 2 files: A .bat file and a .ps1 file (below)
  3. A Status Filter Rule

The .bat file: 

  • Create a folder, for example, D:\StatusFilterRules\EnableACP.  In that folder create a .bat file called “enableacp.bat”  That file contains one single line:
    c:\windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -File D:\StatusFilterRules\EnableACP\EnableACP.ps1 %1 %2 %3 set-ExecutionPolicy Unrestricted

The Powershell File:

  • In the folder d:\StatusFilterRules\EnableACP, create a .ps1 file called EnableACP.ps1.  That script is below.

The Status Filter Rule:

  • In your ConfigMgr Console, under Site Settings, Status Filter Rules, create a new rule, Give it a name, like… “Nomad Checkbox on New Package Creation”
  • On the General Tab:  check Message Type=Audit, and check MessageID, and input   30000
  • On the Actions Tab: check Run a program.  The Program to run would be similar to this:
    D:\StatusFilterRules\EnableACP\EnableACP.bat %msgis02 ABC TheCMProviderServer
  • ABC you would replace with YOUR site code
  • TheCMProviderServer you would replace with YOUR primary site server name

Testing:

TEST!  Create a new package, either from importing from an .msi, or from a .sms input file, or however you normally create a package.  What should happen:

  • If you forget to check the nomad box at all, it will be checked for you.
  • If you check the nomad box, but set the work rate to be greater than 80, the work rate will be automatically changed to 80
  • In EventVwr, Application log, when this script is run, if it had to take an action, that action will be listed, with a source of “1E”

 

Below is the Powershell code to put into the EnableACP.ps1 script (be careful for word wrap):

 

$pkgID = $args[0]

$siteCode = $args[1]

$siteServer = $args[2]

$acp =

@"

<AlternateDownloadSettings SchemaVersion="1.0"><Provider Name="NomadBranch"><Data><ProviderSettings /><rh /><mc /><pc>5</pc></Data></Provider></AlternateDownloadSettings>

"@

$MaxWorkRate = 80

new-eventlog -source 1E -logname Application -erroraction silentlycontinue

$pkg = gwmi sms_package -computer $siteServer -namespace root\sms\site_$siteCode -filter "PackageID=’$pkgID’"

#this displays the explicit path to the object

$pkg2 = [wmi] $pkg.__Path    #use wmi accelerator to grab the object, including lazy

if ($pkg2.AlternateContentProviders -notmatch "nomad") {

    "enabling acp"

    write-eventlog -logname Application -source 1E -eventID 100 -entrytype Information -message "Enabling default Nomad Branch settings on package $pkgID"

    $pkg2.AlternateContentProviders = $acp

    $pkg2.Put()

}

else #acp already enabled, checking settings

{

    #check to see if work rate is configured properly

    $pkg2xml = [xml] $pkg2.AlternateContentProviders

    if ($pkg2xml.AlternateDownloadSettings.Provider.data.wr -ne $null) {

        if ($pkg2xml.AlternateDownloadSettings.Provider.data.wr -gt $MaxWorkRate) {

        "non-standard config Resetting acp default settings"

        write-eventlog -logname Application -source 1E -eventID 100 -entrytype Information -message "Non-standard Setting Configured – Re-Enabling default Nomad Branch settings on package $pkgID and resetting workrate to 80"

        $pkg2.AlternateContentProviders = $acp

        $pkg2.Put()

        }

     else

     {

        "acp already enabled, and work rate is acceptable"

     }

     }

     else

     {

        "wr is Null, which is considered acceptable"

     }

}

Share This Post

Sherry Kissinger is a App Systems Engineer with Wells Fargo. She has been working with SMS since version 2.0. She participates in Microsoft newsgroups, forums on myITForum.com and the myITForum.com mailing list. She also specializes in automating software deployment using Windows Installer, Transforms, and vbscripting. She also answers questions posed to the "mofmaster@myitforum.com"

Leave a Reply