<?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>Power Tips</title><link>http://powershell.com/cs/blogs/tips/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Creating Large Dummy Files With .NET</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/11/creating-large-dummy-files-with-net.aspx</link><pubDate>Thu, 11 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4681</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4681</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/11/creating-large-dummy-files-with-net.aspx#comments</comments><description>&lt;p&gt;You can always resort to the underlying .NET framework whenever the functionality you need isn&amp;#39;t available through a cmdlet. &lt;/p&gt;
&lt;p&gt;The following code is a very fast way to generate really large test files:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="var"&gt;$path&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;$env:temp\testfile.txt&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span class="var"&gt;$file&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; [&lt;span class="namespace"&gt;io.file&lt;/span&gt;]::&lt;span class="method"&gt;Create&lt;/span&gt;(&lt;span class="var"&gt;$path&lt;/span&gt;)&lt;br /&gt;&lt;span class="var"&gt;$file&lt;/span&gt;.&lt;span class="method"&gt;SetLength&lt;/span&gt;(1gb)&lt;br /&gt;&lt;span class="var"&gt;$file&lt;/span&gt;.&lt;span class="method"&gt;Close&lt;/span&gt;()&lt;br /&gt;&lt;span class="verbnoun"&gt;Get-Item&lt;/span&gt; &lt;span class="var"&gt;$path&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Large+Files+with+.NET+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FbYmRZw" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Large+Files+with+.NET+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FbYmRZw" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4681" width="1" height="1"&gt;</description></item><item><title>Creating Large Dummy Files</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/10/creating-large-dummy-files.aspx</link><pubDate>Wed, 10 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4680</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4680</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/10/creating-large-dummy-files.aspx#comments</comments><description>&lt;p&gt;Sometimes, it is more efficient to use existing console tools rather than PowerShell cmdlets. For example here is a way to create a large file for load tests:&lt;/p&gt;
&lt;div class="pscode"&gt;fsutil file createnew &lt;span class="var"&gt;$env:temp&lt;/span&gt;\&lt;span class="namespace"&gt;dummy.bin&lt;/span&gt; (1gb)&lt;/div&gt;
&lt;p&gt;However, you should note that fsutil requires admin privileges.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Large+Files+with+fsutil+from+%23PowerShell+http%3A%2F%2Fbit.ly%2F9NCO1L" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Large+Files+with+fsutil+from+%23PowerShell+http%3A%2F%2Fbit.ly%2F9NCO1L" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4680" width="1" height="1"&gt;</description></item><item><title>Running PowerShell Scripts as Scheduled Task</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/09/running-powershell-scripts-as-scheduled-task.aspx</link><pubDate>Tue, 09 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4679</guid><dc:creator>ps1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4679</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/09/running-powershell-scripts-as-scheduled-task.aspx#comments</comments><description>&lt;p&gt;If you have jobs that need to execute regularly, you can manage them with a PowerShell script and make it a scheduled task:&lt;/p&gt;
&lt;div class="pscode"&gt;schtasks &lt;span class="op"&gt;/&lt;/span&gt;CREATE &lt;span class="op"&gt;/&lt;/span&gt;TN CheckHealthScript &lt;span class="op"&gt;/&lt;/span&gt;TR &lt;span class="string"&gt;&amp;quot;powershell.exe `&lt;/span&gt;&lt;br /&gt;&lt;span class="string"&gt;  -noprofile -executionpolicy Unrestricted `&lt;/span&gt;&lt;br /&gt;&lt;span class="string"&gt;  -file %public%\checkhealth.ps1&amp;quot;&lt;/span&gt; &lt;span class="op"&gt;/&lt;/span&gt;IT &lt;span class="op"&gt;/&lt;/span&gt;RL HIGHEST &lt;span class="op"&gt;/&lt;/span&gt;SC DAILY&lt;/div&gt;
&lt;p&gt;To remove the scheduled task, specify the name you assigned:&lt;/p&gt;
&lt;div class="pscode"&gt;schtasks &lt;span class="op"&gt;/&lt;/span&gt;DELETE &lt;span class="op"&gt;/&lt;/span&gt;TN CheckHealthScript&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Running+%23PowerShell+Scripts+as+Scheduled+Task+http%3A%2F%2Fbit.ly%2F9jzFFi" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Running+%23PowerShell+Scripts+as+Scheduled+Task+http%3A%2F%2Fbit.ly%2F9jzFFi" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4679" width="1" height="1"&gt;</description></item><item><title>Launching a PowerShell Script Externally</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/08/launching-a-powershell-script-externally.aspx</link><pubDate>Mon, 08 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4678</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4678</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/08/launching-a-powershell-script-externally.aspx#comments</comments><description>&lt;p&gt;To launch a PowerShell script outside of the PowerShell console (i.e. as scheduled task or as a link), prepend the script path with this:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="namespace"&gt;Powershell.exe&lt;/span&gt; &lt;span class="modifier"&gt;-noprofile&lt;/span&gt; &lt;span class="modifier"&gt;-executionpolicy&lt;/span&gt; Bypass c:\&lt;span class="namespace"&gt;pathtoscript.ps1&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;As you can see, in v.2 Microsoft added an -executionPolicy parameter, which allows you to override whatever execution policy is set by default. However, your call cannot override this setting if the execution policy was defined by a group policy.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Launching+a+%23PowerShell+Script+Externally+http%3A%2F%2Fbit.ly%2FafKTdl" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Launching+a+%23PowerShell+Script+Externally+http%3A%2F%2Fbit.ly%2FafKTdl" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4678" width="1" height="1"&gt;</description></item><item><title>Accessing Profile Scripts</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/05/accessing-profile-scripts.aspx</link><pubDate>Fri, 05 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4677</guid><dc:creator>ps1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4677</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/05/accessing-profile-scripts.aspx#comments</comments><description>&lt;p&gt;Profile scripts are executed automatically when PowerShell starts. The paths to these scripts can be found in $profile:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="var"&gt;$profile&lt;/span&gt; | gm &lt;span class="op"&gt;*&lt;/span&gt;Host&lt;span class="op"&gt;*&lt;/span&gt; | &lt;span class="op"&gt;%&lt;/span&gt; { &lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="method"&gt;Name&lt;/span&gt; } | &lt;span class="op"&gt;%&lt;/span&gt; {&lt;br /&gt;  &lt;span class="var"&gt;$rv&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; @{}; &lt;span class="var"&gt;$rv&lt;/span&gt;.&lt;span class="method"&gt;Name&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="var"&gt;$_&lt;/span&gt;&lt;br /&gt;  &lt;span class="var"&gt;$rv&lt;/span&gt;.&lt;span class="method"&gt;Path&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="var"&gt;$profile&lt;/span&gt;.&lt;span class="var"&gt;$_&lt;/span&gt;&lt;br /&gt;  &lt;span class="var"&gt;$rv&lt;/span&gt;.&lt;span class="method"&gt;Exists&lt;/span&gt;&lt;span class="op"&gt;=&lt;/span&gt; (&lt;span class="verbnoun"&gt;Test-Path&lt;/span&gt; &lt;span class="var"&gt;$profile&lt;/span&gt;.&lt;span class="var"&gt;$_&lt;/span&gt;)&lt;br /&gt;  &lt;span class="verbnoun"&gt;New-Object&lt;/span&gt; PSObject &lt;span class="modifier"&gt;-Property&lt;/span&gt; &lt;span class="var"&gt;$rv&lt;/span&gt; &lt;br /&gt;} | &lt;span class="verbnoun"&gt;Format-Table&lt;/span&gt; &lt;span class="modifier"&gt;-AutoSize&lt;/span&gt;&lt;/div&gt;
&lt;div class="psoutput"&gt;Name                    Path               Exists&lt;br /&gt;----                    ----               ------&lt;br /&gt;AllUsersAllHosts        C:\Windows\...ps1  True&lt;br /&gt;AllUsersCurrentHosts    C:\Windows\...ps1  False&lt;br /&gt;CurrentUserAllHosts     C:\Users\...ps1    True&lt;br /&gt;CurrentUserCurrentHost  C:\Users\...ps1    True&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Accessing+%23PowerShell+Profile+Scripts+http%3A%2F%2Fbit.ly%2F9eZYgc" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Accessing+%23PowerShell+Profile+Scripts+http%3A%2F%2Fbit.ly%2F9eZYgc" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4677" width="1" height="1"&gt;</description></item><item><title>Listing Execution Policies</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/04/listing-execution-policies.aspx</link><pubDate>Thu, 04 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4676</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4676</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/04/listing-execution-policies.aspx#comments</comments><description>&lt;p&gt;In PowerShell v.2, there are multiple execution policies. You should use this to view and check the settings:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Get-ExecutionPolicy&lt;/span&gt; &lt;span class="modifier"&gt;-List&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Listing+%23PowerShell+Execution+Policies+http%3A%2F%2Fbit.ly%2FcFdbO2" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Listing+%23PowerShell+Execution+Policies+http%3A%2F%2Fbit.ly%2FcFdbO2" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4676" width="1" height="1"&gt;</description></item><item><title>Closing a Program Gracefully</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/03/closing-a-program-gracefully.aspx</link><pubDate>Wed, 03 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4675</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4675</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/03/closing-a-program-gracefully.aspx#comments</comments><description>&lt;p&gt;When you use Stop-Process to kill a program, it will  stop instantaneously. The user will get no chance to save unsaved documents:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Get-Process&lt;/span&gt; Notepad | &lt;span class="verbnoun"&gt;Stop-Process&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;Try a more graceful way by using  an internal .NET method, which then acts as if someone closed the program window. If the content has not been saved, a dialog opens and asks for a choice:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Get-Process&lt;/span&gt; Notepad | &lt;br /&gt;  &lt;span class="verbnoun"&gt;Foreach-Object&lt;/span&gt; { &lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="method"&gt;CloseMainWindow&lt;/span&gt;() | &lt;span class="verbnoun"&gt;Out-Null&lt;/span&gt; }&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Closing+a+Program+Gracefully+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FdbuAVr" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Closing+a+Program+Gracefully+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FdbuAVr" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4675" width="1" height="1"&gt;</description></item><item><title>Stopping a Program Whenever You Feel Like It</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/02/stopping-a-program-whenever-you-feel-like-it.aspx</link><pubDate>Tue, 02 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4674</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4674</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/02/stopping-a-program-whenever-you-feel-like-it.aspx#comments</comments><description>&lt;p&gt;When you launch a program using Start-Process with -passThru, you will get back the process object representing the started program. You can then use this object later to kill the program whenever necessary.&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="var"&gt;$notepad&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="verbnoun"&gt;Start-Process&lt;/span&gt; notepad &lt;span class="modifier"&gt;-passthru&lt;/span&gt;&lt;br /&gt;&lt;span class="verbnoun"&gt;Start-Sleep&lt;/span&gt; 2&lt;br /&gt;&lt;span class="verbnoun"&gt;Stop-Process&lt;/span&gt; &lt;span class="modifier"&gt;-inputObject&lt;/span&gt; &lt;span class="var"&gt;$notepad&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4674" width="1" height="1"&gt;</description></item><item><title>Use CHOICE to Prompt for Input</title><link>http://powershell.com/cs/blogs/tips/archive/2010/03/01/use-choice-to-prompt-for-input.aspx</link><pubDate>Mon, 01 Mar 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4673</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4673</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/03/01/use-choice-to-prompt-for-input.aspx#comments</comments><description>&lt;p&gt;PowerShell can run native console applications, which  can be very helpful. For example, you should take a closer look at CHOICE.EXE, which will  prompt you for information:&lt;/p&gt;
&lt;div class="pscode"&gt;Choice &lt;span class="op"&gt;/&lt;/span&gt;N &lt;span class="op"&gt;/&lt;/span&gt;C:123 &lt;span class="op"&gt;/&lt;/span&gt;M &lt;span class="string"&gt;&amp;quot;Enter a number between 1 and 3!&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span class="string"&gt;&amp;quot;Your choice: $LASTEXITCODE&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;This will get you a simple Y/N prompt:&lt;/p&gt;
&lt;div class="pscode"&gt;Choice &lt;span class="op"&gt;/&lt;/span&gt;N &lt;span class="op"&gt;/&lt;/span&gt;C:YN &lt;span class="op"&gt;/&lt;/span&gt;M &lt;span class="string"&gt;&amp;quot;Do you agree (Y/N)?&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span class="string"&gt;&amp;quot;Your answer: $LASTEXITCODE&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Use+CHOICE+to+Prompt+for+Input+in+%23PowerShell+http%3A%2F%2Fbit.ly%2FcBasGI" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Use+CHOICE+to+Prompt+for+Input+in+%23PowerShell+http%3A%2F%2Fbit.ly%2FcBasGI" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4673" width="1" height="1"&gt;</description></item><item><title>Launching Programs Maximized</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/26/launching-programs-maximized.aspx</link><pubDate>Fri, 26 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4672</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4672</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/26/launching-programs-maximized.aspx#comments</comments><description>&lt;p&gt;Start-Process has a parameter called -WindowStyle. With it, you can control the window size of the application you launch. You should use this line to launch notepad maximized:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Start-Process&lt;/span&gt; notepad &lt;span class="modifier"&gt;-WindowStyle&lt;/span&gt; Maximized&lt;/div&gt;
&lt;p&gt;Supported arguments are Maximized, Minimized, Normal, and Hidden. Be sure to watch out with Hidden! You should only use it for programs that do not require user interaction.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Launching%20Programs%20Maximized%20from%20#PowerShell%20http://bit.ly/9f9voL" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Launching%20Programs%20Maximized%20from%20#PowerShell%20http://bit.ly/9f9voL" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4672" width="1" height="1"&gt;</description></item><item><title>Wait for Programs</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/25/wait-for-programs.aspx</link><pubDate>Thu, 25 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4671</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4671</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/25/wait-for-programs.aspx#comments</comments><description>&lt;p&gt;PowerShell launches Windows applications asynchronously. It only waits for the console application so you should use -wait if you want to launch a Windows application and wait for it until it finishes:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Start-Process&lt;/span&gt; notepad &lt;span class="modifier"&gt;-wait&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Wait+for+Programs+Launched+from+%23PowerShell+http%3A%2F%2Fbit.ly%2F9a7KfV" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Wait+for+Programs+Launched+from+%23PowerShell+http%3A%2F%2Fbit.ly%2F9a7KfV" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4671" width="1" height="1"&gt;</description></item><item><title>Open Current Folder in Your Explorer</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/24/open-current-folder-in-your-explorer.aspx</link><pubDate>Wed, 24 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4670</guid><dc:creator>ps1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4670</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/24/open-current-folder-in-your-explorer.aspx#comments</comments><description>&lt;p&gt;If you are stuck in the console and would like to move over to the Explorer GUI, the next line opens your current folder in an Explorer window:&lt;/p&gt;
&lt;div class="pscode"&gt;explorer .&lt;/div&gt;
&lt;p&gt;Of course, this only works when the current folder is set to a folder in your file system.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Open+Current+Folder+in+Your+Explorer+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FbVtCJ2" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Open+Current+Folder+in+Your+Explorer+from+%23PowerShell+http%3A%2F%2Fbit.ly%2FbVtCJ2" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4670" width="1" height="1"&gt;</description></item><item><title>Search for Localized Keywords</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/23/search-for-localized-keywords.aspx</link><pubDate>Tue, 23 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4669</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4669</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/23/search-for-localized-keywords.aspx#comments</comments><description>&lt;p&gt;Finding the appropriate command for a task is important. With a little trick, PowerShell can help you. Have a look:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="keyword"&gt;function&lt;/span&gt; ??(&lt;span class="var"&gt;$keywords&lt;/span&gt;) { &lt;span class="verbnoun"&gt;Get-Help&lt;/span&gt; &lt;span class="op"&gt;*&lt;/span&gt; | &lt;br /&gt;  ? { &lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="method"&gt;description&lt;/span&gt; &lt;span class="op"&gt;-like&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*$keywords*&amp;quot;&lt;/span&gt; } | &lt;br /&gt;  &lt;span class="verbnoun"&gt;Select-Object&lt;/span&gt; Name, Synopsis }&lt;/div&gt;
&lt;p&gt;This function called &amp;quot;??&amp;quot; searches Help content for any keyword you specify. Since Help files are localized, you can happily use keywords in your own language (the language your window uses, to be exact). For example, on German systems, you could search for &amp;quot;Drucker&amp;quot; and get back everything related to &amp;quot;printer&amp;quot;:&lt;/p&gt;
&lt;div class="pscode"&gt;?? drucker&lt;br /&gt;?? zufall&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Search+for+Localized+%23PowerShell+Keywords+http%3A%2F%2Fbit.ly%2FaPALnE" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Search+for+Localized+%23PowerShell+Keywords+http%3A%2F%2Fbit.ly%2FaPALnE" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4669" width="1" height="1"&gt;</description></item><item><title>Filter is Faster Than Include</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/22/filter-is-faster-than-include.aspx</link><pubDate>Mon, 22 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4668</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4668</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/22/filter-is-faster-than-include.aspx#comments</comments><description>&lt;p&gt;A number of cmdlets provide two parameters that seem to work very similar: -filter and -include:&lt;/p&gt;
&lt;div class="pscode"&gt;Dir &lt;span class="var"&gt;$env:windir&lt;/span&gt; &lt;span class="op"&gt;-&lt;/span&gt;&lt;span class="keyword"&gt;filter&lt;/span&gt; &lt;span class="op"&gt;*&lt;/span&gt;.&lt;span class="method"&gt;log&lt;/span&gt;&lt;br /&gt;Dir &lt;span class="var"&gt;$env:windir&lt;/span&gt; &lt;span class="modifier"&gt;-include&lt;/span&gt; &lt;span class="op"&gt;*&lt;/span&gt;.&lt;span class="method"&gt;log&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;If you have a choice, you should always pick  -filter. For starters,  it is much faster (4x and more) and secondly, -include only works when combined with -recurse. -filter always works.&lt;/p&gt;
&lt;p&gt;So why is there -include at all? Because not all providers support -filter. For example, you are limited to -include when you list registry content.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Filter+is+Faster+than+Include+in+%23PowerShell+http%3A%2F%2Fbit.ly%2F908TZo" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Filter+is+Faster+than+Include+in+%23PowerShell+http%3A%2F%2Fbit.ly%2F908TZo" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4668" width="1" height="1"&gt;</description></item><item><title>Use Online Help</title><link>http://powershell.com/cs/blogs/tips/archive/2010/02/19/use-online-help.aspx</link><pubDate>Fri, 19 Feb 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:4667</guid><dc:creator>ps1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://powershell.com/cs/blogs/tips/rsscomments.aspx?PostID=4667</wfw:commentRss><comments>http://powershell.com/cs/blogs/tips/archive/2010/02/19/use-online-help.aspx#comments</comments><description>&lt;p&gt;&amp;quot;To ship is to choose&amp;quot;, so the Help files provided by PowerShell are sometimes outdated. You should use their online versions if you want to get  the most accurate and up-to-date information:&lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Get-Help&lt;/span&gt; &lt;span class="verbnoun"&gt;Get-Process&lt;/span&gt; &lt;span class="modifier"&gt;-online&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;This will open a Web page with the most current version. However, it will only  work on U.S. systems because of  a documentation bug that you can see on localized versions:&lt;/p&gt;
&lt;div class="pscode"&gt;@((&lt;span class="verbnoun"&gt;get-help&lt;/span&gt; &lt;span class="verbnoun"&gt;get-random&lt;/span&gt;).&lt;span class="namespace"&gt;relatedlinks.navigationLink&lt;/span&gt;)[0]&lt;/div&gt;
&lt;p&gt;As it turns out, Microsoft has added a comment &amp;quot;this may be in English&amp;quot; to the URL, so the URL breaks and you just get a bing search window on these systems.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Use+%23PowerShell+Online+Help+http%3A%2F%2Fbit.ly%2Fa7OJo3" target="twitter"&gt;&lt;img src="http://powershell.com/cs/Themes/powershell/images/ps/twitter_32x32.png" alt="Twitter This Tip!" style="vertical-align:middle;border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Use+%23PowerShell+Online+Help+http%3A%2F%2Fbit.ly%2Fa7OJo3" target="twitter"&gt;ReTweet this Tip!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=4667" width="1" height="1"&gt;</description></item></channel></rss>