October 2009 - 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
  • Listing Cmdlet Parameters

    Use this line if you need to get a quick list of all parameters that a given cmdlet supports along with a short description: Get-Help dir -para * | Format-Table Name, { $_ . Description [0]. Text } -wrap Interesting to note that Format-Table can create...
  • Finding Cmdlet Parameter Positions

    You can find out which cmdlet parameters are positional by using this line: get-help dir -parameter * | Where-Object { $_ . Position -as [ Int ] } | Sort-Object Position This will list all positional parameters for "dir" (replace dir with any...
  • Using Positional Cmdlet Parameters

    Cmdlets typically support a lot of parameters. For convenience, the most important ones have an assigned "position" so you can specify them without a parameter name, as long as you specify positional parameters in the correct order. This is...
  • Network Segment Scan

    In a previous tip, we created a Check-Online filter to eliminate offline systems from a list of IP addresses and computer names. Now, find out what you can do with that! For example, try to auto-generate IP-addresses for a network segment and return host...
  • Create Hardware Inventory

    If you need to collect hardware and/or software information from a bunch of remote systems, you should take advantage of the Check-Online filter discussed in the previous tip, and use WMI: "127.0.0.1" , "server12" , "pc-01-w3"...
  • Filter Out Unavailable Servers

    Even PowerShell v.1 has remarkable remoting capabilities--as long as you can make sure the target systems are online. Otherwise, you run into lengthy network timeouts. Here is a quick filter you can use to filter lists with IP addresses and computer names...
  • Finding Unused Drives

    You can use a cmdlet called Test-Path to test whether a given path exists. However, existing drives not currently in use, such as a CD-ROM drive, will be reported as not present. Therefore, test-path would never report a CD-ROM drive as present when no...
  • Find Next Available Drive Letter

    What if you needed to map network drives during log-on? You could use fixed drive letters, but what if those drive letters are already in use? Here is a clever way of finding available drive letters: function Get-NextFreeDrive { 68..90 | ForEach-Object...
  • Exporting Certificate With Private Key

    Certificates are digital identities, and when you already own the private key to a certificate, you own this identity. You can then use these certificates to sign e-mail or PowerShell scripts. To prevent personal certificates from getting lost, you should...
  • Exporting Certificate

    PowerShell has a cert: drive that lets you explore all certificates installed on your system. Once you locate a certificate, you can then export it to a file with just a couple of lines of code - provided that the certificate allows itself to be exported...
  • Listing Official PowerShell Verbs

    As you probably know, PowerShell cmdlets adhere to a strict verb-noun syntax. You cannot choose just any verb when you compile your own cmdlets in a snap-in, but are limited to "approved" official PowerShell verbs. However, there is no guidance...
  • Asynchronous Downloads with BITS

    In a previous tip, you learned how to use BITS on Windows 7 to download files in the background. One issue with this approach is that the download worked only as long as PowerShell ran and also blocked the PowerShell console. BITS would not continue if...
  • Download Files With BITS

    Windows 7 comes with a new module called BitsTransfer. This allows you to schedule downloads so they can download in the background using the BITS service. The main advantage is that BITS can download even large files dependably because it can resume...
  • Listing Cmdlets by Snap-In

    While Get-Command delivers a list of available cmdlets, sometimes you'd like to find out which new cmdlets come from a specific snap-in. Let's say you have downloaded and installed a new snap-In and would like to know its new cmdlets. Simply use...
  • Exploring Cmdlets Added by Snap-ins

    You will find cmdlets available in PowerShell can come from two sources: PowerShell-SnapIns and (new in v.2) modules. Try this to see which cmdlets are available and where they come from: Get-Command -commandType Cmdlet | Sort-Object PSSnapin, Module...
1 2 Next >
Copyright 2012 PowerShell.com. All rights reserved.