If you use PowerShell 3.0 and the ISE editor, then here are the three most useful tricks you should know: 1. Press CTRL+J to open a list of...
powertips
Vertical Grid View
You can always pipe objects to Out-GridView and get a nice extra window with all of the object properties lined up as table. That's useful if...
Go to Function Definition on F12
If you are into writing long and complex PowerShell code with a lot of functions, then this one is for you. In other development environments, when...
Adding New Type Accelerators in Powershell
If you find yourself using certain .NET types frequently, you may want to make your life easier and implement shortcuts. For example, there is a...
Finding Type Accelerators
PowerShell maintains a list of shortcuts for .NET types to make coding more convenient for you. For example, to convert a string to a DateTime type,...
Returning Multiple Values
A PowerShell function can return multiple values. To receive them, simply assign the result to multiple variables: function Get-DateTimeInfo { #...
Get Quotes From the Webservices
There are plenty of free webservices around, and provided you have direct Internet access (no proxy), you can use New-WebServiceProxy to access...
Using Safe Cmdlets Only
Let's assume you want to set up a restricted PowerShell v3 console that just provides access to Microsoft cmdlets with the verb Get. One way to...
Check Installed Server Roles and Features
Beginning with Server 2008 R2, there is a PowerShell module called ServerManager that you can use to manage server features and optional components....
Finding Published Printers
Finding printers that have been published in your Active Directory becomes trivial with Windows 8 or Server 2012. PS> Get-Printer -ComputerName...
Calculating Time Differences Using Custom Formats
Calculating time differences is easy - provided you can convert the date and time information into a DateTime type. If the date is in a custom...
Get CPU Load
To get the average total CPU load for your local system or a remote system, use Get-Counter. The example below returns the average total CPU load...
Calling WMI Methods with CIM Cmdlets
It can be very useful to call WMI methods, for example to create new shares, but in PowerShell v2 you had to know the names and exact order of...
Temporarily Activate High Performance Power Plan
It may be useful to automatically and temporarily switch to a "high performance" power plan from inside a script. Maybe you know that a...
Listing Power Plans
There is a somewhat hidden WMI namespace that holds WMI classes you can use to manage power plans. The code below lists all power plans on your...
Mixing DCOM and WSMan in WMI Queries
Using the new CIM cmdlets in PowerShell v3, you can run remote WMI queries against multiple computers using multiple remoting protocols. The sample...
New Operator -In
In PowerShell v3, you can use a new simplified syntax for Where-Object. Both lines below list all files in your Windows folder that are larger than...
Removing Leading "0" in IP Addresses
Leading "0" in IP addresses can cause confusion because many network commands interpret octets with leading "0" as octal...
CIM-Cmdlets Work Against Old Windows Boxes
The new CIM cmdlets require PowerShell v3, but you can still remotely target older boxes without PowerShell v3 or PowerShell at all. By default, CIM...
New WMI Cmdlets with DateTime Support
In PowerShell v3, to work with WMI you can still use the old WMI cmdlets like Get-WmiObject. There is a new set of CIM cmdlets, though, that pretty...
Finding Keyboard and Mouse
You can use WMI to quickly find all details about your mouse and keyboard: PS> Get-WmiObject win32_PointingDevice | Where-Object { $_.Description...
Finding Built-In Variables Part 2
In a previous tip we featured a piece of undocumented code that works in PowerShell v3 to list all built-in variables. Here is another approach that...
Adjust Text to Specific Length
If you must make sure that a text has a fixed length and is neither shorter nor longer, here is the code to pad and cut the text to the desired...
Finding Built-In Variables
Finding Built-In Variables...