<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results for 'app:weblogs' matching tags 'Remoting' and 'guest blogger'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:weblogs&amp;tag=Remoting,guest+blogger&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags 'Remoting' and 'guest blogger'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Enabling Multihop Remoting</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2013/04/04/enabling-multihop-remoting.aspx</link><pubDate>Thu, 04 Apr 2013 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:22592</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;strong style="font-size:12px;"&gt;Summary&lt;/strong&gt;&lt;span style="font-size:12px;"&gt;: Microsoft PowerShell MVPs, Don Jones and Jeffery Hicks, discuss how to enable multihop remoting in Windows PowerShell 3.0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Tonight is our Windows PowerShell User Group meeting in Charlotte, NC, I will be making a presentation about using Windows&amp;nbsp;8 to perform remote management, We will also be doing a Lync meeting with the Philadelphia User Group at the same time. Click the following link to join us online from 7:00 &amp;ndash; 8:00 P.M. Eastern Standard Time: &lt;a href="https://meet.lync.com/phillypowershell/lido/BQJ64C2H" target="_blank"&gt;Charlotte Windows PowerShell User Group meeting&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This week we will not have our usual &lt;strong&gt;PowerTip&lt;/strong&gt;. Instead we have excerpts from seven books from Manning Press. In addition, each blog will have a special code for 50% off the book being excerpted that day. Remember that the code is valid only for the day the excerpt is posted. The coupon code is also valid for a second book from the Manning collection.&lt;/p&gt;
&lt;p class="Body" align="left"&gt;Today, the excerpt is from &lt;a href="http://www.manning.com/jones3/" target="_blank"&gt;Learn Windows PowerShell 3 in a Month of Lunches, Second Edition&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:12px;"&gt;&amp;nbsp; By Don Jones and Jeffery Hicks&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-76-18/0537.hsg_2D00_4_2D00_4_2D00_13_2D00_1.jpg"&gt;&lt;img style="border:0px currentColor;" title="Photo of book cover" src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0537.hsg_2D00_4_2D00_4_2D00_13_2D00_1.jpg" alt="Photo of book cover" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="Body1" align="left"&gt;When you&amp;rsquo;re remoting into a computer, don&amp;rsquo;t run &lt;strong&gt;Enter-PSSession&lt;/strong&gt; from that computer unless you fully understand what you&amp;rsquo;re doing. Let&amp;rsquo;s say you work on Computer A, which runs Windows&amp;nbsp;7, and you remote into Server-R2. At the Windows PowerShell prompt, you run this:&lt;/p&gt;
&lt;p class="Body" style="padding-left:30px;" align="left"&gt;&lt;span style="font-size:12px;"&gt;[server-r2] PS C:\&amp;gt;enter-pssession server-dc4&lt;/span&gt;&lt;/p&gt;
&lt;p class="Body" align="left"&gt;&lt;span&gt;Server-R2 is maintaining an open connection to Server-DC4, which can start to create a &amp;ldquo;remoting chain&amp;rdquo; that&amp;rsquo;s hard to keep track of, and which imposes unnecessary overhead on your servers. You may have times when you might have to do this&amp;mdash;mainly of instances where a computer like Server-DC4 sits behind a firewall and you can&amp;rsquo;t access it directly, so you use Server-R2 as a middleman to hop over to Server-DC4. But, as a general rule, try to avoid remote chaining.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Some people refer to &amp;ldquo;remote chaining&amp;rdquo; as &amp;ldquo;the second hop,&amp;rdquo; and it&amp;rsquo;s a major Windows PowerShell &amp;ldquo;gotcha.&amp;rdquo; We offer a hint: if the Windows PowerShell prompt is displaying a computer name, you&amp;rsquo;re done. You can&amp;rsquo;t issue any more remote control commands until you exit that session and &amp;ldquo;come back&amp;rdquo; to your computer.&lt;/p&gt;
&lt;p class="Body" align="left"&gt;The following drawing depicts the second hop or &amp;ldquo;multihop&amp;rdquo; problem: You start on Computer A, and you create a PSSession connection to Computer B. That&amp;rsquo;s the first hop, and it&amp;rsquo;ll probably work fine. But, then you try to ask Computer B to create a second hop (or connection) to Computer C&amp;mdash;and the operation fails.&lt;/p&gt;
&lt;p class="Body1" align="left"&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0028.hsg_2D00_4_2D00_4_2D00_13_2D00_2.png"&gt;&lt;img style="border:0px currentColor;" title="Image of setup" src="http://blogs.technet.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0028.hsg_2D00_4_2D00_4_2D00_13_2D00_2.png" alt="Image of setup" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="Body1" align="left"&gt;The problem is related to the way Windows PowerShell delegates your credentials from Computer A to Computer B. Delegation is the process of enabling Computer B to execute tasks as if it were you, thus ensuring that you can do anything you&amp;rsquo;d normally have permissions to do&amp;mdash;but nothing more. By default, delegation can only traverse one such &amp;ldquo;hop&amp;rdquo;&amp;mdash;Computer B doesn&amp;rsquo;t have permission to delegate your credentials to a third computer, Computer C.&lt;/p&gt;
&lt;p class="Body" align="left"&gt;In Windows Vista, Windows&amp;nbsp;7, and Windows&amp;nbsp;8, you can enable this multihop delegation. Two steps are needed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On your computer (Computer A in the example), run &lt;strong&gt;Enable-WSManCredSSP &amp;ndash;Role Client &amp;ndash;DelegateComputer &lt;/strong&gt;&lt;strong&gt;x&lt;/strong&gt;. You&amp;rsquo;ll replace x with the name of the computer where your credentials may be delegated. You could specify an individual computer name, but you might also use wildcard characters. We don&amp;rsquo;t recommend using &lt;strong&gt;*&lt;/strong&gt; because that presents some real security concerns, but you might authorize an entire domain, for example: &lt;strong&gt;*.company.com&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the server that you&amp;rsquo;re connecting to first (Computer B in the example), run &lt;strong&gt;Enable-WSManCredSSP &amp;ndash;Role Server&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="Body" align="left"&gt;The changes made by the command will be applied to the computers&amp;rsquo; local security policies; you could also manually make these changes via a Group Policy Object, which might make more sense in a large domain environment. Managing this via Group Policy is beyond the scope of this blog, but you can find more information in the Help for &lt;strong&gt;Enable-WSManCredSSP&lt;/strong&gt;. Don also authored a &lt;a href="http://powershell.com/cs/blogs/donjones/archive/2012/04/20/free-guide-secrets-of-powershell-remoting.aspx" target="_blank"&gt;Secrets of PowerShell Remoting Guide&lt;/a&gt;&amp;nbsp;that covers the policy-related elements in more detail.&lt;/p&gt;
&lt;p class="Body" style="padding-left:30px;" align="left"&gt;&lt;strong&gt;Here is the code for the discount offer today at &lt;/strong&gt;&lt;a href="http://www.manning.com/" target="_blank"&gt;www.manning.com&lt;/a&gt;: &lt;strong&gt;scriptw4&lt;/strong&gt;&lt;br /&gt; Valid for 50% off &lt;a href="http://www.manning.com/jones3/" target="_blank"&gt;Learn Windows PowerShell 3 in a Month of Lunches, Second Edition&lt;/a&gt; and &lt;a href="http://www.manning.com/helmick/" target="_blank"&gt;Learn Windows IIS in a Month of Lunches&lt;br /&gt;&lt;/a&gt;&lt;span style="font-size:12px;"&gt;Offer valid from April 4, 2013 12:01 AM until April 5 midnight (EST)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ed Wilson, Microsoft Scripting Guy&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3562864" width="1" height="1" alt="" /&gt;</description></item><item><title>Digging into PowerShell Remote Authentication   </title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/11/15/digging-into-powershell-remote-authentication.aspx</link><pubDate>Thu, 15 Nov 2012 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:20017</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt; Guest blogger Windows PowerShell MVP Don Jones talks about remote Windows PowerShell authentication.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Today, I have a special treat for you. Windows PowerShell MVP&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/don+jones/"&gt; Don Jones&lt;/a&gt; just had a new book released for publication and we have a sample from that book to share.&lt;/p&gt;
&lt;table style="width:637px;" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6011.PowerShellBook.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6011.PowerShellBook.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;a href="http://www.manning.com/jones3/" target="_blank"&gt;Learn Windows PowerShell 3 in a Month of Lunches, Second Edition&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By Don Jones&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Folks tend to think of authentication as a one-way process: you want to access some remote machine, and you have to provide it with your credentials before it will let you in. But, Windows PowerShell remoting uses mutual authentication. In this article, based on chapter 23 of &lt;/em&gt;&lt;em&gt;&lt;a href="http://www.manning.com/jones3/" target="_blank"&gt;Learn Windows PowerShell 3 in a Month of Lunches, Second Edition&lt;/a&gt;&lt;/em&gt;&lt;em&gt;, author Don Jones goes deeper into remoting authentication.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;&lt;em&gt;&amp;nbsp;&lt;/em&gt;Digging Deeper into Remoting Authentication&lt;/h2&gt;
&lt;p&gt;Windows PowerShell remoting employs mutual authentication, which means the remote machine must also prove its identity to you. In other words, if you run &lt;strong&gt;Enter-PSSession -computerName DC01&lt;/strong&gt;, the computer named DC01 has to prove it&amp;rsquo;s really DC01 before the connection will complete.&lt;/p&gt;
&lt;p&gt;Why? Normally, your computer will resolve a computer name (like DC01) to an IP address by using the Domain Name System (DNS). DNS isn&amp;rsquo;t invulnerable to spoofing, so it&amp;rsquo;s not unthinkable that an attacker could get in and modify the entry for C01 to point to a different IP address&amp;mdash;an IP address that the attacker controls. You could unknowingly connect to DC01, wind up on an imposter computer, and then start delegating your credential to it&amp;mdash;bad news! Mutual authentication prevents that from happening: if the computer you connect to cannot prove it&amp;rsquo;s the one you intended to connect to, then remoting will fail. That&amp;rsquo;s a good thing&amp;mdash;you don&amp;rsquo;t want to turn that protection off without careful planning and consideration.&lt;/p&gt;
&lt;h3&gt;Defaults for mutual authentication&lt;/h3&gt;
&lt;p&gt;Microsoft expects most Windows PowerShell usage to occur in an Active Directory domain environment. Provided you connect to computers by using their real computer names, as listed in Active Directory, the domain will handle the mutual authentication for you.&lt;/p&gt;
&lt;p&gt;This even happens when you access computers in other, trusting domains. The trick is that you need to provide Windows PowerShell with a computer name that will accomplish both of these requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The name must resolve to an IP address.&lt;/li&gt;
&lt;li&gt;The name must match the computer&amp;rsquo;s name in the directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Providing a computer name from the same domain that you&amp;rsquo;re in, or a fully qualified name (computer and domain name, like DC01.COMPANY.LOC) for a trusting domain, usually accomplishes both of these tasks. But if you need to provide an IP address, or if you need to provide a different name for DNS to work (such as a CNAME alias), then the default mutual authentication won&amp;rsquo;t work. That leaves you with two choices: SSL or TrustedHosts.&lt;/p&gt;
&lt;h3&gt;Mutual authentication via SSL&lt;/h3&gt;
&lt;p&gt;For this technique, you&amp;rsquo;ll need to obtain an SSL digital certificate for the destination machine. The certificate must be issued to the same computer name that you&amp;rsquo;ll type to access the computer. That is, if you&amp;rsquo;re running &lt;strong&gt;Enter-PSession &amp;ndash;computerName DC01.COMPANY.LOC -UseSSL -credential COMPANY\Administrator&lt;/strong&gt;, then the certificate installed on DC01 must be issued to &amp;ldquo;dc01.company.loc&amp;rdquo; or the entire process will fail. Note that the &lt;strong&gt;-credential&lt;/strong&gt; parameter is mandatory in this scenario.&lt;/p&gt;
&lt;p&gt;After getting your certificate, you need to install it into the Personal certificate store for the computer account&amp;mdash;something best accomplished with the Certificates snap-in in the Microsoft Management Console (MMC) GUI. Simply double-clicking a certificate file will usually put it in your user account&amp;rsquo;s Personal store, but that won&amp;rsquo;t work.&lt;/p&gt;
&lt;p&gt;With the certificate installed, you&amp;rsquo;ll need to create an HTTPS listener on the computer, telling it to use the newly installed certificate. The step-by-step directions are quite extensive, and because this isn&amp;rsquo;t something a lot of people will probably do, we&amp;rsquo;re not going to cover them all here. Take a look at &lt;a href="http://powershell.com/cs/blogs/donjones/archive/2012/04/20/free-guide-secrets-of-powershell-remoting.aspx" target="_blank"&gt;Don&amp;rsquo;s Secrets of PowerShell Remoting guide&lt;/a&gt; (it&amp;rsquo;s free), and you&amp;rsquo;ll find step-by-step instructions including screenshots.&lt;/p&gt;
&lt;h3&gt;Mutual authentication via TrustedHosts&lt;/h3&gt;
&lt;p&gt;This is a slightly easier technique than using an SSL certificate, and it requires a lot less setup. But it&amp;rsquo;s a bit more dangerous, because it basically shuts off mutual authentication for selected hosts. Before you try it, you need to be able to confidently state, &amp;ldquo;it is unthinkable that someone could impersonate one of these hosts, or hack their DNS records.&amp;rdquo; For internal computers on your intranet, for example, you might feel pretty confident of that.&lt;/p&gt;
&lt;p&gt;Then you just need a way to identify the computers you&amp;rsquo;ll trust without mutual authentication. In a domain, for example, that might be something like &amp;ldquo;*.COMPANY.COM&amp;rdquo; for all hosts in the Company.com domain.&lt;/p&gt;
&lt;p&gt;This is an instance where you&amp;rsquo;re likely going to want to configure the setting for your entire domain, so we&amp;rsquo;ll give you the Group Policy instructions. You can use these same instructions for a single computer&amp;rsquo;s Local Security Policy.&lt;/p&gt;
&lt;p&gt;In any GPO or in the Local Computer Policy editor, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Expand Computer Configuration.&lt;/li&gt;
&lt;li&gt;Expand Administrative Templates.&lt;/li&gt;
&lt;li&gt;Expand Windows Components.&lt;/li&gt;
&lt;li&gt;Expand Windows Remote Management.&lt;/li&gt;
&lt;li&gt;Expand WinRM Client.&lt;/li&gt;
&lt;li&gt;Double-click Trusted Hosts.&lt;/li&gt;
&lt;li&gt;Enable the policy and add your trusted hosts lists. Multiple entries can be separated by commas, such as &amp;ldquo;*.company.com,*.sales.company.com.&amp;rdquo;&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="padding-left:30px;"&gt;&lt;strong&gt;Note&lt;/strong&gt; &amp;nbsp;&amp;nbsp;Older versions of Windows might not have the template needed to display these settings in the Local Computer Policy, and older domain controllers might not have them in their Group Policy Objects. For those situations, you can change the Trusted Hosts list in Windows PowerShell. Run Help about_remote_troubleshooting in the shell for instructions.&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;Now you&amp;rsquo;ll be able to connect to those machines without mutual authentication getting in the way. You must provide a &lt;strong&gt;-Credential&lt;/strong&gt; parameter with all remoting commands used to connect to these computers&amp;mdash;failure to do so will result in a failed connection attempt.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s it for today. Don&amp;#39;s book will be available later this month.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ed Wilson, Microsoft Scripting Guy&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3532087" width="1" height="1" alt="" /&gt;</description></item><item><title>An Introduction to PowerShell Remoting Part Five: Constrained PowerShell Endpoints</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/27/an-introduction-to-powershell-remoting-part-five-constrained-powershell-endpoints.aspx</link><pubDate>Fri, 27 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17945</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest blogger, Jason Hofferle, talks about creating constrained Windows PowerShell endpoints.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Today is the exciting conclusion to Jason Hofferle&amp;rsquo;s excellent series of articles about Windows PowerShell remoting. I think today&amp;rsquo;s article is the most important of the bunch &amp;ndash; because it illustrates a killer security feature. Here is Jason to tell you about creating constrained Windows PowerShell endpoints.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg" alt="Photo of Jason Hofferle" title="Photo of Jason Hofferle" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Jason Hofferle has been an IT professional since 1997. His experience includes enterprise desktop engineering for a Fortune 500 financial institution and Active Directory design for local governments and law enforcement. Jason currently works for the Defense Contract Management Agency, where he implements new technology such as virtual desktop infrastructure. He recently has been speaking about Windows PowerShell at &lt;a href="http://www.sqlsaturday.com/" target="_blank"&gt;SQL Saturday&lt;/a&gt; and &lt;a href="http://itprocamp.com/" target="_blank"&gt;IT Pro Camp&lt;/a&gt; events in Florida, and he frequently attends the &lt;a href="http://powershellgroup.org/tampa.fl" target="_blank"&gt;Tampa PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Blog: &lt;a href="http://www.hofferle.com/" target="_blank"&gt;Force Multiplication through IT Automation&lt;/a&gt;&lt;br /&gt; Twitter: @jhofferle&lt;/p&gt;
&lt;p&gt;In Part Four of this series, &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/26/an-introduction-to-powershell-remoting-part-four-sessions-and-implicit-remoting.aspx" target="_blank"&gt;Sessions and Implicit Remoting&lt;/a&gt;, I talked about PowerShell sessions and implicit remoting, which allows commands to behave like they are being run locally when they are actually being run transparently on a remote system. In the final blog in this series, I&amp;rsquo;m going to discuss constrained endpoints, which allow me to control exactly what cmdlets can be used when I am connected to a remote computer.&lt;/p&gt;
&lt;p&gt;When I use remoting to connect to a computer, I&amp;rsquo;m connecting to an endpoint. The &lt;b&gt;Get-PSSessionConfiguration&lt;/b&gt; cmdlet enables me to view the currently registered endpoints. When I use &lt;b&gt;Set-PSSessionConfiguration&lt;/b&gt; with the &lt;b&gt;ShowSecurityDescriptorUI&lt;/b&gt; parameter, I can view the permissions for an endpoint. The default Windows PowerShell endpoints only allow access to members of the local administrators group. These permissions can be modified, or entirely new endpoints can be created.&lt;/p&gt;
&lt;p&gt;So why would I want to create a new endpoint? It&amp;rsquo;s useful for delegation, because not only can I allow others to connect to that endpoint without granting them administrative rights to the computer, but I can also control precisely what commands they are allowed to run on that endpoint. Each endpoint can have an associated startup script that runs whenever a connection is made to that endpoint. The startup script can be used to automatically run commands, load modules, or constrain the session to limit what it can be used for.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s say I want to grant my Help Desk staff access to run some commands on a server. First I&amp;rsquo;m going to create a startup script that will constrain the session. I start by restricting the session to the point where it&amp;rsquo;s useless, and then expose only what&amp;rsquo;s required for the session to work properly, with the commands that I want my Help Desk to be able to view.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;foreach ($command in Get-Command)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $command.Visibility = &amp;quot;private&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;foreach ($variable in Get-Variable)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $variable.Visibility = &amp;quot;private&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$ExecutionContext.SessionState.Applications.Clear()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$ExecutionContext.SessionState.Scripts.Clear()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$ExecutionContext.SessionState.LanguageMode = &amp;quot;NoLanguage&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$InitialSessionState =&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; [Management.Automation.Runspaces.InitialSessionState]::CreateRestricted(&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;remoteserver&amp;quot;)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;foreach ($proxy in $InitialSessionState.Commands | where { $_.Visibility -eq &amp;quot;Public&amp;quot;})&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $cmdlet = Get-Command -Type cmdlet -ErrorAction silentlycontinue $proxy.name&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($cmdlet)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $alias = Set-Alias &amp;quot;$($proxy.name)&amp;quot; &amp;quot;$($cmdlet.ModuleName)\$($cmdlet.Name)&amp;quot; -PassThru&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $alias.Visibility = &amp;quot;Private&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set-Item &amp;quot;function:global:$($proxy.Name)&amp;quot; $proxy.Definition&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p&gt;In Bruce Payette&amp;rsquo;s book, &lt;i&gt;Windows PowerShell in Action 2&lt;sup&gt;nd&lt;/sup&gt; Edition&lt;/i&gt;, he uses the &lt;b&gt;InitialSessionState&lt;/b&gt; .NET class as an easy way to expose the cmdlets that are required for the session to function correctly. Up to this point, his code is boilerplate that can be used to constrain any endpoint. Now I can start exposing the commands that I want my Help Desk to see. One way to expose certain cmdlets is to change their visibility back to public.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$allowedCmdlets = @(&amp;quot;Get-Date&amp;quot;,&amp;quot;Format-Wide&amp;quot;)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Get-Command | Where-Object {$allowedCmdlets -contains $_.Name} |&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach {$_.Visibility = &amp;quot;Public&amp;quot;}&lt;/p&gt;
&lt;p&gt;If I want to expose an executable or a script, it needs to be added to the endpoint&amp;rsquo;s list of allowed applications, by using a different method.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$ipConfig = (Get-Command ipconfig.exe).Definition&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$ExecutionContext.SessionState.Applications.Add($ipConfig)&lt;/p&gt;
&lt;p&gt;Custom functions can also be defined in the startup script. What&amp;rsquo;s interesting about this is that the staff connecting to this endpoint will have access to the function, but they won&amp;rsquo;t be able to use the cmdlets inside the function.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Function Get-ServerInfo&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $CS = Get-WmiObject -Class Win32_ComputerSystem&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $OS = Get-WmiObject -Class Win32_OperatingSystem&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Printer = Get-WmiObject -Class Win32_Printer&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $MappedLogicalDisk = Get-WmiObject -Class Win32_MappedLogicalDisk&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Result = New-Object PSObject -Property @{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UserName = $CS.UserName&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ComputerName = &amp;quot;$($CS.DNSHostName).$($CS.Domain)&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSArchitecture = $OS.OSArchitecture&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSName = $OS.Caption&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperatingSystemVersion = $OS.Version&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperatingSystemServicePack = &amp;quot;$($OS.ServicePackMajorVersion).$($OS.ServicePackMinorVersion)&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DefaultPrinter = ($Printer | Where-Object {$_.Default}).Name&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TypeOfBoot = $CS.BootupState&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LastReboot = $OS.ConvertToDateTime($OS.LastBootUpTime).ToString()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Drive = $MappedLogicalDisk |&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select-Object @{Name=&amp;#39;Drive Letter&amp;#39;;Expression={$_.DeviceID}},&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @{Name=&amp;#39;Resource Path&amp;#39;;Expression={$_.ProviderName}}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $Result&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p&gt;With my startup script finished, I can use &lt;b&gt;Register-PSSessionConfiguration&lt;/b&gt; to create a new endpoint called &lt;b&gt;HelpDesk&lt;/b&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Register-PSSessionConfiguration &amp;ndash;Name HelpDesk &amp;ndash;StartupScript C:\StartupScript &amp;ndash;Force&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0181.Part5_2D00_1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0181.Part5_2D00_1.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now I can use &lt;b&gt;Set-PSSessionConfiguration&lt;/b&gt; to grant access to my Active Directory group &lt;b&gt;HelpDesk&lt;/b&gt; to allow them to use remoting commands to connect to the endpoint.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Set-PSSessionConfiguration &amp;ndash;Name HelpDesk &amp;ndash;ShowSecurityDescriptorUI &amp;ndash;Force&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8054.Part5_2D00_2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8054.Part5_2D00_2.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now that the PowerShell Remoting endpoint has been constrained with a startup script, my Help Desk staff can access the endpoint, and they&amp;rsquo;ll only see the commands that are available to them.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8420.Part5_2D00_3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8420.Part5_2D00_3.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is also an ideal situation to use implicit remoting because I can provide access to custom functions in a single place, without needing to distribute custom modules and scripts. I can update these commands in a single place. They can be used as if they were local, but I don&amp;rsquo;t have to worry about staff using an old version of a script.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s important to note that PowerShell Remoting is security neutral. My Help Desk now has access to connect to my server; however, they cannot do anything that they couldn&amp;rsquo;t already do. If they don&amp;rsquo;t have rights to delete user accounts, I couldn&amp;rsquo;t provide them access to the &lt;b&gt;Remove-ADUser&lt;/b&gt; cmdlet and expect them to have the capability to remove user accounts. Permission-denied errors will still occur, just as if they were using the Active Directory Users and Computer MMC snap-in.&lt;/p&gt;
&lt;p&gt;The concept of constrained endpoints is used to great effect with Microsoft Office&amp;nbsp;365 and hosted Exchange Server. I have the ability to connect to a common endpoint, which exposes only the commands available for me to manage my mailboxes. This gives me the capability to automate my hosted Exchange Server environment, even though it&amp;rsquo;s completely off my network.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1300.Part5_2D00_4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1300.Part5_2D00_4.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Remoting is truly the killer feature of Windows PowerShell. It&amp;rsquo;s incredibly useful now, and it has lots of future potential. The WSMan framework is a secure and reliable foundation for Microsoft and non-Microsoft software developers, and hardware manufacturers to build their management tools. Remoting can be used to create solutions today, and it will only get more impressive with the release of Windows PowerShell&amp;nbsp;3.0 in Windows&amp;nbsp;8 and Windows Server 2012.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Additional Resources&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://powershell.com/cs/media/p/4908.aspx" target="_blank"&gt;Administrator&amp;rsquo;s Guide to Windows PowerShell Remoting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ravichaganti.com/blog/?page_id=1301" target="_blank"&gt;Layman&amp;rsquo;s Guide to PowerShell 2.0 Remoting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://powershellbooks.com/" target="_blank"&gt;Secrets of PowerShell Remoting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;~Jason&lt;/p&gt;
&lt;p&gt;Thank you, Jason, for an awesome series on remoting. Join us tomorrow for guest blogger, Will Steele.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510000" width="1" height="1" alt="" /&gt;</description></item><item><title>An Introduction to PowerShell Remoting Part Four: Sessions and Implicit Remoting</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/26/an-introduction-to-powershell-remoting-part-four-sessions-and-implicit-remoting.aspx</link><pubDate>Thu, 26 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17936</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest blogger, Jason Hofferle, talks about creating Windows PowerShell sessions and using implicit remoting.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Jason continues to hit home run after home run this week. Today is no exception. He talks about one of the coolest features in Windows PowerShell&amp;mdash;that of implicit remoting. Here is Jason.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg" alt="Photo of Jason Hofferle" title="Photo of Jason Hofferle" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Jason Hofferle has been an IT professional since 1997. His experience includes enterprise desktop engineering for a Fortune 500 financial institution and Active Directory design for local governments and law enforcement. Jason currently works for the Defense Contract Management Agency, where he implements new technology such as virtual desktop infrastructure. He recently has been speaking about Windows PowerShell at &lt;a href="http://www.sqlsaturday.com/" target="_blank"&gt;SQL Saturday&lt;/a&gt; and &lt;a href="http://itprocamp.com/" target="_blank"&gt;IT Pro Camp&lt;/a&gt; events in Florida, and he frequently attends the &lt;a href="http://powershellgroup.org/tampa.fl" target="_blank"&gt;Tampa PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Blog: &lt;a href="http://www.hofferle.com/" target="_blank"&gt;Force Multiplication through IT Automation&lt;/a&gt;&lt;br /&gt; Twitter: @jhofferle&lt;/p&gt;
&lt;p&gt;In Part Three of this series, &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/25/an-introduction-to-powershell-remoting-part-three-interactive-and-fan-out-remoting.aspx" target="_blank"&gt;Interactive and Fan-Out Remoting&lt;/a&gt;, I talked about using &lt;b&gt;Enter-PSSession&lt;/b&gt; and &lt;b&gt;Invoke-Command&lt;/b&gt; to run commands on remote computers. In this post, I&amp;rsquo;m going to get into persistent sessions and using implicit remoting.&lt;/p&gt;
&lt;p&gt;When using the &lt;b&gt;ComputerName&lt;/b&gt; parameter with &lt;b&gt;Invoke-Command&lt;/b&gt;, authentication is completed, the remoting session is established, the command is run, objects are sent back, and the remoting session is torn down. This works fine if there&amp;rsquo;s only a single command that needs to be run. But what if there&amp;rsquo;s a group of computers that need to be managed throughout the day? It&amp;rsquo;s not very efficient to go through all that overhead each time a command is run if you&amp;rsquo;re going to be managing a group of servers constantly. With PowerShell Remoting, we have the concept of sessions.&lt;/p&gt;
&lt;p&gt;A session is a persistent connection with the remote computer. The &lt;b&gt;New-PSSession&lt;/b&gt; cmdlet is used to open a session with one or more computers. Existing sessions can be viewed with the &lt;b&gt;Get-PSSession&lt;/b&gt; cmdlet. By using a variable to reference the sessions I&amp;rsquo;ve created, it&amp;rsquo;s easy to use the &lt;b&gt;Session&lt;/b&gt; parameter instead of the &lt;b&gt;ComputerName&lt;/b&gt; parameter on &lt;b&gt;Invoke-Command&lt;/b&gt;. Now &lt;b&gt;Invoke-Command&lt;/b&gt; will use the existing sessions and avoid the overhead of initializing and tearing down a session each time I run a command.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$session = New-PSSession &amp;ndash;ComputerName DC1,Win7-2&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;Session $session &amp;ndash;ScriptBlock {Get-Process &amp;ndash;Name lsass}&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0312.Part4_2D00_1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0312.Part4_2D00_1.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I can store several sessions in a single variable, and add sessions to this variable later. All the sessions can be created and stored in a variable, and I can run the same command against them easily. This is useful if I need different credentials to access different computers. I can start sessions with different connection options, store them in a single variable, and run commands against them all.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2437.Part4_2D00_2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2437.Part4_2D00_2.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If I need to work interactively with a remote computer, I can use the &lt;b&gt;Session&lt;/b&gt; parameter of &lt;b&gt;Enter-PSSession&lt;/b&gt; to utilize an existing session. I can use array notation to access a specific &lt;b&gt;PSSession&lt;/b&gt; in my &lt;b&gt;$session&lt;/b&gt; variable, or I can pipe the session object of &lt;b&gt;Get-PSSession&lt;/b&gt; to the &lt;b&gt;Enter-PSSession&lt;/b&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-76-18/7343.Part4_2D00_3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7343.Part4_2D00_3.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Sessions also enable a very useful capability called implicit remoting. If I&amp;rsquo;m sitting at my workstation, there may be modules and snap-ins that I&amp;rsquo;ve installed to extend the capabilities in Windows PowerShell. But if I don&amp;rsquo;t happen to be sitting at my own computer or I&amp;rsquo;ve had to rebuild my administration workstation, I might not have those cmdlets available. Wouldn&amp;rsquo;t it be nice if I didn&amp;rsquo;t have to install the Remote Server Administrator Tools (RSAT) when I needed to run the Microsoft Active Directory cmdlets?&lt;/p&gt;
&lt;p&gt;To use implicit remoting, I start a Windows PowerShell session with a computer that already has the modules, snap-ins, or tools I need installed. In this case I want to use the Active Directory cmdlets, so I&amp;rsquo;m connecting to a domain controller. Then I use &lt;b&gt;Invoke-Command&lt;/b&gt; to load the Active Directory module into my Windows PowerShell session on the domain controller. Finally, I use &lt;b&gt;Import-PSSession&lt;/b&gt; with the &lt;b&gt;Module&lt;/b&gt; parameter to automatically generate a local proxy function for the each cmdlet in the module I specified. Now I can use these remote cmdlets as if they were installed locally.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$dcSession = New-PSSession &amp;ndash;ComputerName DC1&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;Session $dcSession &amp;ndash;ScriptBlock {Import-Module ActiveDir*}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Import-PSSession &amp;ndash;Session $dcSession &amp;ndash;Module ActiveDir*&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2605.Part4_2D00_4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2605.Part4_2D00_4.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When I type a local cmdlet, Windows PowerShell calls the local cmdlet. When I type one of these imported cmdlets, Windows PowerShell calls the proxy function that takes care of the remote call for me. Windows PowerShell &amp;ldquo;implicitly&amp;rdquo; uses remoting to make everything appear like it&amp;rsquo;s happening locally. I can open sessions to my domain controller or to my servers running Exchange Server or SQL Server, and I can use Windows PowerShell to manage them all without having any of the management tools installed locally.&lt;/p&gt;
&lt;p&gt;~Jason&lt;/p&gt;
&lt;p&gt;WooHoo. Awesome job, Jason. Thank you for sharing your insights with us. We look forward to the exciting conclusion tomorrow.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509997" width="1" height="1" alt="" /&gt;</description></item><item><title>An Introduction to PowerShell Remoting Part Three: Interactive and Fan-Out Remoting</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/25/an-introduction-to-powershell-remoting-part-three-interactive-and-fan-out-remoting.aspx</link><pubDate>Wed, 25 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17928</guid><dc:creator>Anonymous</dc:creator><description>&lt;p class="CodeBlock"&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest blogger, Jason Hofferle, talks about Windows PowerShell Interactive and fan-out remoting.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. TechReady&amp;nbsp;15 in Seattle has been a great event. I am really enjoying getting to see friends. Of course, I am also really enjoying Jason&amp;rsquo;s series about PowerShell Remoting. As a refresher here is a bit about Jason:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg" alt="Photo of Jason Hofferle" title="Photo of Jason Hofferle" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Jason Hofferle has been an IT professional since 1997. His experience includes enterprise desktop engineering for a Fortune 500 financial institution and Active Directory design for local governments and law enforcement. Jason currently works for the Defense Contract Management Agency, where he implements new technology such as virtual desktop infrastructure. He recently has been speaking about Windows PowerShell at &lt;a href="http://www.sqlsaturday.com/" target="_blank"&gt;SQL Saturday&lt;/a&gt; and &lt;a href="http://itprocamp.com/" target="_blank"&gt;IT Pro Camp&lt;/a&gt; events in Florida, and he frequently attends the &lt;a href="http://powershellgroup.org/tampa.fl" target="_blank"&gt;Tampa PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Blog: &lt;a href="http://www.hofferle.com/" target="_blank"&gt;Force Multiplication through IT Automation&lt;/a&gt;&lt;br /&gt; Twitter: @jhofferle&lt;/p&gt;
&lt;p&gt;In Part Two of this series, &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/24/an-introduction-to-powershell-remoting-part-two-configuring-powershell-remoting.aspx" target="_blank"&gt;Configuring PowerShell Remoting&lt;/a&gt;, I discussed how to configure PowerShell Remoting in your environment. Now we&amp;rsquo;re going to take a look at how it can be used after it&amp;rsquo;s up and running.&lt;/p&gt;
&lt;p&gt;There are two primary PowerShell Remoting usage paradigms for IT professionals: interactive and fan-out. Interactive remoting is used when I need to interact with a remote computer as if I was sitting directly in front of the system, logged into the console. Fan-out remoting is used when I have a single command or script that I want to run on a group of computers. It could be two systems, or two thousand systems. Whenever I need a command to efficiently execute on a large number of systems, fan-out is the way to go.&lt;/p&gt;
&lt;p&gt;To use interactive remoting, or one-to-one, I utilize the &lt;b&gt;Enter-PSSession&lt;/b&gt; cmdlet with the &lt;b&gt;ComputerName&lt;/b&gt; parameter. When my prompt changes to reflect the remote computer&amp;rsquo;s name, I know that I&amp;rsquo;m interacting with the remote system. This is great for performing actions that don&amp;rsquo;t have built-in functionality for performing actions against remote systems, such as registering a dynamic link library (DLL) to correct an issue. When I&amp;rsquo;m finished working on the remote computer, the &lt;b&gt;Exit-PSSession&lt;/b&gt; cmdlet closes the session, and my prompt returns to the local operating system.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Enter-PSSession &amp;ndash;ComputerName DC1&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Set-Location C:\Windows\System32&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Regsvr32.exe .\capiprovider.dll /s&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0537.Part3_2D00_1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0537.Part3_2D00_1.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When I want to use fan-out remoting, or one-to-many, I turn to the &lt;b&gt;Invoke-Command&lt;/b&gt; cmdlet. This time I use a list of computer names for the &lt;b&gt;ComputerName&lt;/b&gt; parameter, and I provide the command that I want them to run for the &lt;b&gt;ScriptBlock&lt;/b&gt; parameter. Because the command executes on the remote computer, tasks such as searching and filtering the event log are performed locally, and only the information I want is sent over the network. When using &lt;b&gt;Invoke-Command&lt;/b&gt;, each returned object has a &lt;b&gt;PSComputerName&lt;/b&gt; parameter added, which enables me to determine which remote computer each object came from.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;ComputerName DC1,Win7,Win7-2 &amp;ndash;ScriptBlock {Get-Service The*}&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/3618.Part3_2D00_2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/3618.Part3_2D00_2.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Typing commands into a script block can be tedious and error prone when it&amp;rsquo;s more than something simple. &lt;b&gt;Invoke-Command&lt;/b&gt; has a &lt;b&gt;FilePath&lt;/b&gt; parameter than can be used when an entire script needs to be executed remotely. Windows PowerShell takes the .ps1 file on the local computer, and converts it into a script block automatically.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8865.Part3_2D00_3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8865.Part3_2D00_3.jpg" alt="Image of menu" title="Image of menu" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;ComputerName DC1,Win7 &amp;ndash;FilePath C:\MyScript.ps1&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6242.Part3_2D00_4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6242.Part3_2D00_4.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PowerShell Remoting can also be used in conjunction with background jobs. The &lt;b&gt;AsJob&lt;/b&gt; parameter of &lt;b&gt;Invoke-Command&lt;/b&gt; allows a long-running PowerShell Remoting command to run in the background, freeing up the Windows PowerShell console for other tasks. When the job has completed, the results can be retrieved with the &lt;b&gt;Receive-Job&lt;/b&gt; cmdlet.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;ComputerName DC1,Win7 &amp;ndash;ScriptBlock {Get-Service WinD*} &amp;ndash;AsJob&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/4544.Part3_2D00_5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/4544.Part3_2D00_5.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PowerShell Remoting is extremely useful in situations where I need to quickly collect information from systems, like performing ad-hoc queries on event logs. During a recent deployment of Windows&amp;nbsp;7, we experienced frequent issues with Outlook losing connectivity with Exchange. It was determined that a specific chip set combined with a particular driver on this particular operating system enabled a power-saving feature on the network adapter. Every time the monitor went into sleep mode, the adapter renegotiated the network speed to the lowest possible value. This disconnected the network for a few seconds, which was enough to cause Outlook to complain. Users would come back from a meeting and find that Outlook wasn&amp;rsquo;t working correctly.&lt;/p&gt;
&lt;p&gt;After the fix was deployed to the Windows&amp;nbsp;7 test group, we needed to prove that the issue had been resolved. I used PowerShell Remoting to collect network disconnection events from our Windows&amp;nbsp;7 systems, exported the results to a comma separated values file, and then used Microsoft Excel to generate a chart showing how the disconnection events significantly dropped after the fix. In a few minutes, I was able to produce hard evidence that we resolved our remaining issue and get the green light for Windows&amp;nbsp;7 deployment.&lt;/p&gt;
&lt;p&gt;~Jason&lt;/p&gt;
&lt;p&gt;Way cool stuff, Jason. Thank you for taking the time to share with us today. We look forward to Part Four tomorrow.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&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=3509962" width="1" height="1" alt="" /&gt;</description></item><item><title>An Introduction to PowerShell Remoting Part Two: Configuring PowerShell Remoting</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/24/an-introduction-to-powershell-remoting-part-two-configuring-powershell-remoting.aspx</link><pubDate>Tue, 24 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17914</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest Blogger, Jason Hofferle, continues his series about PowerShell Remoting.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. This week I am in Seattle, Washington speaking at Microsoft TechReady&amp;nbsp;15. Therefore, we have a series written by guest blogger, Jason Hofferle, about PowerShell Remoting. Here is a little bit about Jason:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5684.JHofferle.jpg" alt="Photo of Jason Hofferle" title="Photo of Jason Hofferle" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Jason Hofferle has been an IT professional since 1997. His experience includes enterprise desktop engineering for a Fortune 500 financial institution and Active Directory design for local governments and law enforcement. Jason currently works for the Defense Contract Management Agency, where he implements new technology such as virtual desktop infrastructure. He recently has been speaking about Windows PowerShell at &lt;a href="http://www.sqlsaturday.com/" target="_blank"&gt;SQL Saturday&lt;/a&gt; and &lt;a href="http://itprocamp.com/" target="_blank"&gt;IT Pro Camp&lt;/a&gt; events in Florida, and he frequently attends the &lt;a href="http://powershellgroup.org/tampa.fl" target="_blank"&gt;Tampa PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Blog: &lt;a href="http://www.hofferle.com/" target="_blank"&gt;Force Multiplication through IT Automation&lt;/a&gt;&lt;br /&gt; Twitter: @jhofferle&lt;/p&gt;
&lt;p&gt;In the first blog post of this series, &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/23/an-introduction-to-powershell-remoting-part-one.aspx" target="_blank"&gt;An Introduction to PowerShell Remoting: Part One&lt;/a&gt;, I took a look at what PowerShell Remoting is and how it takes advantage of the Web Services for Management (WSMan) framework to provide a uniform way to manage remote computers. Maybe after seeing some of the possible performance benefits, you&amp;rsquo;ve decided to at least take a closer look at what&amp;rsquo;s required to get it up and running in your environment. In this post I&amp;rsquo;m going to discuss the requirements and configuration.&lt;/p&gt;
&lt;p&gt;PowerShell Remoting requires that Windows PowerShell&amp;nbsp;2.0 is installed on all computers that are being remotely managed or being used to connect to those remote systems. Windows&amp;nbsp;7 and Windows Server&amp;nbsp;2008&amp;nbsp;R2 include Windows PowerShell&amp;nbsp;2.0 with the operating system. For older operating systems, the Windows Management Framework Core can be downloaded and installed on Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003. The framework includes WinRM&amp;nbsp;2.0 and Windows PowerShell 2.0, and it requires the Common Language Runtime (CLR) 2.0, which is included with the Microsoft .NET Framework&amp;nbsp;2.0 or later.&lt;/p&gt;
&lt;p&gt;Even on operating systems that include the necessary components, PowerShell Remoting is disabled by default, so it needs some configuration before it can be utilized. The WinRM service needs to be running, and a listener has to be configured, which tells the computer to listen for incoming connections. Also, the Windows firewall needs to be configured with rules to allow incoming connections.&lt;/p&gt;
&lt;p&gt;PowerShell Remoting is incredibly simple to configure in a domain environment by using Group Policy. On a server operating system, the Windows Remote Management service is set to start automatically, but on a client operating system, this needs to be configured. Setting services to start automatically can be done at Computer Configuration\Windows Settings\Security Settings\System Services.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2438.Part2_2D00_1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/400x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2438.Part2_2D00_1.jpg" alt="Image of menu" title="Image of menu" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To setup the listener, the &lt;b&gt;Enable Automatic Configuration of Listeners&lt;/b&gt; setting can be configured at Computer Configuration\Administrative Templates\Windows Components\Windows Remote Management (WinRM)\WinRM Service. An IP can be specified for systems that have multiple IP addresses assigned, or asterisks can be used to listen to all addresses.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2821.Part2_2D00_2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/2821.Part2_2D00_2.jpg" alt="Image of menu" title="Image of menu" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The firewall exception can be added at Computer Configuration\Administrative Templates\Network\Network Connections\Windows Firewall\Domain Profile. If there are no Windows&amp;nbsp;XP or Windows Server&amp;nbsp;2003 systems that need to be configured, the firewall exceptions can also be configured through Computer Configuration\Windows Settings\Security Settings\Windows Firewall with Advanced Security\Inbound Rules by using a predefined rule for Windows Remote Management.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5078.Part2_2D00_3.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5078.Part2_2D00_3.jpg" alt="Image of menu" title="Image of menu" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If Group Policy isn&amp;rsquo;t an option, or PowerShell Remoting needs to be configured on an individual basis, the &lt;b&gt;Enable-PSRemoting&lt;/b&gt; cmdlet can be used to perform the tasks of enabling the WinRM service, configuring the listener, and putting firewall rules into place.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1346.Part2_2D00_4.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1346.Part2_2D00_4.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PowerShell Remoting is pretty straightforward to configure when all the computers are joined to the same Active Directory domain and running on the same network. Going beyond the internal corporate network scenario requires some additional configuration depending on the particular situation.&lt;/p&gt;
&lt;p&gt;One of the first issues commonly experienced is the concept of trusted hosts. When I&amp;rsquo;m connecting to a remote computer, I want to verify that computer&amp;rsquo;s identity before passing it my user credentials. When using Kerberos authentication in a domain, Windows PowerShell knows that it can trust the other computer because the domain controller is capable of verifying that system&amp;rsquo;s identity. When not in a domain environment, Windows PowerShell has no way of knowing if the system you&amp;rsquo;re trying to connect to is a malicious system spoofing as a legitimate computer.&lt;/p&gt;
&lt;p&gt;So I either need a way to verify that computer&amp;rsquo;s identity, or bypass the security precaution. By having a certificate installed on the computers from a trusted certification authority (CA), that certificate can be used to verify the system&amp;rsquo;s identity. The alternative is to modify the trusted hosts section of the WinRM configuration to say, &amp;ldquo;I know the identity of this system cannot be verified, but let me connect anyway.&amp;rdquo; Even in a domain environment, trusted hosts may need to be configured if using IP addresses to specify computers. Kerberos protocol will only work with computer names, so Windows PowerShell will default to NTLM authentication any time an IP address is used.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/3666.Part2_2D00_5.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/3666.Part2_2D00_5.jpg" alt="Image of menu" title="Image of menu" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are many WSMan configuration options, and not all of them can be managed with Group Policy. Windows PowerShell provides a WSMan: drive that can be used to view and modify the configuration.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Cd WSMan:\localhost\client&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Set-Item &amp;ndash;Path TrustedHosts &amp;ndash;Value *.testlab.local &amp;ndash;Force&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6758.Part2_2D00_6.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6758.Part2_2D00_6.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Another option for configuring WSMan is the &lt;b&gt;winrm&lt;/b&gt; VBScript. I like using this to view my configuration because it tells me which settings are being configured with a Group Policy Object.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8345.Part2_2D00_7.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8345.Part2_2D00_7.jpg" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are many different ways that PowerShell Remoting can be configured, and beyond the basics, it really depends on the specifics of the environment. Fortunately, there is a wealth of information about these scenarios and more in the &lt;b&gt;about_remote_requirements&lt;/b&gt; and &lt;b&gt;about_remote_troubleshooting&lt;/b&gt; Help files, which provide solutions for dealing with various issues when you are trying to get PowerShell Remoting working.&lt;/p&gt;
&lt;p&gt;~Jason&lt;/p&gt;
&lt;p&gt;Awesome job, Jason. Thank you for sharing your insights with us. We look forward to Part Three tomorrow.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509956" width="1" height="1" alt="" /&gt;</description></item><item><title>An Introduction to PowerShell Remoting: Part One</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/23/an-introduction-to-powershell-remoting-part-one.aspx</link><pubDate>Mon, 23 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17878</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest blogger, Jason Hofferle, talks about the basics of Windows PowerShell remoting.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. This week I am in Seattle, Washington presenting at Microsoft TechReady&amp;nbsp;15. I have been talking to Jason for some time, and I thought that now would be a great chance to share some of his insights with us. This is the first in a series of five blogs by Jason.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7127.JHofferle.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/150x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7127.JHofferle.jpg" alt="Photo of Jason Hofferle" title="Photo of Jason Hofferle" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Jason Hofferle has been an IT professional since 1997. His experience includes enterprise desktop engineering for a Fortune 500 financial institution and Active Directory design for local governments and law enforcement. Jason currently works for the Defense Contract Management Agency, where he implements new technology such as virtual desktop infrastructure. He recently has been speaking about Windows PowerShell at &lt;a href="http://www.sqlsaturday.com/" target="_blank"&gt;SQL Saturday&lt;/a&gt; and &lt;a href="http://itprocamp.com/" target="_blank"&gt;IT Pro Camp&lt;/a&gt; events in Florida, and he frequently attends the &lt;a href="http://powershellgroup.org/tampa.fl" target="_blank"&gt;Tampa PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span&gt;Blog: &lt;a href="http://www.hofferle.com/" target="_blank"&gt;Force Multiplication through IT Automation&lt;/a&gt;&lt;/span&gt;&lt;br /&gt; Twitter: @jhofferle&lt;/p&gt;
&lt;p&gt;As Windows PowerShell enthusiasts go, I might be considered a late adopter. I&amp;rsquo;ve kept tabs on Windows PowerShell since it was called Monad, but it wasn&amp;rsquo;t until it was included with the Windows 7 operating system that I really started using it on a consistent basis. When version 2 was released, it included some game-changing features that convinced me Windows PowerShell was the future. One of these features is PowerShell Remoting, which allows me to run commands on a remote system as if I was sitting in front of it. It provides a consistent framework for managing computers across a network.&lt;/p&gt;
&lt;p&gt;When I start explaining PowerShell Remoting to others, sometimes the initial reaction is, &amp;ldquo;Big deal,&amp;rdquo; because there are already many techniques available for working with remote computers. We have Windows Management Instrumentation (WMI), which is commonly used with VBScript. We have executables from resource kits or non-Microsoft tools that allow remote management, for example, the Sysinternals PSExec tools. Even many of the Windows PowerShell cmdlets have a &lt;b&gt;ComputerName&lt;/b&gt; parameter to specify remote computers. So how does PowerShell Remoting differ from the capabilities we already have? Why should someone go through the trouble of enabling this feature when so many tools are available that don&amp;rsquo;t have a dependency on PowerShell Remoting?&lt;/p&gt;
&lt;p&gt;Many of these methods have their downsides. First of all, there&amp;rsquo;s no consistency between utilities. One command may require parameters with a slash, the next wants a slash with a colon, and many handle quotation marks differently than others. The knowledge gained from learning one tool doesn&amp;rsquo;t transfer to another, so when I need to perform a different administrative task, I need to read through documentation and deal with the quirks of a new utility.&lt;/p&gt;
&lt;p&gt;Another issue is that many use distributed COM (DCOM) or remote procedure call (RPC) to connect to remote systems. This may work well on a single internal network, but it causes problems when these tools need to traverse firewalls or play nice with intrusion prevention or other security systems. I don&amp;rsquo;t know too many firewall administrators who want to open up RPC ports. Finally, existing tools sometimes work differently depending on if a command is being run locally or remotely. I&amp;rsquo;ve had several occasions using WMI with VBScript where something is working perfectly on my local system, but it fails miserably when I try it on a remote computer because that particular application programming interface (API) can only be used locally. Wouldn&amp;rsquo;t it be nice if we could have consistent management commands that worked no matter where they were being run?&lt;/p&gt;
&lt;p&gt;PowerShell Remoting is a solution to some of the security and consistency issues that IT professionals currently work around. It&amp;rsquo;s built on Microsoft&amp;rsquo;s implementation of the Web Services for Management (WSMan) protocol, and it uses the Windows Remote Management (WinRM) service to manage communication and authentication. This framework was designed to be a secure and reliable method for managing computers that&amp;rsquo;s built on well-known standards like Simple Object Access Protocol (SOAP) and Hypertext Transfer Protocol (HTTP).&lt;/p&gt;
&lt;p&gt;Unlike utilities that use various programming interfaces to talk to a remote computer, PowerShell Remoting connects my local Windows PowerShell session with another session running on the remote system. The commands that I enter are sent to the remote computer, executed locally, and then the results are sent back. Because all commands run locally, I don&amp;rsquo;t have to worry about an individual cmdlet lacking the plumbing to work across my network. Everything runs on the same framework, so I only need to learn the Windows PowerShell way of executing remote commands.&lt;/p&gt;
&lt;p&gt;A major advantage over other methods of remote management is that a single port is used for every application that uses WSMan. Instead of poking different holes in a firewall for every application, only the port used by WSMan needs to be configured, and the WinRM service will make sure the traffic gets routed to the correct application.&lt;/p&gt;
&lt;p&gt;There are several authentication methods, including Kerberos protocol and Windows Challenge/Response. The communication between two computers is encrypted at the protocol layer, except when basic access authentication is used, which is intended for use with Hypertext Transfer Protocol Secure (HTTPS) sessions.&lt;/p&gt;
&lt;p&gt;Besides the simplicity of PowerShell Remoting (after it&amp;rsquo;s configured, there is very little to worry about), there are some massive performance benefits when using one-to-many or fan-out remoting. These performance benefits convinced me to start converting some of my VBScript scripts into Windows PowerShell because it saved so much time. With fan-out remoting, I provide Windows PowerShell a list of computers along with the command I want them to run. Windows PowerShell &amp;ldquo;fans-out&amp;rdquo; and sends the command to the remote computers in parallel. Each remote system runs the command locally and sends the results back. This is different from the common VBScript technique of using a &lt;b&gt;foreach&lt;/b&gt; loop to perform operations against a list of computers, one at a time.&lt;/p&gt;
&lt;p&gt;When talking about PowerShell Remoting at a conference or similar event, it&amp;rsquo;s difficult to demonstrate the benefits because fan-out doesn&amp;rsquo;t really reach its potential until I throw hundreds or thousands of computers at it. It sounds powerful on paper, but I needed some real-world numbers to help communicate the effectiveness. I also needed some data to convince my own organization, so I performed some tests that would help articulate how powerful this feature can be.&lt;/p&gt;
&lt;p&gt;A scenario where I commonly use PowerShell Remoting is when I need to query a large number of computers for a specific event. For my performance testing, I decided to search the security event log for the last twenty log-on events. To get baseline data without using PowerShell Remoting, I stored a list of computer names in a &lt;b&gt;$Computers&lt;/b&gt; variable and piped it to a loop.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$Computers | foreach { Get-WinEvent &amp;ndash;FilterHashTable @{logname=&amp;rdquo;security&amp;rdquo;;id=4624} &amp;ndash;MaxEvents 20 &amp;ndash;ComputerName $_ }&lt;/p&gt;
&lt;p&gt;For the comparison, I used the same &lt;b&gt;Get-WinEvent&lt;/b&gt; cmdlet, but in conjunction with &lt;b&gt;Invoke-Command&lt;/b&gt;, which is a PoweShell Remoting command. &lt;b&gt;Invoke-Command&lt;/b&gt; takes my list of computer names and tells them to run the command specified in the script block. The &lt;b&gt;ThrottleLimit&lt;/b&gt; parameter is telling Windows PowerShell to connect to 50 computers simultaneously.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;ComputerName $Computers &amp;ndash;ScriptBlock { Get-WinEvent &amp;ndash;FilterHashTable @{logname=&amp;rdquo;security&amp;rdquo;;id=4624} &amp;ndash;MaxEvents 20 } &amp;ndash;ThrottleLimit 50&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8802.Part1_2D00_1.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8802.Part1_2D00_1.jpg" alt="Image of results" title="Image of results" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By using a &lt;b&gt;foreach&lt;/b&gt; loop, similar to how it might be done with VBscript or without PowerShell Remoting, it took over six hours to complete the operation against 100 computers. By using PowerShell Remoting, it took 15 seconds. This is a real-world situation on a production network against Windows 7 computers that were multiple wide area network (WAN) hops away in many cases. By using this same command, I increased the number of computers to see how well it scaled.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6562.Part1_2D00_2.jpg"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/6562.Part1_2D00_2.jpg" alt="Image of results" title="Image of results" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With PowerShell Remoting, I can retrieve the last twenty log-on events from the local security log on 1000 workstations in a little over two minutes.&lt;/p&gt;
&lt;p&gt;PowerShell Remoting is the killer feature in Windows PowerShell. When it&amp;rsquo;s configured in an environment, it provides a transparent and efficient framework for managing computers. It has saved me countless hours and simplified many daily tasks. No matter what type of environment you have, PowerShell Remoting is worth checking out.&lt;/p&gt;
&lt;p&gt;~Jason&lt;/p&gt;
&lt;p&gt;Thank you, Jason, for an excellent blog. We look forward to Part Two tomorrow.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&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=3509789" width="1" height="1" alt="" /&gt;</description></item><item><title>Updating Group Policy on a Dark and Stormy Night</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/08/17/updating-group-policy-on-a-dark-and-stormy-night.aspx</link><pubDate>Wed, 17 Aug 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:11872</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Guest Blogger Jason Helmick talks about updating an Enterprise GPO on a dark and stormy night using Windows PowerShell.&lt;/p&gt;
&lt;p class="CodeBlock"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="CodeBlock"&gt;Microsoft Scripting Guy Ed Wilson is here. Guest Blogger Week continues today with Jason Helmick as our guest.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;b&gt;About the author&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Jason Helmick is an Instructor at Interface Technical Training and specializes in Windows PowerShell. Jason and Mike Pfeiffer are the founders and hosts of the &lt;a href="http://www.azposh.com/"&gt;Arizona PowerShell User Group&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can find Jason at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Blog: &lt;a title="jasonhelmick.com" href="http://www.jasonhelmick.com"&gt;jasonhelmick.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Twitter: @theJasonHelmick&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;b&gt;An enterprise GPO update on a dark and stormy night&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It was a dark and stormy night in the data center. The rain fell in clumps, pounding the roof. &amp;quot;I hope those roof tiles hold tonight.&amp;quot; I spoke out loud as I often do. I received the response I expected: a loud CLAP of thunder and more rain.&lt;/p&gt;
&lt;p&gt;&amp;quot;I need to get these web servers deployed before morning!&amp;quot; The day was not a good one, filled with one emergency after another. I normally do not mind. The junior administrator staff normally handles the fires, but today was different.&lt;/p&gt;
&lt;p&gt;It started at noon with the boss walking into my office. He sat down heavily in the chair I save for honored guests, the one next to the candy bowl. He is in the wrong chair again. He looked up and spoke: &amp;quot;Jason I need a new deployment of web servers on the middle tier by morning. The junior guys are racking the boxes and getting a base operating system deployed. I need 24 new web boxes or the new product launch fails. The developers tell me they can test and launch the site in the morning, but they don&amp;#39;t think your department will be ready.&amp;quot;&lt;/p&gt;
&lt;p&gt;I was watching his right hand as he spoke. He usually manages to steal some of my candy, the candy I put there for special guests. I raised my eyes and smiled. &amp;quot;No problem.&amp;quot; He stood with a start, &amp;quot;Good, then I&amp;#39;ll see you at the launch in the morning!&amp;quot; With a gruff turn, he left. The rain was beginning to pound the roof harder.&lt;/p&gt;
&lt;p&gt;I rose and closed the door to my office. No need to let my secrets slip out to the other IT admins. This was going to be a job for PowerShell Man. &amp;quot;This is going to be easy!&amp;quot; I again said out loud. &amp;quot;I&amp;#39;ll grab the computer names from Active Directory, build a PowerShell remote session to them, and then load and run the ServerManager cmdlets to install the web servers. Easy!&amp;quot;&lt;/p&gt;
&lt;p&gt;All I need to do is type&amp;mdash;SCREAM! LOUD CRASH! &amp;quot;Help! The roof is leaking all over my Windows 7 PC!&amp;quot; The shrill of her voice made my spine freeze. Alice needed my help quickly, so I had better get this problem solved fast.&lt;/p&gt;
&lt;p&gt;All I need to do is start by importing the Active Directory module. I&amp;rsquo;m running Windows Server 2008 R2, so I just installed the RSAT-ADDS tools with ServerManagerCMD &lt;b&gt;&amp;ndash;I RSAT-ADDS&lt;/b&gt;, but I keep a &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/25/hey-scripting-guy-january-25-2010.aspx"&gt;great article around in case I need them on a Windows 7&lt;/a&gt; computer.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Import-Module ActiveDirectory&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;New-PsSession -computername (Get-ADcomputer -filter {name -like Web*} | Select-Object -ExpandProperty name)&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-76-18/5165.HSG_2D00_8_2D00_17_2D00_11_2D00_2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5165.HSG_2D00_8_2D00_17_2D00_11_2D00_2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;Dang!&amp;quot; THUNDER CLAP! &amp;quot;Remoting is not enabled on the new web servers!&amp;quot;&lt;/p&gt;
&lt;p&gt;Yes, I like the Don Jones idea of coloring my errors green. It makes the errors seem less repulsive and more inviting. You can add this line to your profile to do the same.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$host.PrivateData.ErrorForegroundColor = &amp;quot;green&amp;quot;&lt;/p&gt;
&lt;p&gt;I made a quick phone call to the junior administrators, also known as &amp;ldquo;the screw driver crew.&amp;rdquo; No one answered. There was no one to run out to the servers and enable Windows PowerShell remoting.&lt;/p&gt;
&lt;p&gt;YELLING: &amp;ldquo;Someone help me, water is pouring all over my desk!&amp;rdquo; I needed to rescue Alice, but I also just needed to get this done!&lt;/p&gt;
&lt;p&gt;I can create a GPO for the servers that enables Windows PowerShell remoting! Now where is that &lt;a href="http://blog.powershell.no/2010/03/04/enable-and-configure-windows-powershell-remoting-using-group-policy/"&gt;darn link that describes the GPO settings?&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-76-18/8750.HSG_2D00_8_2D00_17_2D00_11_2D00_3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8750.HSG_2D00_8_2D00_17_2D00_11_2D00_3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I quickly added the remoting and script execution GPO for the web servers. Using the &lt;a href="http://blog.powershell.no/2010/03/04/enable-and-configure-windows-powershell-remoting-using-group-policy/"&gt;GPO article&lt;/a&gt;, I modified the following keys:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I enable &amp;ldquo;Allow automatic configuration of listeners,&amp;rdquo; and set IPv4 and IPv6 to &amp;ldquo;*&amp;rdquo;. The key can be found at the following location:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Computer Configuration\Policies\Administrative templates\Windows Components\Windows Remote Management\WinRM Server&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;I also wanted to enable script execution in case I need it later. I enabled &amp;ldquo;Turn on Script Execution&amp;rdquo; and set the policy setting to &amp;ldquo;Allow only signed scripts&amp;rdquo;. I always sign my scripts to be the most secured. The key can be found at the following location:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Computer Configuration\Policies\Administrative templates\Windows Components\Windows PowerShell\&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;In addition, I wanted to set the WinRM service to start automatically, so I set the Windows Remote Management service to &amp;ldquo;Automatic&amp;rdquo; at this key:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Computer Configuration\Policies\Windows Settings\Security Settings\System Services\&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;Last, if I had Windows Firewall running on those computers, I would need an Inbound Rule because WinRM listens on port 5985. Again, I checked &lt;a href="http://blog.powershell.no/2010/03/04/enable-and-configure-windows-powershell-remoting-using-group-policy/"&gt;this article to get it right&lt;/a&gt;. The key can be found at the following location:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Computer Configuration\Policies\Windows Settings\Windows Firewall with Advanced Security\&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It took me about a minute to set the GPOs, but it would take time for the servers to update the policy&amp;mdash;too much time. Alice was in bad shape. Like a sinking ship, she was up to her wheelhouse.&lt;/p&gt;
&lt;p&gt;I knew I could restart all the servers with a Windows PowerShell cmdlet, but that is crazy. I just needed to update the policy! LOUD THUNDER CLAP! Gently, I felt a cool touch and a slight whisper in my left ear. The message wasn&amp;rsquo;t clear so I responded to the haunting voice: &amp;ldquo;Go to the Bonsai tree in my forest?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;LOUD THUNDER CLAP!&lt;/p&gt;
&lt;p&gt;&amp;ldquo;No, you fool. Do you have BSonPoSH cmdlets for your Active Directory forest!?&amp;rdquo; Ah, it was The Scripting Guy, Ed Wilson! &amp;ldquo;Hey Scripting Guy, I don&amp;rsquo;t have the BSonPoSH cmdlets!&amp;rdquo; He responded with a gruff grumble, something about me not checking his blog on a regular basis, and then magically on my screen &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/19/use-the-bsonposh-powershell-module-to-simplify-ad-tasks.aspx"&gt;the URL appeared&lt;/a&gt;. &amp;ldquo;Go there and install them.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Astonished at his power over my computer screen, I gasped, &amp;ldquo;But how is that going to help me, Scripting Guy?!&amp;rdquo; I could tell there was a slight pause of exacerbation before he responded.&lt;/p&gt;
&lt;p&gt;&amp;ldquo;&lt;b&gt;Get-Help&lt;/b&gt; and &lt;b&gt;Get-Command&lt;/b&gt; shall lead you to the solution.&amp;rdquo; I quickly installed the cmdlets, imported the module (&lt;b&gt;Import-Module BSonPosh&lt;/b&gt;) and typed &lt;b&gt;Get-Help GPO&lt;/b&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-76-18/5857.HSG_2D00_8_2D00_17_2D00_11_2D00_4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5857.HSG_2D00_8_2D00_17_2D00_11_2D00_4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s it! That&amp;rsquo;s the cmdlet I needed! A quick look at the full help for the cmdlet showed me that &lt;b&gt;&amp;ndash;computername&lt;/b&gt; expected string input and could be piped to both &lt;b&gt;ByValue&lt;/b&gt; and &lt;b&gt;ByPropertyName&lt;/b&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8306.HSG_2D00_8_2D00_17_2D00_11_2D00_5.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8306.HSG_2D00_8_2D00_17_2D00_11_2D00_5.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SCREAM! &amp;ldquo;I&amp;rsquo;m going to drown!&amp;rdquo; GURGLE!&lt;/p&gt;
&lt;p&gt;I started to stand up and race from the office to save Alice, but, just needed to type one more thing. I imported the modules for &lt;b&gt;ActiveDirectory&lt;/b&gt; and &lt;b&gt;BSonPosh&lt;/b&gt;, and then updated the policies with the &lt;b&gt;Update-GPO&lt;/b&gt; cmdlet:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Import-Module ActiveDirectory&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Import-Module BSonPosh&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Get-ADComputer &amp;ndash;filter {name &amp;ndash;like &amp;lsquo;web*&amp;rsquo;} | Select-Object &amp;ndash;ExpandProperty name | Update-GPO&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5483.HSG_2D00_8_2D00_17_2D00_11_2D00_6.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5483.HSG_2D00_8_2D00_17_2D00_11_2D00_6.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Without wasting anymore of Alice&amp;rsquo;s life than I needed to, I finished with a quick Windows PowerShell remote session installation of a web server.&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$Session=New-PSSession &amp;ndash;computername (Get-ADComputer &amp;ndash;filter {name &amp;ndash;like &amp;lsquo;Web*&amp;rsquo;} | Select-Object &amp;ndash;ExpandProperty name)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;Session $session {Import-Module ServerManager}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Invoke-Command &amp;ndash;Session $ssesion {Add-WindowsFeature Web-Server}&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0268.HSG_2D00_8_2D00_17_2D00_11_2D00_7.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0268.HSG_2D00_8_2D00_17_2D00_11_2D00_7.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Done!&lt;/p&gt;
&lt;p&gt;I ran to Alice&amp;rsquo;s cube and reached into the murky water. I felt a hand and then a Windows 7 PC. I lifted them both to safety. As I escorted Alice from the building a gentle whisper returned to my left ear.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Well done. Remember that the Scripting Community has many resources. Spend your time there.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;I sank back into my office chair closing up for the night.&amp;nbsp;&amp;ldquo;Hey Scripting Guy? Want some candy before you go?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;And with a squeak of the chair opposite me, I knew my Active Directory management experience was just beginning. So many wonderful cmdlets: those by Microsoft, Quest, and of course BSonPoSH can help me manage a better Active Directory and network. The storms cleared and the rain stopped. In the morning, my boss came into the office again and sat in the wrong chair.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;I see you deployed the web servers. Must have taken you all night. Good job.&amp;rdquo; At that moment, he sneaked a candy, the ones I reserve for special guests.&lt;/p&gt;
&lt;p class="CodeBlock"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="CodeBlock"&gt;I want to thank Jason for writing both an entertaining and informative guest article. Join us tomorrow as Guest Blogger Week continues with Thiyagu and part 1 of a two-part blog post about Exchange message headers.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&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=3446067" width="1" height="1" alt="" /&gt;</description></item><item><title>Use PowerShell Invoke-Command for Remoting</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/06/13/use-powershell-invoke-command-for-remoting.aspx</link><pubDate>Mon, 13 Jun 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10822</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Microsoft Windows PowerShell MVP, Don Jones, talks about using the Invoke-Command cmdlet for remoting.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, here. I am really excited about the idea I had for this week, and I hope you will be too. I asked Candace Gillhoolley at Manning Press about posting some sample works from some of the Manning Press library of books. She responded enthusiastically and shared five samples that we will post this week. Today we present Don Jones&amp;rsquo; &lt;i&gt;Learn Windows PowerShell in a Month of Lunches&lt;/i&gt;.&lt;/p&gt;
&lt;h1&gt;&lt;b&gt;&lt;a target="_blank" href="http://www.manning.com/jones/"&gt;Learn Windows PowerShell in a Month of Lunches&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/3583.HSG_2D00_6_2D00_13_2D00_11_2D00_1_5F00_32FF8250.jpg"&gt;&lt;img height="193" width="149" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/4760.HSG_2D00_6_2D00_13_2D00_11_2D00_1_5F00_thumb_5F00_52AE5C18.jpg" alt="HSG-6-13-11-1" border="0" title="HSG-6-13-11-1" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By Don Jones&lt;/p&gt;
&lt;p&gt;One of the coolest things in Windows PowerShell is to send a command to multiple remote computers at the same time. In this article, based on chapter 10 of &lt;a target="_blank" href="http://www.manning.com/jones/"&gt;&lt;i&gt;Learn Windows PowerShell in a Month of Lunches&lt;/i&gt;&lt;/a&gt;, author Don Jones explains how to use the &lt;b&gt;Invoke-Command&lt;/b&gt; cmdlet to execute one-to-many, or 1:n, remoting. To save 35% on your next purchase, use Promotional Code &lt;strong&gt;jones1035&lt;/strong&gt; when you check out at &lt;a target="_blank"&gt;www.manning.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/5417.manning_5F00_534AC468.png"&gt;&lt;img height="26" width="154" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/8535.manning_5F00_thumb_5F00_7A18DAA8.png" alt="manning" border="0" title="manning" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border-width:0px;" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;h2&gt;&lt;b&gt;Using Invoke-Command for Remoting&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;The trick I will show you in this article&amp;mdash;and one of the coolest things in Windows PowerShell&amp;mdash;is to send a command to &lt;i&gt;multiple remote computers at the same time. &lt;/i&gt;That&amp;rsquo;s right, full-scale distributed computing. Each computer will independently execute the command and send the results right back to you. It&amp;rsquo;s all done with: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Invoke-Command -computername Server-R2,Server-DC4,Server12 &lt;br /&gt;[ CA]-command { Get-EventLog Security -newest 200 |&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;[ CA]Where { $_.EventID -eq 1212 }}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Try it now&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Go ahead and run this command. Substitute the name of your remote computer (or computers) where I&amp;rsquo;ve put my three computer names.&lt;/p&gt;
&lt;p&gt;Everything in those outermost {braces} will get transmitted to the remote computers&amp;mdash;all three of them. By default, PowerShell will talk to up to 32 computers at once; if you specified more than that, it will queue them up, so that, as one computer completes, the next one in line will begin. If you have a really awesome network and powerful computers, you could raise that number by specifying the &lt;strong&gt;-throttleLimit&lt;/strong&gt; parameter of &lt;strong&gt;Invoke-Command&lt;/strong&gt;&amp;mdash;read the command&amp;rsquo;s help for more information.&lt;/p&gt;
&lt;h3&gt;&lt;b&gt;Be careful about the punctuation&lt;/b&gt;&lt;/h3&gt;
&lt;p&gt;We need to pause for a moment and really dig into that example command because this is a case where Windows PowerShell&amp;rsquo;s punctuation can get confusing, and that confusion can make you do the wrong thing when you start constructing these command lines on your own. There are two commands in that example which use curly braces: &lt;strong&gt;Invoke-Command&lt;/strong&gt; and Where (which is an alias for &lt;strong&gt;Where-Object&lt;/strong&gt;). Where is entirely nested within the outer set of braces. The outermost set of braces enclose everything that is being sent to the remote computers for execution; that includes:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class="CodeinText" style="line-height:normal;list-style-type:disc;"&gt;&lt;span style="mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Get-EventLog Security -newest 200 | Where { $_.EventID -eq 1212 }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I should tell you that you won&amp;rsquo;t see the &lt;strong&gt;-command&lt;/strong&gt; parameter in the Help for &lt;strong&gt;Invoke-Command&lt;/strong&gt;&amp;mdash;yet, the command I just showed you will work fine. The &lt;strong&gt;-command&lt;/strong&gt; parameter is actually an &lt;i&gt;alias, &lt;/i&gt;or nickname, for the &lt;strong&gt;-scriptblock&lt;/strong&gt; parameter that you &lt;i&gt;will&lt;/i&gt; see listed in the Help. I just have an easier time remembering &lt;strong&gt;-command&lt;/strong&gt;, so I tend to use it instead of &lt;strong&gt;-scriptblock&lt;/strong&gt;&amp;mdash;but they both work the same way.&lt;/p&gt;
&lt;p&gt;If you read the help for &lt;strong&gt;Invoke-Command&lt;/strong&gt; carefully (see how I&amp;rsquo;m continuing to push those help files?), then you&amp;rsquo;ll also notice a parameter that lets you specify a script file, rather than a command. That parameter lets you send an entire script to the remote computers&amp;mdash;meaning, you can automate some pretty complex tasks and have each computer do its own share of the work.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Try it now&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Make sure you can identify the &lt;strong&gt;-scriptblock&lt;/strong&gt; parameter in the help for Invoke-Command and that you can spot the parameter that would enable you to specify the file path and name instead of a scriptblock.&lt;/p&gt;
&lt;p&gt;I want to circle back to the &lt;strong&gt;-computername&lt;/strong&gt; parameter for just a bit. When I first used &lt;strong&gt;Invoke-Command&lt;/strong&gt;, I typed a comma-separated list of computer names, just as I did in the example above. But I have a &lt;i&gt;lot&lt;/i&gt; of computers I work with, so I didn&amp;rsquo;t want to have to type them all in every time. I actually keep text files for some of my common computer categories, like Web servers and domain controllers. Each text file contains one computer name per line, and that&amp;rsquo;s it&amp;mdash;no commas, no quotes, no nothing. Windows PowerShell makes it really easy for me to use those files:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Invoke-Command -command { dir } &lt;br /&gt;[ CA]-computerName (Get-Content webservers.txt)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The parentheses there force Windows PowerShell to execute &lt;strong&gt;Get-Content&lt;/strong&gt; first&amp;mdash;pretty much the same way parentheses work in math. The results of &lt;strong&gt;Get-Content&lt;/strong&gt; are then stuck into the &lt;strong&gt;-computerName&lt;/strong&gt; parameter, which then works against each of the computers that were listed in the file.&lt;/p&gt;
&lt;p&gt;I also sometimes want to query computer names from Active Directory. This is a bit trickier. I can use the &lt;strong&gt;Get-ADComputer&lt;/strong&gt; command (from the ActiveDirectory module in Windows Server 2008 R2) to retrieve computers, but I can&amp;rsquo;t just stick that command in parentheses like I did with &lt;strong&gt;Get-Content&lt;/strong&gt;. Why not? Because &lt;strong&gt;Get-Content&lt;/strong&gt; is just producing simple strings of text, which &lt;strong&gt;-computername&lt;/strong&gt; is expecting. &lt;strong&gt;Get-ADComputer&lt;/strong&gt;, on the other hand, is producing entire computer objects, and the &lt;strong&gt;-computername&lt;/strong&gt; parameter won&amp;rsquo;t know what to do with them. So if I want to use &lt;strong&gt;Get-ADComputer&lt;/strong&gt;, I need to find a way to &lt;i&gt;just&lt;/i&gt; get the &lt;i&gt;values&lt;/i&gt; from those computer objects&amp;rsquo; Name properties. Here&amp;rsquo;s how:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Invoke-Command -command { dir } -computerName (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;[ CA]Get-ADComputer -filter * -searchBase &amp;quot;ou=Sales,dc=company,dc=pri&amp;quot; |&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Code" style="line-height:normal;list-style-type:disc;margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;[ CA]Select-Object -expand Name )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Try it now&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re running Windows PowerShell on a Windows Server 2008 R2 domain controller or on a Windows 7 computer that has the Remote Server Administration Toolkit installed, then you can run &lt;strong&gt;Import-Module&lt;/strong&gt; &lt;strong&gt;ActiveDirectory&lt;/strong&gt; and then try the above command. If your test domain doesn&amp;rsquo;t have a Sales OU that contains a computer account, then change ou=Sales to ou=Domain Controllers and be sure to change company and pri to the appropriate values for your domain. (For example, if your domain is mycompany.org, you would substitute mycompany for company and org for pri.)&lt;/p&gt;
&lt;p&gt;Within the parentheses, I&amp;rsquo;ve piped the computer objects to &lt;strong&gt;Select-Object&lt;/strong&gt;, and I&amp;rsquo;ve used their -expand parameter. I&amp;rsquo;m telling it to expand the &lt;strong&gt;Name&lt;/strong&gt; property of whatever came in&amp;mdash;in this case, those computer objects. So, the result of that entire parenthetical expression will be a bunch of computer names, not computer objects&amp;mdash;and computer names are exactly what the &lt;strong&gt;-computername&lt;/strong&gt; parameter wants to see.&lt;/p&gt;
&lt;p&gt;By the way, just to be complete, I should mention that the -filter parameter of &lt;strong&gt;Get-ADComputer&lt;/strong&gt; specifies that all computers should be included in the command&amp;rsquo;s output. The &lt;strong&gt;-searchBase&lt;/strong&gt; parameter tells the command to start looking for computers in the specified location&amp;mdash;in this case, the Sales OU of the company.pri domain. The &lt;strong&gt;Get-ADComputer&lt;/strong&gt; command is only available on Windows Server 2008 R2 and on Windows 7 after installing the Remote Administration Server Toolkit (RSAT). On those operating systems, you have to run &lt;strong&gt;Import-Module ActiveDirectory&lt;/strong&gt; to actually load the Active Directory cmdlets into the shell so that they can be used.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;Ideas for on your own&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;One of the Windows PowerShell modules included in Windows 7 is Troubleshooting Pack, which provides command-line access to the new troubleshooting pack functionality in the operating system. I always tell my students and clients to consider enabling Windows PowerShell remoting on all of their client computers, in part because it gives you remote command-line access to those troubleshooting packs. When a user calls for help, rather than walking them through a wizard over the phone, you can just remote in and run the same wizard, in command-line form rather than GUI form, yourself.&lt;/p&gt;
&lt;p&gt;Guest Writer&amp;rsquo;s Week will continue tomorrow when we will have a post from Richard Siddaway.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a target="_blank" href="http://bit.ly/scriptingguystwitter"&gt;Twitter&lt;/a&gt; and &lt;a target="_blank" href="http://bit.ly/scriptingguysfacebook"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a target="_blank" href="http://bit.ly/scriptingforum"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3434183" width="1" height="1" alt="" /&gt;</description></item></channel></rss>