powertips

Restarting Computers in PowerShell

In PowerShell v3, Restart-Computer now has a number of useful new parameters. For example, you can restart a remote machine and wait for the reboot...

Colorizing PowerShell ISE v3

The new PowerShell ISE script editor in PowerShell v3 lets you customize a lot of colors, so if a particular color does not show well on a...

Out-GridView Grows Up

In PowerShell v2, Out-GridView was a useful way of displaying information in a separate window but its functionality was limited because you could...

Get-Content Can Now Read Raw Text

In PowerShell v3, Get-Content was reading text files line by line. This was great for pipeline processing but could take a long time and also...

Testing URLs for Proxy Bypass

If you'd like to find out whether a given URL goes through a proxy or is accessed directly, you can use this neat little trick: Function...

Downloading PowerShell v3 Help

Beginning with PowerShell v3, help is no longer shipped by default. Instead, in order to get help you need to download the help information from the...

Getting Relative Dates

Here's a quick and fast way of generating relative dates in any format: (Get-Date).AddDays(-1).ToString('yyyy-MM-dd') This would return...

PowerShell ISE v3 Keyboard Shortcuts

Note: Beginning now, we will include useful tips on PowerShell v3. PowerShell v3 is the next generation of PowerShell that is in public beta right...

Getting Movie Database Information

Here's a sample that illustrates how versatile PowerShell is. The function Get-Movie retrieves information about movies from the Internet....

Identifying PowerShell Host

If your script requires a real console, or if your script requires PowerShell ISE features, it may be a wise thing to check which host is actually...

Find WMI Classes

Get-WmiObject is a great cmdlet that returns all instances of a WMI class: PS> Get-WmiObject -Class Win32_LogicalDisk All you need to know is the...

Adding Type Accelerators

Type accelerators are shortcut names that represent .NET types. For example, you can use [XML] instead of [System.Xml.XmlDocument]. By default,...

Rename PowerShell Scripts

Rename-Item can easily batch-rename large numbers of files, simply by piping file objects into it. Here is a sample that finds all PowerShell script...

Verifying Restore Points

When you create a new restore point with Checkpoint-Computer, you do not get back any feedback telling you whether the operation succeeded....

Enabling and Disabling Computer Restore

In a previous tip we shared how you can use PowerShell to create restore points and restore your system state in case something went bad. There are...

Backing Up System State

Let's assume your script needs to change a bunch of system settings. The worst thing that could happen is if your script breaks in the middle of...

Discarding Unwanted Information

If you want to dump results from a command, there are a number of ways. While they all do the same, they have tremendous performance differences:...

Investigating USB Drive Usage

With two lines of PowerShell code, you can dump the USB storage history from your registry and check which devices were used in the past: PS>...

Installing MUI-Packs

The current PowerShell V3 Beta requires an English Windows operating system. That's bad news for anyone running Windows 7 Professional or Home...

Finding All Object Properties

By default, PowerShell only displays a limited set of object properties. To view all available properties, add the following pipeline element:...

Finding True WMI Properties

When you use Get-WmiObject to retrieve WMI objects, PowerShell adds a number of supporting properties. If you want to display only the native WMI...

Finding Current Script Paths

Here's a useful function that you can paste into your scripts. It will tell you the current location the script is executed from. function...

1 64 65 66 67 68 98