The environment variable $env:Path lists all paths that are included in the Windows search path when you launch an application. Likewise,...
Powershell
Finding Disk Partition Details
To view disk partitioning information, use WMI: Get-WmiObject -Class Win32_DiskPartition | Select-Object -Property * Next, pick the properties you...
Setting Default Email Address for AD Users
Scripting Active Directory does not necessarily require additional modules. With simple .NET Framework methods, you can achieve amazing things. In...
Use a Lock Screen
With WPF, PowerShell can create windows in just a couple of lines of code. Here's a funny example of a transparent screen overlay. You can call...
Creating Temporary Password
Here's a chunk of code that creates random passwords of different lengths for you: $length = 8 $characters = [Char[]]((31..50) + (65..90) +...
Obfuscating Credentials
How can you securely embed confidential passwords in a PowerShell script? You can't. But you can make it harder for people to discover the...
Create a Folder Selector
To add a little glamour to your scripts, here are a few lines of code that display a folder selector dialog. When a user selects a folder, your...
Getting Folders by Prefix
Did you know that Group-Object can easily group elements by custom criteria? Here's a line that groups folders by their first three letters:...
Finding Known USB Drives
Did you know that Windows maintains a list of all USB storage devices ever hooked up to your machine? And it's simple to dump that list: $Path =...
Getting DLL File Version Info
Ever needed a list of DLL files and their versions? Get-ChildItem can get this information for you. You just need to unpack some properties like so:...
Executing Code Remotely
In a domain environment, PowerShell remoting is working almost out of the box. All you might have to do is enable Remoting on target machines...
Accessing All Users Desktop
Resolve-Path is an excellent cmdlet to find paths that have the same nesting level. For example, here's a really short script that creates a text...
Quickly Selecting Results in ISE
If you'd like to quickly select and copy results from the Console Pane of the PowerShell 3.0 ISE editor into your blog or favorite word...
Speeding Up Multiple WMI Queries
Whenever you run Get-WmiObject against a remote system, it will create a new connection. So if you query different WMI classes, each query will use...
Visit the Ultimate PowerShell Survival Guide
Are you familiar with the PowerShell Survival Guide? It's the ultimate PowerShell Wiki page, including videos, modules, and information about...
Getting WMI IntelliSense
Get-WmiObject provides no IntelliSense for WMI classes, so you either need to know the WMI class name off hand, or use the parameter -List to search...
Listing "Real" Hard Drives
WMI can provide lots of information about a system, but sometimes it is just a bit too much. So when you query for logical disks, you often get back...
Improving Module Auto-loading
PowerShell 3.0 will auto-load modules as you have seen in a previous tip. However, with some modules, this technique may fail. Their cmdlets will...
Loading Modules Automatically
Beginning with PowerShell 3.0, PowerShell is smart enough to know which cmdlets are exported by which extension module. So you no longer have to...
Installing Server 2012 Desktop Experience
If you want to turn a Server 2012 (or Server 2008 R2) into a workstation machine and have it behave like Windows 8 (including the ability to burn...
Getting MAC Address Remotely
Here is an easy way to get the MAC address, even from a remote machine: Simply replace the IP address with the one you are interested in. You may...
Launching PowerShell as Different User
Once you pin PowerShell to your taskbar, you can always right-click the pinned PowerShell icon to open a jump list and launch PowerShell or the ISE...
Monitoring Log Files
Beginning in PowerShell 3.0, it is easy to monitor text-based log files in real-time. Try this: $Path = "$home\Desktop\testfile.txt"...
Press F1 to Navigate PowerShell Help Topics
To get extensive help for all kinds of PowerShell operators in the PowerShell 3.0 ISE editor, first list all the different help topics about...