You can use Select-Object to add new properties to an existing object. In PowerShell v.2, Select-Object accepts a wildcard, which in turn adds all...
database-tools
Calculating Time Differences
Use New-Timespan and submit a date if you'd like to know how long it is until next Christmas. New-Timespan automatically compares this date to the...
Analyze Parameter Binding
You probably know that PowerShell is pretty flexible when it comes to parameters you want to submit to cmdlets and functions. You can name them...
Why is my PowerShell console not blue?
When launching powershell.exe directly, you get a console with black background and only 300 lines of buffer text. When you launch PowerShell from...
Don’t be surprised by the Help bug
Get-Help is great for discovering cmdlet and function syntax but sometimes it fails on PowerShell v.2. Take a look at this: Get-Help...
Making Comment-Based Help Compatible
In a previous tip, you learned how to add Comment-Based Help information to your own functions so that Get-Help can auto-document the usage....
Using Comment-Based Help
PowerShell v.2 allows your functions to seamlessly integrate with the built-in PowerShell Help system. All you need to do is a Comment-Based- Help...
Using Block Comments
Another new feature in PowerShell v.2 is the introduction of a new block comment. Basically, anything you place between <# and #> will be...
Creating Custom Objects
PowerShell v.2 has a new trick for creating your very own objects that you can then pass to other cmdlets. It is a two-step process. First, create a...
Finding Hidden Parameter Shortcuts
Many cmdlet parameters have built-in alias names that you can use instead of the full parameter name. So instead of "dir -ErrorAction...
Shortcuts for Cmdlet Parameters
You can shorten parameter names since cmdlet parameters are sometimes long and hard to type in. You will only need to enter as much of a parameter...
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 * |...
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] } |...
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...
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...
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...
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...
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,...
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...
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...
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...
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...
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...
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...