{"id":16371,"date":"2010-11-29T00:01:00","date_gmt":"2010-11-29T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2010\/11\/29\/learn-when-to-write-powershell-scripts-and-when-not-to\/"},"modified":"2010-11-29T00:01:00","modified_gmt":"2010-11-29T00:01:00","slug":"learn-when-to-write-powershell-scripts-and-when-not-to","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/learn-when-to-write-powershell-scripts-and-when-not-to\/","title":{"rendered":"Learn When to Write PowerShell Scripts and When Not To"},"content":{"rendered":"<p><span style=\"font-size: 10pt\">&nbsp;<\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><b><span style=\"font-size: 10pt\">Summary:<\/span><\/b><span style=\"font-size: 10pt\"> Microsoft Scripting Guy Ed Wilson discusses when to write a Windows PowerShell script and when not to write a script.<\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><span style=\"font-size: 10pt\"><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Question\" border=\"0\" title=\"Hey, Scripting Guy! Question\" \/><\/span>Hey, Scripting Guy! I am wondering why everyone is talking about Windows PowerShell. To me it seems to simply be another scripting language, and I do not know why I should worry about it. I already know VBScript, and my friends use Perl. So what is the big deal?<\/span><\/p>\n<p><span style=\"font-size: 10pt\">&#8212; BW<\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><span style=\"font-size: 10pt\"><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Answer\" border=\"0\" title=\"Hey, Scripting Guy! Answer\" \/><\/span>Hello BW, Microsoft Scripting Guy Ed Wilson here. If Windows PowerShell were simply a new scripting language I would not be as excited as I am about the product. The truth of the matter is that Windows PowerShell is both an interactive command shell in addition to a scripting language. <\/span><\/p>\n<p class=\"Readeraidonly\"><span style=\"font-size: 10pt\"><\/span><\/p>\n<p class=\"Readeraidonly\"><span style=\"font-size: 10pt\"><\/span><\/p>\n<p class=\"Readeraidonly\"><span style=\"font-size: 10pt\">Portions of today&rsquo;s Hey, Scripting Guy! Blog post are adapted from material in my book <a href=\"http:\/\/www.amazon.com\/Windows-PowerShell-Best-Practices-Microsoft\/dp\/0735626464\/ref=sr_1_2?ie=UTF8&amp;s=books&amp;qid=1290463673&amp;sr=1-2\"><i><span style=\"color: #0000ff\">Windows PowerShell 2.0 Best Practices<\/span><\/i><\/a>, published by Microsoft Press in December 2009. <\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">Not everything in Windows PowerShell 2.0 has to be scripted. This was true in Windows PowerShell 1.0 and it is very true in Windows PowerShell 2.0. People coming from a VBScript background or a Perl background frequently feel they must write a script. But a tremendous amount of work can be done from the command line, without the need for writing a script. <\/span><\/p>\n<p><span style=\"font-size: 10pt\">One of the more powerful things that can be done with Windows PowerShell is the ability to use language statements from the command line. The<b> <i>for<\/i><\/b> statement lets you control looping operations that would have required creating a script in other languages. To facilitate work from the command line, Windows PowerShell will let you create incomplete commands on one line, and to continue them to the next line. When you are finished, you press the enter key a second time. The command seen here sends a ping command to each IP address in the range of 192.168.2.1 through 192.168.2.10. <\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; for($i = 1 ; $i -le 10 ; $i++)<br \/>&gt;&gt; { Test-Connection -Destination 192.168.2.$i -Count 1 -ErrorAction Silentlycontinue |<br \/>&gt;&gt; Format-Table &ndash;property Address, statusCode, ResponseTime -AutoSize }<br \/>&gt;&gt;<\/p>\n<p>Address<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>statusCode ResponseTime<br \/>&#8212;&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;<br \/>192.168.2.1<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>0<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>1<br \/>Address<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>statusCode ResponseTime<br \/>&#8212;&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;<br \/>192.168.2.3<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>0<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>2<br \/>Address<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>statusCode ResponseTime<br \/>&#8212;&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;<br \/>192.168.2.5<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>0<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>0<br \/>Address<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>statusCode ResponseTime<br \/>&#8212;&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;<br \/>192.168.2.10<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>0<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>10<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">The command above could have been much shorter by taking advantage of several economies provided by the Windows PowerShell syntax such as using aliases, partial parameters and positional arguments. <\/span><\/p>\n<p><span style=\"font-size: 10pt\">When talking about Windows PowerShell scripts, the first thing to realize is that in its most basic form a Windows PowerShell script is a collection of PowerShell commands stored in a file with a specific extension. If you do not want to do that, you can have a text file with a collection of commands, and store them as a text file as seen in the following figure.<\/span><\/p>\n<p class=\"Num-Caption\"><span style=\"font-size: x-small\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1067.HSG-11-29-10-01.jpg\" border=\"0\" \/><\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">By using Windows PowerShell, you can easily read the commands.txt text file, and execute the commands. To do this, you use the <b>Get-Content<\/b> cmdlet to retrieve the commands in the text file. The default parameter for the <b>Get-Content<\/b> cmdlet is the <i>path<\/i> parameter, and when you are working from the command line, you do not have to supply it if you do not want to do so. The path can be a local path or even a Universal Naming Convention (UNC) path as long as you have rights to read the text file. The best way to use this technique is to pipeline the results to the <b>Invoke-Expression<\/b> cmdlet. Each command that streams across the pipeline from the <b>Get-Content<\/b> cmdlet will be executed in turn as it arrives to the <b>Invoke-Expression<\/b> cmdlet. This is seen here:<\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">Get-Content -Path C:\\fso\\Commands.txt | Invoke-Expression<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">The results are seen in the following figure.<\/span><\/p>\n<p class=\"Num-Caption\"><span style=\"font-size: x-small\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4578.HSG-11-29-10-02.jpg\" border=\"0\" \/><\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">When you are using the Windows PowerShell remoting features against an untrusted domain, it is rather easy to become confused when you use cmdlets such as <b>Get-Content<\/b>. The <i>path<\/i> parameter that is used refers to a path that is local to the target computer, not a path that is local to the launching computer. In the example that follows the path <i>c:\\fso\\commands.txt<\/i> points to a text file that is named <i>commands.tx<\/i>t that must reside in the <i>fso<\/i> folder on the <i>C:\\<\/i> drive of a computer named <i>Sydney<\/i> in the <i>Woodbridgebank<\/i>.<i>com<\/i> domain. If the commands.txt file is not found in that location, the error seen here will be emitted. <\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; invoke-command -ComputerName sydney.woodbridgebank.com -Credential admin<br \/>istrator@woodbridgebank.com -ScriptBlock {get-content -Path C:\\fso\\Commands.txt<br \/>| Invoke-Expression}<br \/>Invoke-Command : Cannot find path &#8216;C:\\fso\\Commands.txt&#8217; because it does not exi<br \/>st.<br \/>At line:1 char:15<br \/>+ invoke-command &lt;&lt;&lt;&lt;<span>&nbsp; <\/span>-ComputerName sydney.woodbridgebank.com -Credential admi<br \/>nistrator@woodbridgebank.com -ScriptBlock {get-content -Path C:\\fso\\Commands.tx<br \/>t | Invoke-Expression}<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ CategoryInfo<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: ObjectNotFound: (C:\\fso\\Commands.txt:String) [Ge<br \/><span>&nbsp;&nbsp; <\/span>t-Content], ItemNotFoundException<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCo<br \/><span>&nbsp;&nbsp; <\/span>ntentCommand<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">You might think that you could use an UNC path and point to the commands.txt file on the launching computer. Because the remote domain is un-trusted, there is no security context that enables the remote command to access the file system of the local computer. When the command that is expressed in the <i>ScriptBlock<\/i> parameter is evaluated, it is evaluated in the context of the target computer which in this case is the <\/span><span style=\"font-size: x-small\"><i>Sydney.WoodBridgeBank.Com<\/i><span style=\"font-size: 10pt\"> computer. The local computer which is the launching point for the command is <\/span><i>Vista.NWTraders.com<\/i><span style=\"font-size: 10pt\"> and as there is no trust relationship between the two domains, there are no credentials that can be supplied to enable the command to run. The results of trying to run the command are seen here. <\/span><\/span><\/p>\n<p class=\"CodeBlock\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; invoke-command -ComputerName sydney.woodbridgebank.com -Credential admin<br \/>istrator@woodbridgebank.com -ScriptBlock {get-content -Path &#8216;\\\\vista\\fso\\Command<br \/>s.txt&#8217; | Invoke-Expression}<br \/>Invoke-Command : Cannot find path &#8216;\\\\vista\\fso\\Commands.txt&#8217; because it does no<br \/>t exist.<br \/>At line:1 char:15<br \/>+ invoke-command &lt;&lt;&lt;&lt;<span>&nbsp; <\/span>-ComputerName sydney.woodbridgebank.com -Credential admi<br \/>nistrator@woodbridgebank.com -ScriptBlock {get-content -Path &#8216;\\\\vista\\fso\\Comma<br \/>nds.txt&#8217; | Invoke-Expression}<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ CategoryInfo<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: ObjectNotFound: (\\\\vista\\fso\\Commands.txt:String<br \/><span>&nbsp;&nbsp; <\/span>) [Get-Content], ItemNotFoundException<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCo<br \/><span>&nbsp;&nbsp; <\/span>ntentCommand<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">The part that can seem to be confusing is that the <b>Get-Content<\/b> command works just fine when it is run alone. In working on a computer named <i>Vista<\/i> that has a folder named <i>fso<\/i> that contains a text file that is named <i>Commands.txt<\/i> the command completes successfully when it is ensconced with single quotes. This is seen here. <\/span><\/p>\n<p class=\"CodeBlock\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; Get-Content -Path &#8216;\\\\vista\\fso\\Commands.txt&#8217;<br \/>Get-Service -Name bits -ComputerName vista<br \/>Get-Process -Name explorer -ComputerName berlin<br \/>Get-EventLog -LogName application -Newest 1 -ComputerName berlin,vista<br \/>Invoke-Command -ComputerName Berlin { Get-Date }<br \/>Get-Date<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">But this is to be expected as the logged on user has rights to the folder, and can therefore use the <b>Get-Content<\/b> cmdlet to read a UNC path to the <i>command.txt<\/i> file. <\/span><\/p>\n<p><span style=\"font-size: 10pt\">You could map a drive on the remote domain, and copy the file from your local computer to the appropriate folder on the remote server. You would, of course, be required to open additional ports in the Windows Firewall which, depending on your network configuration, may or may not be an acceptable solution. If you decide to use this route, you could use Windows PowerShell to perform the configuration changes as shown here. <\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; Invoke-Command -ComputerName Sydney.WoodBridgeBank.Com -Credential Admin<br \/>istrator@WoodbridgeBank.com -ScriptBlock { netsh advfirewall firewall set rule g<br \/>roup=&#8221;File and Printer Sharing&#8221; new enable=Yes }<\/p>\n<p>Updated 28 rule(s).<br \/>Ok.<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">After you have enabled the firewall exception, you can then map a drive using the GUI or the <b>Net Use<\/b> command from within Windows PowerShell, or any of the other programmatic methods. After you have mapped the drive, you could then copy the <i>commands.txt<\/i> file to the remote server by using the <b>Copy-Item<\/b> cmdlet as seen here. <\/span><\/p>\n<p class=\"Readeraidonly\"><span style=\"font-size: 10pt\">When you use <b>Copy-Item<\/b> to copy an item to a mapped drive, you have to consider the structure of the mapped drive. It is quite common to map a drive to a share on a remote computer. The remote share is almost invariably a share of a folder, and not a complete drive. Because your remote drive is a map point of a single folder, it will change the destination. The <i>z:<\/i> drive in the command which follows is a share of the <i>fso<\/i> folder on the remote server. The destination parameter is to the root of the mapped drive, and not to <i>z:\\fso<\/i>. <\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">Copy-Item -Path C:\\fso\\Commands.txt -Destination z:<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">You could now use the <i>commands.txt<\/i> directly in the Windows PowerShell command as seen here. <\/span><\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\"><span style=\"font-size: 10pt\"><span style=\"font-family: Lucida Sans Typewriter\">PS C:\\&gt; invoke-command -ComputerName Sydney.WoodbridgeBank.com -Credential admin<br \/>istrator@WoodBridgeBank.com -ScriptBlock { Get-Content -Path C:\\fso\\Commands.txt<br \/><span>&nbsp;<\/span>| Invoke-Expression }<\/span><\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\">One solution to the dilemma of mapping drives is to use Remote Desktop. Remote Desktop will enable you to access local resources if you decide to make them available in your session. By selecting <b>Remote Desktop \/ Options \/ Local Resources<\/b>,<b> <\/b>you can choose to enable printer connections, clip board access, and local drives to be available within the Remote Desktop Protocol (RDP) session. You can access Remote Desktop by going to <b>Start \/ All Programs \/ Accessories<\/b> and selecting <b>Remote Desktop Connection<\/b>. There is a problem with using remote desktop. It must first be enabled. If it has not been previously enabled, you will be greeted with the friendly access denied message seen in the following figure. <\/span><\/p>\n<p class=\"Num-Caption\"><span style=\"font-size: x-small\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1362.HSG-11-29-10-03.jpg\" border=\"0\" \/><\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">To enable Remote Desktop access, on Windows 2008 and Windows 2008 R2, select <b>Configure Remote Desktop<\/b> from <b>Server Manager<\/b>. If you are running Windows Vista or Windows 7 you select <b>Remote Settings<\/b> from <b>Control Panel \/ System<\/b>. In any case, the <b>System Properties<\/b> dialog appears, and you have to select the <b>Remote<\/b> tab which is shown in the following figure. The Remote Desktop options are seen in the bottom half of the screen and present three choices. By default Remote Desktop connections are not allowed to the computer. The safest choice is to enable connections only from computers that are running Remote Desktop with Network Level Authentication. You are also able to specify which users will be allowed to make the connection. By default, members of the Domain Administrators group will be permitted to make connections. <\/span><\/p>\n<p class=\"Num-Caption\"><span style=\"font-size: x-small\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2804.HSG-11-29-10-04.jpg\" border=\"0\" \/><\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">After you have enabled Remote Desktop an exception is automatically created to allow for RDP traffic through the Windows Firewall. It is still a good idea to double-check to make sure the exception was permitted.<\/span><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\"><\/span><\/p>\n<p><span style=\"font-size: 10pt\">BW, that is all there is to working interactively with Windows PowerShell. To Script or Not to Script week will continue tomorrow when I will talk about how to work with command history. <\/span><\/p>\n<p><span style=\"font-size: 10pt\">I invite you to follow me on <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingguystwitter\"><span style=\"color: #0000ff\">Twitter<\/span><\/a> or <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\"><span style=\"color: #0000ff\">Facebook<\/span><\/a>. If you have any questions, send email to me at <a target=\"_blank\" href=\"mailto:scripter@microsoft.com\"><span style=\"color: #0000ff\">scripter@microsoft.com<\/span><\/a> or post them on the <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingforum\"><span style=\"color: #0000ff\">Official Scripting Guys Forum<\/span><\/a>. See you tomorrow. Until then, peace.<\/span><\/p>\n<p><span style=\"font-size: 10pt\">&nbsp;<\/span><\/p>\n<p><b><span style=\"font-size: 10pt\">Ed Wilson, Microsoft Scripting Guy<\/span><\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp; Summary: Microsoft Scripting Guy Ed Wilson discusses when to write a Windows PowerShell script and when not to write a script. &nbsp; Hey, Scripting Guy! I am wondering why everyone is talking about Windows PowerShell. To me it seems to simply be another scripting language, and I do not know why I should worry [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,3,4,45],"class_list":["post-16371","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>&nbsp;&nbsp; Summary: Microsoft Scripting Guy Ed Wilson discusses when to write a Windows PowerShell script and when not to write a script. &nbsp; Hey, Scripting Guy! I am wondering why everyone is talking about Windows PowerShell. To me it seems to simply be another scripting language, and I do not know why I should worry [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=16371"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16371\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=16371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=16371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=16371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}