You can use WMI to quickly find all details about your mouse and keyboard: PS> Get-WmiObject win32_PointingDevice | Where-Object { $_.Description...
database-tools
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...
Displaying MsgBox TopMost
In a previous tip you learned how to load additional .NET assemblies. This enables you to display dialog boxes like a MsgBox, pretty much like in...
Loading Additional Assemblies
When you want to load additional .NET assemblies to extend the types of object you can use, there are two ways of loading them: the direct .NET...
Using Open File Dialogs
To spice up your scripts, PowerShell can use the system open file dialog, so users could easily select files to open or to parse. Here's the...
Make Your PowerShell Scripts Click-runnable
If you are like me, you hate having to type in the full path to a PowerShell script to run it.Wouldn’t it be nice if you could just execute...
Playing WAV files
PowerShell can play WAV files, so you can add sound and special effects to your scripts (provided your system has a sound card): PS> $player =...
Adding New Type Accelerators
To access popular .NET types faster, PowerShell maintains a list of shortcuts called "type accelerators". That's why you can use the...
Discovering Date and Time Culture Information
PowerShell automatically converts date and time information in various formats. If you'd like to know what formats are recognized by PowerShell,...
Installing Local Printer
WMI represents all locally installed printers with its class Win32_Printer, so you can easily look what's installed: PS> Get-WmiObject -Class...
Parsing Custom Date and Time Formats
Sometimes, date and time information is not formatted according to the standards PowerShell understands by default. When this happens, you can...
Discovering Network Access
PowerShell can access low-level COM interfaces to find out system information such as network access. This code returns a list of all active network...
Finding Constructors (and submitting Credentials unattended)
When you need to log on with alternate credentials, cmdlets often pop up a login dialog, like here: $cred = Get-Credential If you wanted to run a...
Checking Network Adapter Speed
Sometimes, just one line of PowerShell code gets you all the information you may have needed. There is a .NET type called NetworkInterface, for...
Finding WMI Class Static Methods
In a previous tip, we illustrated how to use Invoke-WmiMethod to create a network share locally and remotely. Today, you dive a bit deeper and find...
Converting Date from French to Taiwanese
Date and Time formats are highly culture-specific, so often you need to convert date and time from one cultural format to another. That's pretty...
Create File Shares Remotely
To create a new file share remotely, you could use the WMI class Win32_Share and its Create() method. Invoke-WmiMethod helps you run WMI methods...
Displaying WMI Inheritance
In PowerShell 3.0, the (hidden) object property PSTypeNames shows you the complete inheritance tree for WMI objects: PS> $os = Get-WmiObject...
Auto-Discovering Online Help for WMI
Get-WmiObject is a great and simple cmdlet to retrieve WMI information, and the parameter -List returns all available WMI class names that you can...
Using MemberSets
In a previous tip you learned how PropertySets can create groups of properties for easier access. Yet another (hidden) feature of PowerShell objects...
Using PropertySets
PropertySets are lists of properties, and PowerShell sometimes adds PropertySets to result objects to make picking the right information easier....
Getting Weather Forecast from an Airfield near You
PowerShell can access web services and automatically retrieve information such as weather forecasts. New-WebServiceProxy does all the work for you,...