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
  • Changing Execution Policy without Admin Rights

    In PowerShell v.2, a number of parameters have been added to Set-ExecutionPolicy, which allows you to change this setting without Admin privileges, unless an administrator has restricted this: This line will change the execution policy only for the current...
  • 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...
  • 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...
  • 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...
  • Listing Installed Software

    You will find that listing installed software can be somewhat difficult as WMI provides the Win32_Product class, which only covers managed installs (installed by MSI). You should consider reading the registry, which is a better approach.. One little known...
  • Retrieving Event Logs Remotely

    PowerShell v.2 has added remote capabilities to a number of cmdlets, including Get-EventLog. So now you are able to collect important events remotely with just one line: Get-EventLog System -EntryType Warning -ComputerName PC01234 You will need to have...
  • 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...
  • 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!
  • 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!
  • 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...
  • 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...
  • 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...
  • 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...
  • 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...
  • 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...
1 2 Next >
Copyright 2012 PowerShell.com. All rights reserved.