<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Power Tips</title><subtitle type="html" /><id>http://powershell.com/cs/blogs/tips/atom.aspx</id><link rel="alternate" type="text/html" href="http://powershell.com/cs/blogs/tips/default.aspx" /><link rel="self" type="application/atom+xml" href="http://powershell.com/cs/blogs/tips/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.30929.2835">Community Server</generator><updated>2010-02-18T08:00:00Z</updated><entry><title>Creating Large Dummy Files</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/10/creating-large-dummy-files.aspx" /><id>/cs/blogs/tips/archive/2010/03/10/creating-large-dummy-files.aspx</id><published>2010-03-10T14:00:00Z</published><updated>2010-03-10T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Running PowerShell Scripts as Scheduled Task</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/09/running-powershell-scripts-as-scheduled-task.aspx" /><id>/cs/blogs/tips/archive/2010/03/09/running-powershell-scripts-as-scheduled-task.aspx</id><published>2010-03-09T14:00:00Z</published><updated>2010-03-09T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Launching a PowerShell Script Externally</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/08/launching-a-powershell-script-externally.aspx" /><id>/cs/blogs/tips/archive/2010/03/08/launching-a-powershell-script-externally.aspx</id><published>2010-03-08T14:00:00Z</published><updated>2010-03-08T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Accessing Profile Scripts</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/05/accessing-profile-scripts.aspx" /><id>/cs/blogs/tips/archive/2010/03/05/accessing-profile-scripts.aspx</id><published>2010-03-05T14:00:00Z</published><updated>2010-03-05T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Listing Execution Policies</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/04/listing-execution-policies.aspx" /><id>/cs/blogs/tips/archive/2010/03/04/listing-execution-policies.aspx</id><published>2010-03-04T14:00:00Z</published><updated>2010-03-04T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Closing a Program Gracefully</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/03/closing-a-program-gracefully.aspx" /><id>/cs/blogs/tips/archive/2010/03/03/closing-a-program-gracefully.aspx</id><published>2010-03-03T14:00:00Z</published><updated>2010-03-03T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Stopping a Program Whenever You Feel Like It</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/02/stopping-a-program-whenever-you-feel-like-it.aspx" /><id>/cs/blogs/tips/archive/2010/03/02/stopping-a-program-whenever-you-feel-like-it.aspx</id><published>2010-03-02T14:00:00Z</published><updated>2010-03-02T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Use CHOICE to Prompt for Input</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/03/01/use-choice-to-prompt-for-input.aspx" /><id>/cs/blogs/tips/archive/2010/03/01/use-choice-to-prompt-for-input.aspx</id><published>2010-03-01T14:00:00Z</published><updated>2010-03-01T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Launching Programs Maximized</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/26/launching-programs-maximized.aspx" /><id>/cs/blogs/tips/archive/2010/02/26/launching-programs-maximized.aspx</id><published>2010-02-26T14:00:00Z</published><updated>2010-02-26T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Wait for Programs</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/25/wait-for-programs.aspx" /><id>/cs/blogs/tips/archive/2010/02/25/wait-for-programs.aspx</id><published>2010-02-25T14:00:00Z</published><updated>2010-02-25T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Open Current Folder in Your Explorer</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/24/open-current-folder-in-your-explorer.aspx" /><id>/cs/blogs/tips/archive/2010/02/24/open-current-folder-in-your-explorer.aspx</id><published>2010-02-24T14:00:00Z</published><updated>2010-02-24T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Search for Localized Keywords</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/23/search-for-localized-keywords.aspx" /><id>/cs/blogs/tips/archive/2010/02/23/search-for-localized-keywords.aspx</id><published>2010-02-23T14:00:00Z</published><updated>2010-02-23T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Filter is Faster Than Include</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/22/filter-is-faster-than-include.aspx" /><id>/cs/blogs/tips/archive/2010/02/22/filter-is-faster-than-include.aspx</id><published>2010-02-22T14:00:00Z</published><updated>2010-02-22T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Use Online Help</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/19/use-online-help.aspx" /><id>/cs/blogs/tips/archive/2010/02/19/use-online-help.aspx</id><published>2010-02-19T14:00:00Z</published><updated>2010-02-19T14:00:00Z</updated><content type="html">&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;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry><entry><title>Get to know Parameter Sets</title><link rel="alternate" type="text/html" href="/cs/blogs/tips/archive/2010/02/18/get-to-know-parameter-sets.aspx" /><id>/cs/blogs/tips/archive/2010/02/18/get-to-know-parameter-sets.aspx</id><published>2010-02-18T14:00:00Z</published><updated>2010-02-18T14:00:00Z</updated><content type="html">&lt;p&gt;Sometimes, you may run into issues like this once you learned more about the parameters a given cmdlet supports:  &lt;/p&gt;
&lt;div class="pscode"&gt;&lt;span class="verbnoun"&gt;Get-Random&lt;/span&gt; &lt;span class="modifier"&gt;-Minimum&lt;/span&gt; 1 &lt;span class="modifier"&gt;-Maximum&lt;/span&gt; 50 &lt;span class="modifier"&gt;-Count&lt;/span&gt; 7&lt;/div&gt;
&lt;p&gt;Although all three parameters are valid, you will get an exception because cmdlets can separate parameters into parameter sets. But you can only use parameters of one set so you will get an exception once you try and mix parameters of different sets.&lt;/p&gt;
&lt;p&gt;For example,  the parameter sets that a cmdlet supports are listed by Get-Help:&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;/div&gt;
&lt;p&gt;Take a look at the SYNTAX section. When you see more than one syntax, you can know that each one represents a separate parameter set. As it turns out, you cannot mix -minimum and -maximum with -count.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitter.com/home/?status=RT+%40PowerTip+Get+to+know+%23PowerShell+Parameter+Sets+http%3A%2F%2Fbit.ly%2Fc6bMHs" 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+Get+to+know+%23PowerShell+Parameter+Sets+http%3A%2F%2Fbit.ly%2Fc6bMHs" 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=4666" width="1" height="1"&gt;</content><author><name>ps1</name><uri>http://powershell.com/cs/members/ps1/default.aspx</uri></author></entry></feed>