February 2010 - Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

Welcome to the archive of tips delivered through Tobias' Tip of the Day RSS Feed and Your Power Tip of the Day email. Subscribe in the sidebar to get the latest tips!

Sort by: Most Recent | Most Viewed | Most Commented
  • Launching Programs Maximized

    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: Start-Process notepad -WindowStyle Maximized Supported arguments are Maximized...
  • Wait for Programs

    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: Start-Process notepad -wait ReTweet this Tip!
  • Open Current Folder in Your Explorer

    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: explorer . Of course, this only works when the current folder is set to a folder in your file system. ReTweet...
  • Search for Localized Keywords

    Finding the appropriate command for a task is important. With a little trick, PowerShell can help you. Have a look: function ??( $keywords ) { Get-Help * | ? { $_ . description -like "*$keywords*" } | Select-Object Name, Synopsis } This function...
  • Filter is Faster Than Include

    A number of cmdlets provide two parameters that seem to work very similar: -filter and -include: Dir $env:windir - filter * . log Dir $env:windir -include * . log If you have a choice, you should always pick -filter. For starters, it is much faster (4x...
  • Use Online Help

    "To ship is to choose", 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: Get-Help Get-Process -online This will open a Web...
  • Get to know Parameter Sets

    Sometimes, you may run into issues like this once you learned more about the parameters a given cmdlet supports: Get-Random -Minimum 1 -Maximum 50 -Count 7 Although all three parameters are valid, you will get an exception because cmdlets can separate...
  • Finding Positional Parameters

    Positional parameters can be great time savers as many cmdlets assign a parameter position to its most widely used parameters. This way you do not need to specify the parameter name. You should instead just make sure you submit your arguments in the expected...
  • Finding All Background Information About Operators or Remoting

    Since Get-Help accepts wild cards, you can easily list all white papers available for a specific topic. Use this to get you all topics that deal with operators: Get-Help about_ * operator * You should have a look at this if you want to open all of these...
  • Sending Information to the Clipboard

    Beginning with Vista, there is a new console tool called clip.exe, which copies whatever you pipe to it to your clipboard. You should try this if you'd like to transfer PowerShell results to the clipboard: Get-Process | clip ReTweet this Tip!
  • Overwriting Pre-Defined Aliases

    PowerShell protects its own pre-defined aliases so you normally cannot override and redefine them. It will still work if you use the correct parameters: Set-Alias ise notepad -force -Option AllScope This illustrates that aliases are really only for your...
  • A Better more.com

    Whenever you want to break up a lot of information in separate page views, you can traditionally pipe to more.com, which is an external executable. However, the problem is that you never know if it really available. What's more, it will not show hints...
  • Reading Help with Page Breaks

    Help information is typically pretty extensive. If you'd like to make the information more readable, you could always pipe the result to the old-fashioned more.com: Get-Help Get-Process -detailed | more.com However, a much better (and shorter) way...
  • Opening PowerShell White Papers Directly

    The following line opens the folder that stores all the PowerShell white papers. You can open them in your word processor or print them for future reference since they are plain text files: explorer "$pshome\$($host.CurrentCulture.Name)" ReTweet...
  • Discovering PowerShell Background Information

    PowerShell comes with lots of white papers. However, you do not need to know the exact title of the white paper to find information about a specific topic. Simply use Get-Help and enter a keyword that is contained in the white paper title. You should...
1 2 Next >
Copyright 2012 PowerShell.com. All rights reserved.