<?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 'Getting Started', 'Windows PowerShell', and 'computer accounts'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:weblogs&amp;tag=Getting+Started,Windows+PowerShell,computer+accounts&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags 'Getting Started', 'Windows PowerShell', and 'computer accounts'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Keep Your PowerShell Versions Straight and Avoid Errors</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/03/04/keep-your-powershell-versions-straight-and-avoid-errors.aspx</link><pubDate>Sun, 04 Mar 2012 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:15084</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Learn how to keep your Windows PowerShell versions straight, and avoid errors while using a one-line command to add computers to domain.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Earlier this week I wrote &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/29/use-powershell-to-replace-netdom-commands-to-join-the-domain.aspx" target="_blank"&gt;Use PowerShell to Replace netdom Commands to Join the Domain&lt;/a&gt;&lt;i&gt;. &lt;/i&gt;It turned out to be a very popular post. To be honest, however, when I started writing that blog, I intended to show that it could be done as a one-liner. This is because I have been using Windows Server &amp;ldquo;8&amp;rdquo; Beta for long time now, and I was used to some of the new parameters in the &lt;b&gt;Add-Computer &lt;/b&gt;cmdlet.&lt;/p&gt;
&lt;p&gt;But I will predict that for the next several months, things are going to be a bit squirrely as people attempt to balance working with Windows PowerShell&amp;nbsp;2.0 with the various iterations of Windows PowerShell&amp;nbsp;3.0. It happened in the transition between Windows PowerShell&amp;nbsp;1.0 to Windows PowerShell&amp;nbsp;2.0, and I am sure it will happen again this time around.&lt;/p&gt;
&lt;p&gt;To be sure, Windows PowerShell&amp;nbsp;3.0 in &lt;a href="http://www.microsoft.com/en-us/server-cloud/windows-server/v8-default.aspx" target="_blank"&gt;Windows Server &amp;quot;8&amp;quot; Beta&lt;/a&gt; brings much goodness to the table, and it also simplifies syntax in a great many areas. Don&amp;rsquo;t panic, though. If you don&amp;rsquo;t know if something you wrote in Windows PowerShell&amp;nbsp;3.0 will work in Windows PowerShell&amp;nbsp;2.0, just go ahead and add the &lt;b&gt;Requires&lt;/b&gt;&lt;i&gt; &lt;/i&gt;statement to your script, and you will be safe. The use of the &lt;b&gt;Requires&lt;/b&gt;&lt;i&gt; &lt;/i&gt;statement is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;#Requires -version 3.0&lt;/p&gt;
&lt;p&gt;Yep, you are seeing that right; it is preceded with a pound character (the normal comment character). When I attempt to run a script that uses new functionality, and I know that the new functionality only resides in a specific version of Windows PowerShell, I add the &lt;b&gt;Requires&lt;/b&gt;&lt;i&gt; &lt;/i&gt;statement to the first line in the script. When the script runs on a down-level system, a message displays. The use of the &lt;b&gt;Requires&lt;/b&gt;&lt;i&gt; &lt;/i&gt;statement, and the accompanying message are shown in the image that follows.&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/1651.hsg_2D00_3_2D00_4_2D00_12_2D00_01.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1651.hsg_2D00_3_2D00_4_2D00_12_2D00_01.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Keep in mind that the &lt;b&gt;Requires&lt;/b&gt;&lt;i&gt; &lt;/i&gt;statement only works in scripts, not in functions, cmdlets, or snap-ins. In addition, when developing in the Windows PowerShell ISE, if the script is not saved, it is not considered a script. Therefore, it will not work. In the image that follows, an error appears stating that a &lt;i&gt;ComputerName &lt;/i&gt;parameter cannot be found, instead of the version information that was presented in the previous image.&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/0601.hsg_2D00_3_2D00_4_2D00_12_2D00_02.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/0601.hsg_2D00_3_2D00_4_2D00_12_2D00_02.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Removing a computer from the domain in Windows Server &amp;ldquo;8&amp;rdquo; Beta is a one-line command. It also reboots the computer. In addition, the &lt;i&gt;ComputerName &lt;/i&gt;parameter permits the command to accept an array of remote computer names. Here is the basic command to remove a computer from the domain, join a workgroup called myworkgroup, and reboot.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Remove-Computer -computername win8c5 -workgroup myworkgroup &amp;ndash;restart&lt;/p&gt;
&lt;p&gt;As shown in the image that follows, using the &lt;b&gt;Remove-Computer &lt;/b&gt;cmdlet without the &lt;i&gt;Force &lt;/i&gt;switched parameter causes a warning message to appear. With the &lt;i&gt;Force &lt;/i&gt;switched parameter in effect, no warning appears.&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.hsg_2D00_3_2D00_4_2D00_12_2D00_03.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7343.hsg_2D00_3_2D00_4_2D00_12_2D00_03.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now&amp;hellip;to get back to adding a computer to a domain by using Windows PowerShell. In Windows PowerShell&amp;nbsp;3.0, the &lt;b&gt;Add-Computer &lt;/b&gt;cmdlet gains additional parameters. One useful parameter is the &lt;i&gt;Restart &lt;/i&gt;parameter. This permits the use of a one-line command to add a computer to the domain. The use of this feature is shown here. (The following command is a single command; I have not added any line continuation characters to it.)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;#Requires -version 3.0&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Add-Computer -DomainName iammred -Credential iammred\administrator -restart -OUPath &amp;#39;ou=charlotte,dc=iammred,dc=net&amp;#39;&lt;/p&gt;
&lt;p&gt;The image that follows illustrates using the previous command to add a computer to the domain.&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/7522.hsg_2D00_3_2D00_4_2D00_12_2D00_04.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7522.hsg_2D00_3_2D00_4_2D00_12_2D00_04.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you need to rename the computer while adding it to the domain, the command would appear as follows:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Add-Computer -DomainName iammred -Credential iammred\administrator -restart -OUPath &amp;#39;ou=charlotte,dc=iammred,dc=net&amp;#39; &amp;ndash;newname mynewcomputername&lt;/p&gt;
&lt;p&gt;Keep in mind that Windows PowerShell&amp;nbsp;3.0 and Windows Server &amp;ldquo;8&amp;rdquo; Beta are beta software, and as such the features will change. But I hope you will download them and let us know how you like them. There is some good stuff here.&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=3484316" width="1" height="1" alt="" /&gt;</description></item><item><title>Learn How to Run PowerShell Scripts Against Multiple Computers</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2010/12/30/learn-how-to-run-powershell-scripts-against-multiple-computers.aspx</link><pubDate>Thu, 30 Dec 2010 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:8861</guid><dc:creator>Anonymous</dc:creator><description>Summary: Microsoft Scripting Guy Ed Wilson teaches you how to run Windows PowerShell Scripts against multiple computers in this step-by-step article. Hey, Scripting Guy! I am wondering on the best way to cause my script to work against multiple computers...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/12/30/learn-how-to-run-powershell-scripts-against-multiple-computers.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3377761" width="1" height="1" alt="" /&gt;</description></item></channel></rss>