When launching powershell.exe directly, you get a console with black background and only 300 lines of buffer text. When you launch PowerShell from...
database-tools
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...
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....
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...
How Module Import Works
It is a good idea to check out how PowerShell v.2 automatically detects and loads all available system modules. Simply look at the definition of the...