<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">neilp - System Center Premier Field Engineer</title><subtitle type="html">System Center – Automation and Integration</subtitle><id>http://blogs.technet.com/b/neilp/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/" /><link rel="self" type="application/atom+xml" href="http://blogs.technet.com/b/neilp/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2013-01-11T14:35:00Z</updated><entry><title>System Center Orchestrator: Get Current Date / Time using the NOW() Variable and Automate Outlook Calendar Scheduling</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/05/06/system-center-orchestrator-get-current-date-time-using-the-now-variable-and-use-this-with-outlook-calendar-scheduling.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/05/06/system-center-orchestrator-get-current-date-time-using-the-now-variable-and-use-this-with-outlook-calendar-scheduling.aspx</id><published>2013-05-06T22:00:00Z</published><updated>2013-05-06T22:00:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Hi Ho &amp;ndash; Neil Peterson here, the in-laws have invaded my house, so I am coming to you today from the corner booth at my local coffee shop. I have a quick little treat this morning, nothing to complicated, but pretty cool and important never the less. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Quite recently I have begun work on some runbook automation that includes Outlook scheduling capabilities. In order to achieve this scheduling functionality, I need to get the current date and time (at each runbook execution time). For instance, as a runbook is executed, I want to send an Outlook calendar invite to a specified user for exactly&amp;nbsp;two days from the time of runbook execution, thus the need for the current date and time.&amp;nbsp;For comparison sake, if I were writing my automation in VBScript I might use the &amp;lsquo;&lt;strong&gt;Date&lt;/strong&gt;&amp;rsquo; function, or in C# the &amp;lsquo;&lt;strong&gt;DateTime.Now&amp;rsquo; &lt;/strong&gt;function, but what is the equivalent when working with an Orchestrator runbook? Quite certainly we could use a Run .NET script activity and enumerate this information using PowerShell, however there may be a better (more native) method for collecting this information.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In this blog posting I will be taking a quick look at the native Orchestrator &lt;strong&gt;NOW()&lt;/strong&gt; variable. I will show how to use the variable, demonstrate some easy methods for modifying the captured time (now plus two days), and then finally show all of these activities in use when creating an Outlook calendar appointment. The components discussed in this posting can then be reused in pretty much any situation which requires any sort of scheduling, or runbook automation which revolves around knowledge of the current date and time.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The NOW() Variable:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Quite simply, a native 'special'&amp;nbsp;variable exists in the Orchestrator design environment that when invoked will return the current date and time. This variable must be created before use. This is no different than creating any other &amp;lsquo;custom&amp;rsquo; Orchestrator variable, however will have a value of &amp;lsquo;&lt;strong&gt;NOW()&lt;/strong&gt;&amp;rsquo;, as can be seen in the below screen shot. Notice that while in this example the value is NOW(), I have given the variable a name of &amp;lsquo;&lt;strong&gt;Current Date and Time:&lt;/strong&gt;&amp;rsquo;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2772.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2772.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For demonstration purposes, I will create a runbook that simply inserts a line into a text document. This text will be &amp;lsquo;The current date and time is&amp;rsquo; and then the newly created NOW() variable. The complete runbook and&amp;nbsp;the Insert Line activity configuration is shown below:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6545.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6545.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5428.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5428.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;After executing the Runbook we can observe the expected output &amp;ndash; simple and straight forward.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6283.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6283.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;More information about the NOW() variable can be found here - &lt;a href="http://technet.microsoft.com/en-us/library/hh440543.aspx"&gt;http://technet.microsoft.com/en-us/library/hh440543.aspx&lt;/a&gt; .&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Manipulating the Current Date and Time:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Let&amp;rsquo;s assume now&amp;nbsp;that we have some automation which once executed needs the current time plus&amp;nbsp;two days. So for instance, when the Runbook is executed, we would like to send a meeting invite for&amp;nbsp;two days later. How can we take NOW() and add two days to the returned value? As it turns out, this is quite simple using the &lt;strong&gt;Format Date/Time&lt;/strong&gt; activity, which is found under Utilities. With this activity, not only can we alter the &lt;strong&gt;format&lt;/strong&gt; of the current date and&amp;nbsp;time, but we can &lt;strong&gt;manipulate&lt;/strong&gt; this date and time as well by incrementing any of the date time values (day, hour, etc.).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For this example, I will build off of the already demonstrated Runbook. I will add a &amp;lsquo;Format Date/Time&amp;rsquo; activity and then another Insert Line activity. The end result should be two lines, one with the current date time, and one with the current date time + 2 days.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8863.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8863.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Before configuring the Format Date/Time activity, let&amp;rsquo;s examine the activities properties. What you will see is that we must specify an input format (that is the format the date time string is in when invoking this activity), and then an output format (that is the format we would like the activity to re-publish the date time string as). This will become very important as we begin to work with other components such as any Outlook Scheduling, as the NOW() variable and the expected date&amp;nbsp;/ time format when using the Exchange User Integration pack are not the same. Furthermore, notice here&amp;nbsp;that the default input&amp;nbsp;format does not match what was output by the NOW() variable (compare the format below to the output in the previous example). We will need to modify the Input format to match what the NOW() variable returns.&amp;nbsp;More on formatting can be found here&amp;nbsp;- &lt;a href="http://technet.microsoft.com/en-us/library/hh206037.aspx"&gt;http://technet.microsoft.com/en-us/library/hh206037.aspx&lt;/a&gt;&amp;nbsp;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4682.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4682.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The good news is that I have worked through properly formatting for both input and output (assuming you will be using Outlook integration).&amp;nbsp;For the input format, when using the NOW() variable as our input, we will use: &lt;strong&gt;M/d/yyyy h:mm:s tt&lt;/strong&gt; . For the output format when the desired destination is an activity from the Exchange User Integration Pack, we will use: &lt;strong&gt;yyyy-MM-ddTHH:mm:ss .&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In addition to the formatting, you will also see in the below screen shot the time adjustment which will return a time of NOW() plus two days.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6404.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6404.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As shown in the screen shot of this second runbook example, we will now write two lines to a text document, one with the current date / time, and then one with the current date / time +2. Below is the insert line text from each insert line activity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Current Date and time - notice that this is the '&lt;strong&gt;format results without adjustment&lt;/strong&gt;' which is native published data from the format Date&amp;nbsp;/ Time activity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7673.22.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7673.22.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;And finally below is the second insert line activity text (date/time + 2). Notice here that we are using the &amp;lsquo;&lt;strong&gt;Format Result&amp;rsquo;&lt;/strong&gt; published data, which includes the adjustment of 2 days.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1145.33.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1145.33.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;After executing the Runbook, the output is as follows. Notice that the date / time + 2 is two days after the initial current date time.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4762.44.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4762.44.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Wrapping this up with actual scheduling:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;My intention of this blog post was not to put much weight on the Outlook scheduling aspect of date / time, rather highlight how to use the NOW() variable. However, I do like to provide practical examples to accompany technical detail and theory. In this example I will quickly apply what has been discussed into an example which creates a simple calendar invite. Coming in the next week or so I will be releasing some example runbooks and a blog that will really use this scheduling capability in a very cool way.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This sample runbook does require the Exchange User Integration Pack (and an exchange environment). The solution consists of two Format Date / Time activates (one for the calendar invite start time, and one for the end time), and then an activity to create the calendar invite.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2260.55.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2260.55.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For the first date time we need NOW() plus two days.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7433.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7433.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;And for examples sake, say&amp;nbsp;we want the meeting invite to be&amp;nbsp;four hours in length. So for the second Format Date / Time activity, I am taking the results of the first (NOW() plus two) and adding an extra four hours to that. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6523.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6523.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The end result of running both of these activities is two sets of dates / time: NOW() + 2 days, which will serve as the appointment start time, and then NOW() + 2 days 4 hours, which will serve as the appointment end time.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;On the Create Exchange Item (Calendar Invite) activity we can observe the fruits of our work here.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4846.88.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4846.88.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Finally after runbook execution we can observe the results in Outlook. The sent time on the calendar invite represents when the runbook was executed NOW(), and then we can see that the invite is set to start two days after the sent time, and end four hours after that.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for Better View:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6470.99.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6470.99.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Closing:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;I thought this was a cool exercise; the NOW() variable while not complicated, is not something that was obvious to me when beginning this exercise. To boot, the time spent working with date / time format manipulation was a good exercise onto its own. Stay tuned over the next few days / potential week or so, I will be posting a practical solution that uses the topics discussed here to aid in the scheduling of Operating System Deployments. Until then &amp;ndash; tweet link is on the page, sign up for my twitter feed for notification of all new neilp activity, thanks for reading.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3571036" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator/" /><category term="SCORCH" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCORCH/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="Reporting" scheme="http://blogs.technet.com/b/neilp/archive/tags/Reporting/" /><category term="neilp" scheme="http://blogs.technet.com/b/neilp/archive/tags/neilp/" /><category term="Neil Peterson" scheme="http://blogs.technet.com/b/neilp/archive/tags/Neil+Peterson/" /><category term="Orchestrator Calendar" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator+Calendar/" /><category term="Orchestrator Outlook" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator+Outlook/" /><category term="NOW()" scheme="http://blogs.technet.com/b/neilp/archive/tags/NOW_28002900_/" /><category term="Orchestrator Exchange" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator+Exchange/" /></entry><entry><title>Building Intelligent Delay Within Orchestrator Runbook Solutions: Activity Looping</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/04/18/building-intelligent-delay-within-you-orchestrator-runbook-solutions-activity-looping.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/04/18/building-intelligent-delay-within-you-orchestrator-runbook-solutions-activity-looping.aspx</id><published>2013-04-18T00:44:00Z</published><updated>2013-04-18T00:44:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Often times when automating a multi-step process, there is a need to build into this automation a certain amount of delay. For instance, if I have rebooted an application server,&amp;nbsp;we not only need to wait for the OS to come back online, but also the application host services to come back online before adding the application server back into the host pool. This is to say, after rebooting the server;&amp;nbsp;we need to delay before executing the next step in the process. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;System Center&amp;nbsp;Orchestrator comes with built in delay functionality through establishing a trigger delay on any activity link. When setting this delay the process will pause between activities for the specified time. This is great, however as Anders Bergstrom has pointed out both &lt;a href="http://contoso.se/blog/?p=2802" target="_blank"&gt;here&lt;/a&gt;, the trigger delay functionality is difficult to track, as the pause is subsurface or does not manifest itself in any viewable form. Anders further solves this shortcoming by using a custom activity for introducing delay into Rubook solutions.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;I would like to expand on both triggered delays and customs activity based delays by introducing the concept of &lt;strong&gt;intelligent delays&lt;/strong&gt;. As I create Runbook solutions, it is my goals to include as few as possible timed delays, instead, relying on intelligent delays. Taking the example as detailed above in which a server is rebooted, before moving on with the automation, the IIS service must be started. Simply using a timed delay here would be quite inefficient. Instead if we were to monitor the IIS service, looping on this monitor activity until the service has started, and only then moving onto the next automation step, we have introduced a controlled and &lt;strong&gt;intelligent delay&lt;/strong&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This is but one simple example of using an Orchestrator activity to intelligently control delay. During this blog posting I will be detailing at a greater depth this example, as well as introducing two additional methods which include using &lt;strong&gt;WMI data&lt;/strong&gt; and &lt;strong&gt;PowerShell&lt;/strong&gt; as intelligent delay mechanisms. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Ultimately &lt;strong&gt;the benefits of using intelligent delays&lt;/strong&gt; are as follows&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Removing any inefficient guess work around timing&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Greater control over delay mechanics - delay only when a delay is needed and for only as long as the delay is required&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Greater reporting or visibility into the&amp;nbsp;delay - we can track how many times a loop has triggered&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Greater error control on the&amp;nbsp;delay &amp;ndash; we have the ability to exit if the delay loop has exceeded a determined threshold&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Intelligent Delay on Service Status:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In this first example scenario&amp;nbsp;we have a cluster node that has just been patched and rebooted (Runbook automation).&amp;nbsp;Once ready, this cluster node&amp;nbsp;needs to&amp;nbsp;be joined back into the cluster. Before doing so we want to delay until the Windows Failover Cluster service has been started. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the below screen shot we have the sequence of activates to be executed, the Check Cluster Service (boxed in red) activity is our intelligent delay. This is simply a &amp;lsquo;&lt;strong&gt;Get Service Status&amp;rsquo;&lt;/strong&gt; activity found under the native monitoring activities.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7140.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7140.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Looking at the properties, no surprises here, we have a computer name that is passed in using published data, and then the service name, in this case &amp;lsquo;Cluster Service&amp;rsquo;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2630.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2630.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Finally if I right click on the activity and select &amp;lsquo;Looping..&amp;rsquo;, we can see the &amp;lsquo;exit sequence&amp;rsquo;. So in this case the loop will exit when the Service status for the Cluster Service equal &amp;lsquo;Service Running&amp;rsquo;. Until a time at which the service is running, the activity will continue to loop &amp;ndash; &lt;strong&gt;Intelligent Delay&lt;/strong&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6472.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6472.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Ok, that example was kind of week on the wow factor, but demonstrates a very simple intelligent delay method which can be expanded well beyond server status using many of the native Orchestrator monitor&amp;nbsp;activities. I will turn up the technological wiz bang in the next two examples.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Delay on WMI data:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For my next example, the scenario is that a computer has been added to a Configuration Manager collection, and is then targeted with a set of software updates. A policy refresh job is then executed against the computer. Any seasoned Configuration Manager engineer would agree that there is no prescribed time in which one could expect this policy refresh process to complete. Because of this, using a timed delay here would be wildly inefficient and ultimately cause unpredictable results at Runbook execution time (been there, done that).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;To combat this need for a delay, however lack of predictable policy retrieval time, we can snoop WMI on the client for the arrival of the policy. Once&amp;nbsp;WMI data has indicated that the&amp;nbsp;policy has arrived we can move on with the next set of activates in the Runbook solution - &lt;strong&gt;Intelligent Delay&lt;/strong&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the below screen shot we can see the scenario as described above. The boxed in red activity &amp;lsquo;Check for Policy&amp;rsquo; is serving as the Intelligent delay - this is a standard Query WMI activity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6562.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6562.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Looking at the properties of this Query WMI activity, we have a basic WMI query. in this example we are returning all information about deployments applied to a computer via. Configuration Manager Policy. Basically, if the query returns a NULL value then the policy has not yet arrived and we would like to delay or loop. If the query returns anything other than NULL,&amp;nbsp;the policy has arrived, and the delay will end (loop will exit).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3036.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3036.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Here we can see the Do Not Exit condition which is checking for empty or NULL&amp;nbsp;policy&amp;nbsp;(matches patter ^$) indicating that the specific policy has not yet been applied. The delay loop is configured&amp;nbsp;to Exit when the&amp;nbsp;WMI query returns 'success' and contains any data, indicating that policy has arrived.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2514.7.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2514.7.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2210.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2210.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the previous WMI&amp;nbsp;example we were simply looking for the existence of data in WMI. If the data does not exist, loop until it does &amp;ndash; &lt;strong&gt;Inelegant Delay&lt;/strong&gt;. This can just as easily be configured to look for specific data. So for instance, if I was looking to loop until the software update installation process had completed, instead of a select all statement, I would simply be returning a specific piece of data. In the below screen (another Query&amp;nbsp;WMI Activity)&amp;nbsp;I am returning EvaluationState, which will&amp;nbsp;indicates progress into the software update installation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3884.8.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3884.8.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;With the WMI query results now loaded onto the Orchestrator databus, we can use these values in our conditional looping. In the example of evaluation state, there are several values that would indicate updates are in the process of being installed. I have each one of these defined as &lt;strong&gt;Do Not Exit&lt;/strong&gt; criteria, or in other words if updates are being installed loop &amp;ndash; &lt;strong&gt;Intelligent Delay&lt;/strong&gt;. Finally there are several values that would indicate the installation process has been completed. Upon returning one of these, the loop ends, and the next action in the automation is executed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2072.10.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2072.10.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5025.9.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5025.9.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Ill take a moment here just to clarify that both of these examples have focus on Configuration Manager and Software Updates. This process works with&amp;nbsp;ANY data that can be sniffed from WMI.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Delay on PowerShell Published Data:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Finally I have an example of using data loaded onto the databus&amp;nbsp;with a PowerShell script as the delay mechanism. The scenario is that we are draining all roles from a Windows Failover Cluster node. We would then like to perform maintenance on this node, however need to ensure that the drain has completed before starting any maintenance. Using PowerShell we can query the node for any hosted roles, gather a count of these roles, publishing this data to the Orchestrator databus. Once we have access to this data (count in this case)&amp;nbsp;on the Orchestrator databus we will loop on the data until the value is empty (the cluster node has been drained of all roles). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the below Runbook example, the &amp;lsquo;Wait for Drain to Complete&amp;rsquo; activity is serving as our intelligent delay. This is a standard Run .NET Script activity executing a very simple PowerShell script &amp;ndash; basically placing the count of cluster node roles into a variable &lt;strong&gt;$RoleCount&lt;/strong&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0181.11.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0181.11.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image to enlarge:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3660.12.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3660.12.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0842.13.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0842.13.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Our &lt;strong&gt;Do Not Exit&lt;/strong&gt; loop criteria is set to loop&amp;nbsp;(not exit)&amp;nbsp;when RoleCount is any other value then NULL (does not match patter ^$). Basically if there is any role present on the node, loop &amp;ndash; &lt;strong&gt;Intelligent Delay&lt;/strong&gt;. The loop will exit once the RoleCount data is equal to NULL (matches pattern ^$) indicating that all roles have been drained from the cluster node.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1055.14.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1055.14.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6567.15.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6567.15.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Closing:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;There you have it, pretty basic, however maybe not painfully obvious strategy for Intelligent Delay. While there may be a time and place for timed delays using either a link trigger delay or custom activity, it is my opinion that any opportunity to insert some intelligence into Runbook delay makes a smarter and more flexible Runbook execution experience.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As always, twitter subscripting link is on this page, check it out for updating on any new posting to &lt;strong&gt;technet.com/neilp&lt;/strong&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;neilp&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3567512" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="SCORCH" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCORCH/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="MMS 2013" scheme="http://blogs.technet.com/b/neilp/archive/tags/MMS+2013/" /><category term="neilp" scheme="http://blogs.technet.com/b/neilp/archive/tags/neilp/" /><category term="Neil Peterson" scheme="http://blogs.technet.com/b/neilp/archive/tags/Neil+Peterson/" /><category term="Runbook Delay" scheme="http://blogs.technet.com/b/neilp/archive/tags/Runbook+Delay/" /></entry><entry><title>MMS2013 Session Now on Channel 9 – Patching a Hyper-V Cluster with Orchestrator / Configuration Manager - Including Downloadable Runbook Exports!!!</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/04/15/mms2013-session-now-on-channel-9-patching-a-hyper-v-cluster-with-orchestrator-configuration-manager-including-downloadable-runbook-exports.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/04/15/mms2013-session-now-on-channel-9-patching-a-hyper-v-cluster-with-orchestrator-configuration-manager-including-downloadable-runbook-exports.aspx</id><published>2013-04-15T14:42:00Z</published><updated>2013-04-15T14:42:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Good day all &amp;ndash; if you were able to attend MMS2013 hope you had a great time, if not, no worries you are in luck. All MMS2013 sessions should now be available on Channel 9.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Check out my session &amp;lsquo;Complex Maintenance Using System Center 2012 Configuration Manager and Orchestrator: Patching a Cluster&amp;rsquo; &amp;ndash; &lt;/span&gt;&lt;a href="http://channel9.msdn.com/Events/MMS/2013/UD-B341"&gt;&lt;span style="color: #0563c1; font-family: Calibri; font-size: small;"&gt;http://channel9.msdn.com/Events/MMS/2013/UD-B341&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt; .&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;During this session, I detail a sample Orchestrator / Configuration Manager Solution which is used to gracefully apply updates to a Windows Failover cluster. In this session, I demonstrate this live against a 2 node Hyper-V cluster (hosting 20 VM's, Live migration and all). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Finally if you like what you see, I have made the Runbooks available at the following location &amp;ndash; &lt;/span&gt;&lt;a href="http://gallery.technet.microsoft.com/Cluster-Patching-Runbooks-5bda907a"&gt;&lt;span style="color: #0563c1; font-family: Calibri; font-size: small;"&gt;http://gallery.technet.microsoft.com/Cluster-Patching-Runbooks-5bda907a&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Enjoy &amp;ndash; and as always, you can subscribe to my twitter feed using the button found on the upper right hand section of this page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;neilp&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3566840" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/Orchestrator/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="Patching" scheme="http://blogs.technet.com/b/neilp/archive/tags/Patching/" /><category term="SCORCH" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCORCH/" /><category term="Cluster Patching" scheme="http://blogs.technet.com/b/neilp/archive/tags/Cluster+Patching/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="SQL Cluster" scheme="http://blogs.technet.com/b/neilp/archive/tags/SQL+Cluster/" /><category term="SQL Cluster Patching" scheme="http://blogs.technet.com/b/neilp/archive/tags/SQL+Cluster+Patching/" /><category term="Automation" scheme="http://blogs.technet.com/b/neilp/archive/tags/Automation/" /><category term="SCCM Powershell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Powershell/" /><category term="PowerShell" scheme="http://blogs.technet.com/b/neilp/archive/tags/PowerShell/" /><category term="MMS 2013" scheme="http://blogs.technet.com/b/neilp/archive/tags/MMS+2013/" /></entry><entry><title>Come Check Out My MMS 2013 Sessions</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/03/28/come-check-out-my-sessions-at-mms-2013.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/03/28/come-check-out-my-sessions-at-mms-2013.aspx</id><published>2013-03-28T18:16:00Z</published><updated>2013-03-28T18:16:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;MMS 2013 is right around the corner. While at the conference, I will be delivering one session and appearing as a guest in a second one. In each session I will be demonstrating solutions based on the interaction between System Center 2012 Configuration Manager SP1 and System Center 2012 Orchestrator SP1. Come check them out and feel free to grab me before, afterwards, or at any point during MMS 2013 for an introduction.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;strong&gt;UD-B341:&lt;/strong&gt; Wednesday April 10: 4:30 &amp;ndash; 5:45 PM&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Complex Maintenance Using System Center 2012 Configuration Manager and Orchestrator: Patching a Cluster&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;During this session, learn how the integration of Configuration Manager and Orchestrator can make the task of applying software updates or service packs to complex systems, an automated, predictable, and stress-free activity. You will have the opportunity to explore complete Runbook examples, automation scripts, and end-to-end demonstration of a complex yet automated maintenance cycle. Be prepared to view script samples and discuss the process at a technical level. The goal of this session is to arm you with the knowledge you need in order to position Configuration Manager and Orchestrator as a flexible maintenance solution that is able to handle the most complex system configurations.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;strong&gt;UD-B306:&lt;/strong&gt; Thursday April 11 12:00 &amp;ndash; 1:15 PM&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Notes From the Field: Complex and Massive Configuration Manager Migrations&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Find out what it takes to migrate a massive complex environment. This session will focus on the challenges of managing and moving an environment consisting of over 120,000 globally dispersed clients from Configuration Manager 2007 to System Center 2012 Configuration Manager SP1. We will discuss the planning process, the required pre&amp;ndash;migration work and finally the migration implementation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Also be sure to catch come of these other sessions being delivered by Premier Field engineers - &lt;a href="http://blogs.technet.com/b/mspfe/archive/2013/03/08/going-to-mms-2013-check-out-these-sessions-delivered-by-microsoft-premier-field-engineers.aspx"&gt;http://blogs.technet.com/b/mspfe/archive/2013/03/08/going-to-mms-2013-check-out-these-sessions-delivered-by-microsoft-premier-field-engineers.aspx&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;See You There.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;neilp&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3561620" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="MMS 2013" scheme="http://blogs.technet.com/b/neilp/archive/tags/MMS+2013/" /></entry><entry><title>Determine if CU1 has been applied to a 2012 Configuration Manager 2012 SP1 Site, Admin Console, and Client - Where's the Versioning?</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/03/28/determine-if-cu1-has-been-appropriately-applied-to-a-2012-configuration-manager-2012-sp1-site-admin-console-and-client-old.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/03/28/determine-if-cu1-has-been-appropriately-applied-to-a-2012-configuration-manager-2012-sp1-site-admin-console-and-client-old.aspx</id><published>2013-03-28T04:29:00Z</published><updated>2013-03-28T04:29:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;With System Center 2012 Configuration Manager SP1 CU1 deployments starting to roll, I have received a few inquiries into how to determine if CU1 has been appropriately applied. As a cumulative update is not a major update, the version of your Configuration Manager Site will not be incriminated. That said, both the Configuration Manager Administration Console and the Configuration Manager client do receive an increment in version number. In this quick Wednesday evening blog posting I will be detailing methods by which to determine if your site servers, administration consoles, and clients have received the CU1 update.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Site Server:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;What we will notice here, is that once the CU1 update has been applied to a site, the site version remains at &lt;strong&gt;5.00.7804.1000 &lt;/strong&gt;or that of SP1. This is the same version number that was present prior to the CU1 installation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0407.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0407.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;A simple way to verify the application of CU1 is to snoop the following registry location:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;HKLM\SOFTWARE\Microsoft\SMS\Setup&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Here we can find a Key name &lt;strong&gt;CULevel&lt;/strong&gt; with a value of the CU applied which will indicate the CU level, in this case CU1.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2538.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2538.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For reference, here is the same Key from a site in which CU1 has not been deployed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5140.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5140.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Console:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Once the console has been upgraded you will find that in Programs and Features the console is still listed at &lt;strong&gt;5.00.7804.1000 &lt;/strong&gt;or SP1 prior to CU1.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4135.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4135.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;When checking out &amp;lsquo;&lt;strong&gt;About Configuration Manager&amp;rsquo; &lt;/strong&gt;however, you will find that the console version has been incremented to Version &lt;strong&gt;5.0.7804.1202 &lt;/strong&gt;(SP1 CU1).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2781.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2781.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Furthermore the file &lt;strong&gt;Microsoft.ConfigurationManagement.exe&lt;/strong&gt; found in the &lt;strong&gt;AdminConsole\bin&lt;/strong&gt; folder will be versioned to &lt;strong&gt;5.0.7804.1202 &lt;/strong&gt;(SP1 CU1).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for Better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4503.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4503.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Inventory data (software)&amp;nbsp;on this file is going to be a decent indicator of console versioning if using a collection query to upgrade a set of deployed console.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Client:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Finally the client is straight forward, once upgraded, the client version will be incremented to &lt;strong&gt;5.00.7804.1202 &lt;/strong&gt;or that of SP1 CU1.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7450.7.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7450.7.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Client versioning as seen in the console.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for Better View:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3386.8.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3386.8.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;A simple collection query will produce all clients that have not received the update, which you can then use for deployment targeting (taking into account x86, x64).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ClientVersion &amp;lt; "5.00.7804.1202"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Closing:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Hope this quick post on CU1 versioning has been helpful, as always feedback is welcome, subscribe to my twitter feed using the button found on this page, see you at MMS 2013!!&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3561493" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="SCCM Migration" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Migration/" /><category term="CU1 Upgrade" scheme="http://blogs.technet.com/b/neilp/archive/tags/CU1+Upgrade/" /><category term="CU1 Version" scheme="http://blogs.technet.com/b/neilp/archive/tags/CU1+Version/" /></entry><entry><title>Determine if a Configuration Manager Distribution Point is a Distribution Point Group Member – PowerShell</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/03/25/determine-if-a-configuration-manager-distribution-point-is-a-distribution-point-group-member-powershell.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/03/25/determine-if-a-configuration-manager-distribution-point-is-a-distribution-point-group-member-powershell.aspx</id><published>2013-03-25T19:59:40Z</published><updated>2013-03-25T19:59:40Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As I am working with the 2012 Configuration Manager SP1 (and CU1) PowerShell CMDLETs, the potential for automation around both the management and deployment spaces of Configuration Manager&amp;nbsp;are expanding. That said, I have run against a few automation solution requirements that could not be met using the native PowerShell CMLETs. No worries though &amp;ndash; WMI can still pull through when needed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In my most current project I&amp;rsquo;ve had the need to determine wither or not a particular Distribution Point is already a member of a particular distribution point group. While we have been provided with a handful of CMDLETs that had looked promising (&lt;strong&gt;Get-CMDistributionPoint&lt;/strong&gt; and &lt;strong&gt;Get-CMDistributionPointGroup&lt;/strong&gt;), neither of these appear to provide the data I need. In this quick blog posting I will be sharing the PowerShell script I am using to determine DP group membership.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Backstory:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Before sharing the script, here is the backstory for context sake. I am working on a series of Orchestrator Runbooks&amp;nbsp;that will fully deploy a Configuration Manager distribution point.&amp;nbsp;When creating Orchestrator Runbook solutions, I make every effort to included Runbook resiliency. That is, before performing any automated action I want to ensure that this action has not already been performed. In this case, before adding a Distribution Point to a Distribution Point Group, I want to ensure that it is not already a member of this group- simple as that. Building in this type of control adds quite a bit of benefit to Runbook automation such as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Potential reduction in error due to repeated work.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Potential reduction in need for error control.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Most importantly if a Runbook solution is &lt;strong&gt;restarted&lt;/strong&gt; for any reason mid-way, this resiliency will ensure that all completed automation will not be re-run or duplicated, while any non-completed automation is then completed.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Script:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This script was thrown together pretty quickly and could probably stand some scrubbing, but works great as is. Also to note, the &lt;strong&gt;Get-WmiObject&lt;/strong&gt; CMDLET supports the use of a &lt;strong&gt;-Credential&lt;/strong&gt; parameter. This can be used when needing to supply alternate credentials.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;$DP = "&amp;lt;Enter DP Name&amp;gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;$DPGroup = "&amp;lt;Enter DP Group Name&amp;gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;$SiteCode = "&amp;lt;Enter Site Code&amp;gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;$PrimarySS = "&amp;lt;Enter Primary Site Server Name&amp;gt;"&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;$NS = "root\sms\site_" + $SiteCode&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;$wmi = Get-WmiObject -Class SMS_DPGroupInfo -Filter "Name = '$DPGroup'" -ComputerName $PrimarySS -Namespace $NS &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;$gid = $wmi.GroupID &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;$NAL = Get-WmiObject -Class "SMS_DPGroupMembers" -Filter "GroupID= '$gid'" -ComputerName $PrimarySS -Namespace $NS | Select DPNALPath&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;foreach ($item in $NAL) {&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If ($item -like "*" + $DP + "*") {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $result = "True"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: x-small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Orchestrator Use:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;So, to use in Orchestrator, the script has been dropped into a Run .NET activity, the &lt;strong&gt;$result&lt;/strong&gt; variable is specified as published data, and then this published data is used in link logic. So if the value of &lt;strong&gt;$result&lt;/strong&gt; is &amp;ldquo;&lt;strong&gt;True&lt;/strong&gt;&amp;rdquo; the runbook as pictured below completes after the "Check DP Group for DP" activity. If the value is not &amp;ldquo;&lt;strong&gt;True&lt;/strong&gt;&amp;rdquo; then the activity to add the Distribution Point to the Distribution Point Group is run.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5076.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5076.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Script as used in Run .NET Activity. Notice here that I have included the use of alternate credentials.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1258.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1258.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Example of Published Data:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7345.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7345.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Example of Link Logic:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5417.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5417.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Closing: &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Quick post here! I hope that you find this script to be helpful when approaching your own Configuration Manager infrastructural automation projects.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3560871" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="SCCM Powershell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Powershell/" /></entry><entry><title>At Long Last - Add-CMDistributionPoint PowerShell CMDLET included in Configuration Manager SP1 CU1</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/03/23/at-long-last-add-cmdistributionpoint-powershell-cmdlet-included-in-configuration-manager-sp1-cu1.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/03/23/at-long-last-add-cmdistributionpoint-powershell-cmdlet-included-in-configuration-manager-sp1-cu1.aspx</id><published>2013-03-23T17:42:00Z</published><updated>2013-03-23T17:42:00Z</updated><content type="html">&lt;p&gt;Whoo - long time no blog.&amp;nbsp;I am still around and kicking, just been occupied with a new baby&amp;nbsp;(&lt;strong&gt;New-CMFreak&lt;/strong&gt;), a new home, and wrapping up presentations for MMS. My hope is to kick this blog back into gear over the&amp;nbsp;next month. Stay tuned for what I hope will be an exciting series of blog postings on ready to use Runbooks that will aid in migration from Configuration Manager 2007 to 2012, and then also a series of blogs detailing my first foray into Hyper-V Clustering and System Center Virtual Machine manager (including details on how I have configured my lab).&lt;/p&gt;
&lt;p&gt;However, for today I am excited to get this one down. Last night as I was wrapping up the day, winding down with a quick view of my Twitter feed, I noticed that System Center 2012 Configuration Manager SP1 CU1 had been released. I have anxiously been anticipating this release with the one hope that it would include a PowerShell CMDLET for deploying distribution points. This functionality does not exist pre-CU1. Fortunately, after reviewing the documentation, my hopes had&amp;nbsp;been met, the Add-DistributionPoint CMDLET had made the cut.&lt;/p&gt;
&lt;p&gt;In this blog post I will be taking a quick look at new CMDLET - &lt;strong&gt;Add-CMDistributionPoint&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Adding the new CMDLETS:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One thing that was not obvious when installing CU1 is that the actual CU1 install itself will not make the CMDLETS available in the ConfigurationManager PowerShell module. What you will notice is that when installing CU1 you will be prompted to create several package including an update package for the Configuration Manager Console. Included in this package is the PowerShell module updates.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Screen Shot of the CU1 installation Deployment Assistance Options:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0143.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/0143.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which yields the following packages:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Screen Shot of my CM Console Post CU1 installation:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6862.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6862.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, in order to use the new PowerShell CMDLETs, we need to first install CU1, and then deploy (or install) the console update onto the system from which we will be working with the PowerShell.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Add-CMDistributionPoint&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I will admit, it is with mixed emotions that I begin working with this CMDLET. Here is the back story, I am working on an extremely large 2012 Configuration Manager SP1 migration in which we will be deploying upwards of 500 new distribution points. Early on in the process, I had proposed that we use System Center Orchestrator to automate the deployment of these distribution points. Short story even shorter &amp;ndash; I spent many hours just last week putting together PowerShell that will deploy a distribution point, which I could then use in my Orchestrator solution. Needless to say, I no longer need the script. However all is not lost; this was a great exercise into both PowerShell and some of the subsurface components of Configuration Manager.&lt;/p&gt;
&lt;p&gt;Onto the goodness &amp;ndash; first things first let&amp;rsquo;s check out the help file for the CMDLET.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Get-Help Add-CMDistributionPoint&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4747.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4747.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Whoo that is allot of options, however never fear they are for the most part self-explanatory. What you notice is that only a few of these are required, the remainder are for &amp;ldquo;fine-tuned&amp;rdquo; configuration. The list of required parameters is&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-SiteSystemServerName&lt;/li&gt;
&lt;li&gt;-SiteCode&lt;/li&gt;
&lt;li&gt;-MinimumFreespaceMB&lt;/li&gt;
&lt;li&gt;-CertificateExperationTimeUtc&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One thing you may also notice though is that we must specify &lt;strong&gt;a Site System Server Name.&lt;/strong&gt; This indicates that a site system must be first added to the Configuration Manager environment&amp;nbsp;before we can use this CMDLET to install the Distribution Point role (which makes sense). If you want to automate the addition of the site system server prior to adding the DP role,&amp;nbsp;we can use &lt;strong&gt;New-CMSiteSystemServer &lt;/strong&gt;CMDLET.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4810.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4810.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4276.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4276.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once the site system has been added to the Configuration Manager environment we can then use &lt;strong&gt;Add-CMDistributionPoint&lt;/strong&gt; to add the DP role. For my example the command will be&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Add-CMDistributionPoint &amp;ndash;SiteSystemServerName &amp;ldquo;SCO5.TWOCHUTES.COM&amp;rdquo; &amp;ndash;SiteCode P01 &amp;ndash;MinimumFreeSpaceMB 5000 &amp;ndash;CertificateExpirationTimeUtc &amp;ldquo;Saturday, March 21, 2015 9:47:22 AM&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;NOTE: The example shown here assumes that IIS has been configured on the target distribution point. The Add-CMDistributionPoint CMDLET includes an &amp;ndash;InstallInternetServer parameter which will install and configure IIS in the event that this is needed on the target distribution point.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5773.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5773.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And as can be seen in the following screen shots, the DP role has been added and configured thusly.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4454.7.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4454.7.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4745.8.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4745.8.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Closing&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pretty cool &amp;ndash; hats off to the Configuration Manager Product team for the addition of this CMDLET. This will make the automated deployment of 2012 Configuration Manager SP1 environments much more simple. Stay tuned and I will be posing an Orchestrator Runbook solution that deploys Distribution Points end-to-end which will include the use of this PowerShell CMDLET.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3560567" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="SCCM Powershell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Powershell/" /><category term="cmdlets" scheme="http://blogs.technet.com/b/neilp/archive/tags/cmdlets/" /><category term="PowerShell" scheme="http://blogs.technet.com/b/neilp/archive/tags/PowerShell/" /><category term="Distribution Point" scheme="http://blogs.technet.com/b/neilp/archive/tags/Distribution+Point/" /><category term="Add-CMDistributionPoint" scheme="http://blogs.technet.com/b/neilp/archive/tags/Add_2D00_CMDistributionPoint/" /><category term="New-CMSiteSystemServer" scheme="http://blogs.technet.com/b/neilp/archive/tags/New_2D00_CMSiteSystemServer/" /></entry><entry><title>System Center 2012 Configuration Manager: Determine Reboot Pending State Using WMI / PowerShell / Orchestrator Runbook</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/02/12/system-center-2012-configuration-manager-determine-reboot-pending-state-using-wmi-powershell-orchestrator-runbook.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/02/12/system-center-2012-configuration-manager-determine-reboot-pending-state-using-wmi-powershell-orchestrator-runbook.aspx</id><published>2013-02-12T17:15:00Z</published><updated>2013-02-12T17:15:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;While recently working on a Runbook solution for patching Windows Failover Clusters, I ran into the need of detecting if the Software Update installation process had placed the target system into a reboot pending state. After doing some research, I found many &amp;lsquo;loose&amp;rsquo; methods for reboot detection, however nothing concrete. That is, until I happened upon a new WMI Class of the &lt;strong&gt;CCM_ClientSDK&lt;/strong&gt; namespace named&lt;strong&gt; CCM_ClientUtilities&lt;/strong&gt;. This little gem was waiting at idle capable of providing reboot pending information. In this post I will be quickly taking a look at the &lt;strong&gt;CCM_ClientUtilities&lt;/strong&gt; class and discussing how to use this class for pending reboot detection in your PowerShell / Orchestrator automation solutions.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Before Getting Started:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Before jumping into the guts and glory of CCM_ClientUtilities, maybe I should lay out the situation in which we may need this pending&amp;nbsp;reboot information. For sure, if a Configuration Manager delivered update requires a reboot, shouldn't we just let Configuration Manager handle the reboot, thus no detection needed? While in&amp;nbsp;many circumstances I would agree with this notion, I have found that when automating process around the installation of updates, when a reboot is not required, there is not a good trigger mechanism indicating that&amp;nbsp;it is ok to advance to the next automated task. Thus, if we pause after update installation, and then check for reboot applicability, we can then either reboot the system before carrying on with the remaining process, or skip&amp;nbsp;a reboot (when one is not needed)&amp;nbsp;and move onto the remaining process items. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;CCM_ClientUtilities:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;So check it out, below is a graphical representation of the namespace &lt;strong&gt;ROOT\ccm\ClientSDK&lt;/strong&gt;, the class &lt;strong&gt;CCM_ClientUtilities&lt;/strong&gt;, and the Class Method &lt;strong&gt;DetermineifRebootPending&lt;/strong&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click Image for better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3580.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3580.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;We can invoke this method using any number of WMI interfaces; however for the sake of establishing building blocks towards orchestrator Runbook automation I will be using PowerShell.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;PowerShell:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The following PowerShell script first returns the CCM_ClientUtilitiis class object and then executes the &lt;strong&gt;DetermineIfRebootPending&lt;/strong&gt; method, placing the results into a variable &lt;strong&gt;$results&lt;/strong&gt;. I&amp;rsquo;ve then displayed the results using Write-Host.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;$reboot = [wmiclass]"\\&amp;lt;Computer Name&amp;gt;\root\ccm\ClientSDK:CCM_ClientUtilities"&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;$result = $reboot.DetermineIfRebootPending() | Select RebootPending&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;Write-Host $result&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3630.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3630.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Pretty simple - lets place this into Orchestrator.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Orchestrator Runbook Use:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For sample sake I am going to provide here a very simple example of this script in use. We will enter a Computer Name into the Initialize Data activity, run the script basically as detailed above, and then perform some link logic against the returned (Published) data from the Run .NET Script activity. If the returned data indicates a reboot is necessary we will do so and then proceeded on with the Runbook (indicated by the Continue Workflow activity). If a reboot is not needed we will jump straight to the Continue Workflow activity.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Sample Runbook (Click image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1325.e.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1325.e.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Run .NET Script Activity PowerShell (Click image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7457.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7457.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Published Data from Run .NET Script Activity (Click Image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7178.4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7178.4.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Link Logic when a reboot is required (Click image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4113.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4113.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Link Logic when no reboot is required (Click image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7776.6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7776.6.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Finally for some practical context, here is an example of a real world Runbook in which this reboot detection logic is used. This Runbook is part of a series of Runbooks that applies software updates to a Windows Failover Cluster (more on this later this week).&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;Sample Runbook (Click image for better view):&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7510.9.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/7510.9.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Simple, quick post here. Just wanted to demonstrate the use of this cool new System Center 2012 Configuration Manager&amp;nbsp;WMI trick.&amp;nbsp;In this post we have looked at&amp;nbsp;some PowerShell that allows us to use the CCM_ClientUtilities class to determine is a Reboot is pending on a system due to Configuration Manager activities. We have then seen how to further use this PowerShell in our Orchestrator Runbook solutions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3551965" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="SCORCH" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCORCH/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="SCCM Powershell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Powershell/" /><category term="PowerShell" scheme="http://blogs.technet.com/b/neilp/archive/tags/PowerShell/" /><category term="SCCM Reboot PowerShell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Reboot+PowerShell/" /><category term="SCCM Reboot" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Reboot/" /></entry><entry><title>Configuration Manager PowerShell Tuesdays: Creating and Distributing a Package / Program:</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/01/15/configuration-manager-sp1-powershell-tuesday-creating-and-distribution-a-package-program.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/01/15/configuration-manager-sp1-powershell-tuesday-creating-and-distribution-a-package-program.aspx</id><published>2013-01-15T10:28:00Z</published><updated>2013-01-15T10:28:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;I have long been a crusty old VBScript kind of guy, that just the way it is. I&amp;rsquo;ve been knocking out &amp;lsquo;short&amp;rsquo; 300 line scripts for 10 plus years. In that time I have also gone through a few epic multi thousand line monstrosity scripts,,,, now that&amp;rsquo;s living. Many years ago at the Microsoft Management Summit (maybe 2008 or 2009) I was given a PowerShell book inside the attendee bag. Then and there I decided to take the leap from my precious wscript.exe to this new-fangled PowerShell thing&amp;hellip;&amp;hellip; It didn&amp;rsquo;t happen&amp;hellip;&amp;hellip;. I fell back to the comforts of VBScript year after year. I am here to say now that I think I have crossed the threshold &amp;ndash; PowerShell has found its way to the front of my scripting activities and has been paramount in the automation work that I have completed over the last twelve months.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;With this blog post I hope to kick off an extended multi post look into some of the many PowerShell CMDLETS included with System Center 2012 Configuration Manager.&amp;nbsp;In addition to examining the CMDLETS themselves, I will be punting in a few posts that should tie multiple pieces of Configuration Manager PowerShell automation into larger Runbook Automation solutions, so look out for those as well. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As reference, I have also completed two blog postings on running Configuration Manager PowerShell CMDLETS outside of a Configuration Manager console initiated PowerShell session, more specifically from System Center Orchestrator. These may be useful when approaching Configuration Manager automation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/b/neilp/archive/2013/01/07/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity.aspx" target="_blank"&gt;Running 2012 Configuration Manager SP1 PowerShell CMDLETS from an Orchestrator Run .NET Script activity&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/b/neilp/archive/2013/01/11/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity-part-2-the-rest-of-the-story.aspx" target="_blank"&gt;Configuration Manager SP1 PowerShell in Orchestrator Part 2: The Rest of the Story&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In this particular posting, I will be taking a quick look at the following four CMDLETS&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMPackage&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Set-CMPackage&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMProgram&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Start-CMContentDistribution&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;There is not&amp;nbsp;much to cover&amp;nbsp;at any extreme&amp;nbsp;depth with the execution of these four CMDLETS,&amp;nbsp;they are fairly straight forward. Nevertheless this&amp;nbsp;article will be a great kick off point and should set the rhythm for many more to follow. &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMPackage:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This CMDLET quite simply creates a Configuration Manager Package. The Get-Help file for this CMDLET includes the following syntax.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMPackage -Name &amp;lt;string&amp;gt; [-Description &amp;lt;string&amp;gt;] [-Manufacturer &amp;lt;string&amp;gt;] [-Language &amp;lt;string&amp;gt;] [-Version &amp;nbsp;&amp;lt;string&amp;gt;] [-Path &amp;lt;string&amp;gt;] [-WhatIf] [-Confirm]&amp;nbsp; [&amp;lt;CommonParameters&amp;gt;]&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For my example I will be running&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;New-CMPackage &amp;ndash;Name &amp;ldquo;7ZIP &amp;ndash; PS Created&amp;rdquo; &amp;ndash;Path &amp;ldquo;&lt;a href="file://twocmsp1/c$/Packages/Software%20Distribution/7ZIP"&gt;&lt;span style="color: #0000ff;"&gt;\\twocmsp1\c$\Packages\Software Distribution\7ZIP&lt;/span&gt;&lt;/a&gt;&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As can be seen in the console, the results match the executed PowerShell cmd.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1460.1_2D00_13_2D00_2013-4_2D00_28_2D00_49-PM.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1460.1_2D00_13_2D00_2013-4_2D00_28_2D00_49-PM.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Ok Cool, but what about the other package configuration options such as distribution priority, I do not see a way to configure these using the New-CMPackage CMDLET? Correct, it does not appear all configurations of a package can be set when initially creating the package, however loping in the &lt;strong&gt;Set-CMPackage &lt;/strong&gt;CMDLET extends the configuration capability.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Set-CMPackage:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This CMDLET configures an existing&amp;nbsp;Configuration Manager Package. The Get Help file for this CMDLET includes the following syntax. I&amp;rsquo;ve trimmed this down to only one of the returned sets of syntax. There are three mostly identical, one each for Package ID, Package Name, and Package Input Object.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Set-CMPackage -Name &amp;lt;string&amp;gt; [-SecuredScopeNames &amp;lt;string&amp;gt;] [-NewName &amp;lt;string&amp;gt;] [-Version &amp;lt;string&amp;gt;] [-Manufacturer &amp;nbsp;&amp;lt;string&amp;gt;] [-Language &amp;lt;string&amp;gt;] [-Description &amp;lt;string&amp;gt;] [-Path &amp;lt;string&amp;gt;] [-ForcedDisconnectDelay &amp;lt;int&amp;gt;] [-ForcedDisconnectEnabled &amp;lt;bool&amp;gt;] [-ForcedDisconnectNumberRetries &amp;lt;int&amp;gt;] [-MifFileName &amp;lt;string&amp;gt;] [-MifName &amp;lt;string&amp;gt;] [-MifPublisher &amp;lt;string&amp;gt;] [-MifVersion &amp;lt;string&amp;gt;] [-DistributionPriority &amp;lt;Priorities&amp;gt; {High | Normal | Low}] [-ShareName &amp;lt;string&amp;gt;] [-ShareType &amp;lt;ShareTypes&amp;gt; {ShareCommon | ShareSpecific}] [-WhatIf] [-Confirm]&amp;nbsp; [&amp;lt;CommonParameters&amp;gt;]&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For my example I will be running:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Set-CMPackage -Name "7ZIP - PS Created" -DistributionPriority High&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Which results in the following changes made on the package:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3730.5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/3730.5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;strong&gt;New-CMProgram&lt;/strong&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;With a package created, we will need a Program. The Get-Help file for the &lt;strong&gt;New-CMProgram&lt;/strong&gt;&amp;nbsp;CMDLET includes the following syntax. This is for a standard program only, the help file also includes some syntax for a device program. Use Get-Help New-CMProgram to see all syntax.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMProgram -PackageName &amp;lt;string&amp;gt; -StandardProgramName &amp;lt;string&amp;gt; -CommandLine &amp;lt;string&amp;gt; [-RunType &amp;lt;RunType&amp;gt; {Normal | Minimized | Maximized | Hidden}] [-ProgramRunType &amp;lt;ProgramRunType&amp;gt; {OnlyWhenUserIsLoggedOn | WhetherOrNotUserIsLoggedOn | OnlyWhenNoUserIsLoggedOn}] [-RunMode &amp;lt;RunModeType&amp;gt; {RunWithUserRights | RunWithAdministrativeRights}] [-UserInteraction &amp;lt;bool&amp;gt;] [-Reconnect &amp;lt;bool&amp;gt;] [-DriveMode &amp;lt;DriveModeType&amp;gt; {RenameWithUnc | RequiresDriveLetter | RequiresSpecificDriveLetter}] [-DiskSpaceUnit &amp;lt;DiskSpaceUnitType&amp;gt; {KB | MB | GB}] [-DriveLetter &amp;lt;string&amp;gt;] [-WorkingDirectory &amp;lt;string&amp;gt;] [-DiskSpaceRequirement &amp;lt;string&amp;gt;] [-Duration &amp;lt;int&amp;gt;] [-WhatIf] [-Confirm]&amp;nbsp; [&amp;lt;CommonParameters&amp;gt;]&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For my example I will be running:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMProgram -PackageName "7ZIP - PS Created" -StandardProgramName "7ZIP - Program" -CommandLine "msiexec.exe /I 7z920.msi /quiet /norestart"&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The results are much to be expected.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/13646.1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/13646.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Take note of the standard Environment settings when no options have been specified with the New-CMProgram CMDLET.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1803.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1803.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;If desired,&amp;nbsp;additional configuration can&amp;nbsp;be made at&amp;nbsp;creation time. For instance if adding the -ProgramRunType and -RunMode parameter when running the New-CMProgram CMDLET, such as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;New-CMProgram -PackageName "7ZIP - PS Created" -StandardProgramName "7ZIP - Program: -CommandLine "msiexec.exe /I 7z920.msi /quiet /norestart" -ProgramRunType WhetherOrNotUserIsLoggedOn -RunMode RunWithAdministrativeRights"&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The results are as follows:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4314.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4314.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Start-CMContentDistribution:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;All right - we have a package and a program created. Next step is to distribute this bad boy to a single distribution point or distribution point group. No worries, we have an CMDLET for that. The Get-Help file for &lt;strong&gt;Stat-CMContentDistribution&lt;/strong&gt; includes the following. NOTE: this is the output for only a standard package, there are unique commands for driver packages, operating system images, etc. however they are mostly similar to what is shown below. Run Get-Help Start-CMContentDistribution for a full listing.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Start-CMContentDistribution -DeploymentPackageName &amp;lt;string[]&amp;gt; [-CollectionName &amp;lt;string&amp;gt;] [-DistributionPointName &amp;lt;string&amp;gt;] [-DistributionPointGroupName &amp;lt;string&amp;gt;] [-WhatIf] [-Confirm]&amp;nbsp; [&amp;lt;CommonParameters&amp;gt;]&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;For my example I will be executing &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Start-CMContentDistribution -PackageName &amp;nbsp;"7ZIP - PS Created" -DistributionPointGroupName TWOCMSP1&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Once completed we can observe on the distribution point groups&amp;nbsp;properties that the package has in deed been distributed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8611.f.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8611.f.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Conclusion:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Very straight foreword stuff here.&amp;nbsp;As seen, through a series of&amp;nbsp;just a few&amp;nbsp;Configuration Manager CMDLETS we can easily create a Package, Program, and distribute the package to a group of distribution points.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3545597" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="SCCM" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM/" /><category term="SCCM Powershell" scheme="http://blogs.technet.com/b/neilp/archive/tags/SCCM+Powershell/" /><category term="SP1" scheme="http://blogs.technet.com/b/neilp/archive/tags/SP1/" /><category term="cmdlets" scheme="http://blogs.technet.com/b/neilp/archive/tags/cmdlets/" /><category term="Distribution Point" scheme="http://blogs.technet.com/b/neilp/archive/tags/Distribution+Point/" /></entry><entry><title>Configuration Manager SP1 PowerShell in Orchestrator Part 2: The Rest of the Story</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/neilp/archive/2013/01/11/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity-part-2-the-rest-of-the-story.aspx" /><id>http://blogs.technet.com/b/neilp/archive/2013/01/11/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity-part-2-the-rest-of-the-story.aspx</id><published>2013-01-11T14:35:00Z</published><updated>2013-01-11T14:35:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Well I thought I was Mr. Smarty Pants and had the whole &amp;lsquo;running 2012 Configuration Manager cmdlets from an Orchestrator Run .Net Script activity&amp;rsquo; figured out (&lt;a href="http://blogs.technet.com/b/neilp/archive/2013/01/07/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity.aspx" target="_blank"&gt;as documented in this post&lt;/a&gt;). As it turns out, there is bit more to the story. Everything documented in the initial post is valid, however as I found out today there is an additional step that needs to be taken in order to load data from the executed Configuration Manager PowerShell CMDLETS onto the Orchestrator data bus. So let&amp;rsquo;s just consider this post two in the series&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In this post I will be detailing the steps needed in order to load a Configuration Manager CMDLET generated data set from an Orchestrator Run .NET Script activity&amp;nbsp;onto the Orchestrator data bus.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Last time on as the scripts churn:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As seen before, in order to Run a Configuration Manager PowerShell cmdlet in the Orchestrator Run .NET Script activity, the script must be capsulated in &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;$VAR = Powershell {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&amp;lt;Script Goes Here&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The details of why can be found &lt;a href="http://blogs.technet.com/b/neilp/archive/2013/01/07/running-2012-configuration-manager-sp1-powershell-cmdlets-from-an-orchestrator-run-net-script-activity.aspx" target="_blank"&gt;here&lt;/a&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the following example I am importing the Configuration Manager PowerShell module, changing to the appropriate PSDrive, and the running the &lt;strong&gt;Start-ContentDistribution&lt;/strong&gt; CMDLET which will distribute content to a Distribution Point. This works great, but as can be seen, I am not attempting to pass any data back onto the Orchestrator data bus.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click image for a better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6114.234.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/6114.234.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The issue encountered trying to publish data:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;So going with my newly gained wisdom, today I attempted to execute the following script / Run .NET Script activity. This script once again imports the Configuration Manger PowerShell module, changes to the appropriate PSDrive, and then runs the &lt;strong&gt;Get-CMDevice&lt;/strong&gt; cmdlet, placing the results in a variable $isActive. This is all encapsulated in the appropriate code&amp;nbsp;allowing the&amp;nbsp;Configuration Manager script to be run from the Orchestrator activity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click image for a better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1033.345.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1033.345.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;I then have defined Published data that would return the set of data to the Orchestrator data bus.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/55666.3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/55666.3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;What I was expecting to see returned was a list of computers (more specifically the active state for a list of computers), however nothing was returned. After some picking around my guess was that the invoked PowerShell 3.0 session does not natively &amp;lsquo;pass&amp;rsquo; data back to the calling session which would account for the lack of a returned data set.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;And the Fix:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;After coming to grips with the fact that I am a mere tourist when it comes to PowerShell development, I turned back to Karl Prosser&amp;rsquo;s Blog on the various PowerShell issues with the Run. Net Script activity. Sure enough I found what I needed. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Karl Prosser post&amp;nbsp;- &lt;a href="http://karlprosser.com/coder/2012/04/16/calling-powershell-v3-from-orchestrator-2012/" target="_blank"&gt;Live PowerShell with Karl Prosser&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As seen in Karl&amp;rsquo;s blog, &lt;strong&gt;in order to load the returned data set onto the Orchestrator data bus, it must also be &amp;lsquo;passed&amp;rsquo; from the invoked 3.0 PowerShell session back into the invoking Run .Net Script 2.0 session&lt;/strong&gt;. This is quite simple to do. Essentially we will be creating a new object, and the bringing that data back into the calling process, and then targeting it as published data.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the below example the custom object is created with the &lt;strong&gt;new-object&lt;/strong&gt; cmd, a property is then declared (isActive)&amp;nbsp;and given a value that is the returned data set of the &lt;strong&gt;Get-CMDevice&lt;/strong&gt; cmd. Once the invoked PowerShell 3.0 session is completed, we can then declare a variable ($Active), and give it a value of the returned object property. This variable can then be specified as returned data and used at any point in our Orchestrator Runbook.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click image for a better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2703.2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2703.2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;And the Published Data.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8507.567.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/8507.567.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Here is the script in text form for copy and paste purposes.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;$VAR = Powershell {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;$PSD = Get-PSDrive -PSProvider CMSite&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;CD "$($PSD):"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new-object pscustomobject -property @{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; isActive = Get-CMDevice -Name &amp;lt;computerName&amp;gt; | Select IsActive&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;$Active = $VAR.isActive&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Simple Runbook Use&amp;nbsp;/ Example:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;A very simple example of this process in action could be something like the following. You would like to gather a list of Computers from Active Directory, run the Configuration Manager &lt;strong&gt;Get-CMDevice&lt;/strong&gt; CMDLET for each computer determining if the computer is Active or Inactive, and then finally take some sort of action against those that are inactive (send an email in this case). Mind you this is just a very simple example intended&amp;nbsp;to demonstrated the publishing&amp;nbsp;and re-use of CM PowerShell&amp;nbsp;generated data. There is a&amp;nbsp;&lt;strong&gt;TON&lt;/strong&gt; you could do with CM, PowerShell, and Orchestrator together.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;To begin with I've place thee activities in the Runbook, the first being Get Computer from the active directory integration pack, second a Run .NET Script, and third a Send Email activity.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4401.gygy.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4401.gygy.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Get Computer is configured to pull back all servers.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1538.gygygjj.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/1538.gygygjj.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The Run .NET Script is basically executing &lt;strong&gt;Get-CMDevice - Name &amp;lt;Computer Returned from AD&amp;gt; | Select ClinetActiveStatus&lt;/strong&gt;. Also included in the PowerShell is all of the necessary additional items discussed in this blog. I am also publishing the contents of the $Active variable.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click image for a better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4314.bhbh.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4314.bhbh.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5381.nnn.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/5381.nnn.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;On the link between the Run .NET Script activity and the Send Email activity is the following logic - &lt;strong&gt;Active = @{ClientActiveStatus = 0}.&lt;/strong&gt; This is the first use of the published data returned from the PowerShell execution. In this case, the Runbook will only progress onto the Send Email activity for any computer that has been detected as being inactive with the &lt;strong&gt;Get-CMDevice&lt;/strong&gt; CMDLET.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: Calibri;"&gt;Click image for a better view:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4774.lll.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/4774.lll.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;And finally, very simple, I am sending an email which includes the computer name for each computer found as inactive.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2620.emal.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-91-07/2620.emal.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Conclusion:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Well I think I have it this time, or at least making progress. In this blog posting we have extended on simply running Configuration Manager PowerShell cmdlets from an Orchestrator Run .NET Script activity to also passing data from the Configuration Manager PowerShell script onto the Orchestrator data bus. I've given a very simple example here, but make no mistake there is allot of power and automation to be had with the union of Configuration Manager PowerShell CMDLETS and System Center Orchestrator. Hopefully this post has been helpful in getting you on your way to Orchestrator / Configuration Manager PowerShell automation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3545384" width="1" height="1"&gt;</content><author><name>Neil Peterson</name><uri>http://blogs.technet.com/xneilpetersonx_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Configuration Manager" scheme="http://blogs.technet.com/b/neilp/archive/tags/Configuration+Manager/" /><category term="System Center Orchestrator" scheme="http://blogs.technet.com/b/neilp/archive/tags/System+Center+Orchestrator/" /><category term="PowerShell" scheme="http://blogs.technet.com/b/neilp/archive/tags/PowerShell/" /></entry></feed>