One of the newest and coolest and most promising features tucked away inside System Center Configuration Manager preview build 1706 is the “Scripts” feature.  There are already some great blog posts that explain what it is, how it works, and what potential it offers, so I won’t try to one-up anyone (reinventing wheels is annoying).  What I want to cover in this article is how to use this feature (in the current, preview state) to deploy and track Chocolatey installations to clients.

What you need to know first:

  • Scripts (for now) can only be deployed to Device Collections and Devices within Collections (not to individual Devices under the “Devices” node itself, nor to Users or User Collections)
  • Scripts (for now) must be approved in order to be deployed
  • Scripts (for now) rely on the exit code (integer) as the success/fail result status (e.g. zero)
  • Scripts (for now) must be written in PowerShell
  • Scripts (for now) cannot be edited, you must delete/recreate them (for now)

Part 1 – Create the Install Script

  1. Expand Software Library and right-click Scripts, select Create Script
  2. Provide a Script Name
  3. Paste (or type) the script code into the edit box, or use the Import button to select a script file to import.  For this example, I’m using the most basic version of invoking the Chocolatey install script as follows:
    Invoke-Expression ((New-Object Net.WebClient).DownloadString(''))
  4. Click Next, and click Next again on the Summary page
  5. Click Close (The script is now in a pending status, awaiting approval)
  6. Right-click on the Script entry, and select the popup “Configure whether script authors can approve their own scripts in the site hierarchy settings.”
  7. Click Next
  8. Select Approve, and click Next
  9. Click Next again, and click Close

Part 2 – Deploy the Script

  1. Expand Assets and Compliance
  2. Expand Device Collections
  3. Right-click on a desired Device Collection and choose Run Script
  4. Select the desired script from the list, click Next
  5. Click Next again, and click Close

Part 3 – Track the Progress

  1. Expand Monitoring
  2. Select Script Status

That’s it from the ConfigMgr console perspective, again: for now.  There is no right-click capability (yet).  However, there is also a client-side “scripts.log” file, located under %WINDIR%\ccm\logs, which provides useful output capture data.

Illustrated Sequence








Stupid Thoughts

“Summary” and “Conclusion” are kind of overused, so I had to try ‘stupid thoughts’ for now.

Please don’t get too wrapped up about the specific vehicle of this blog post (chocolatey). It’s only intended to show “one way to do something with a new feature”.  You could do almost anything you desire, as long as it meets the (current) constraints.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s