Powershell

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...

read more

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...

read more

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...

read more

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...

read more

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,...

read more

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...

read more

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....

read more

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...

read more
1 88 89 90 91 92 130