You always get back all instances of a given WMI class when using Get-WMIObject. However, what if you just wanted to get a specific instance? Or you...
posts-powershell
Free Space on Disks
You can use WMI to determine how much free space is available on any given disk: Get-WMIObject Win32_LogicalDisk | Foreach-Object { 'Disk {0}...
Converting User Input to Date
PowerShell uses the US/English date format when converting user input to DateTime, which can cause unexpected results if using a different culture....
Casting a Type Without Exception
Read-Host is a useful cmdlet to use to ask for user input. However, it returns user input always as generic string. Of course, you can always...
Order Matters
Here is a challenge for you. The following code is a simple currency converter. However, when you run it, you'll notice it doesn't convert...
Filtering Based On File Age
Every so often, you'll need to filter files by age. Maybe you'll only want to see files that are older than 20 days old and delete them or...
Accessing Date Methods
While Get-Date returns the current date and time, it really returns a DateTime object. You can use this object to find out more about the date or to...
Using Cultures
Since PowerShell is culture-independent, you can pick any culture you want and use the culture-specific formats. The following script instantiates...
Outputting Nicely Formatted Dates
Get-Date provides you with the current date and time. With the -format parameter, you can add style to it. For example, use -format with a lowercase...
Stopping and Disabling Services
You may find that Vista's new Instant Search can sometimes get out of hand and slow down your machine. Temporarily disabling and then stopping...
Multidimensional Arrays
PowerShell supports two types of multi-dimensional arrays: jagged arrays and true multidimensional arrays. Jagged arrays are normal PowerShell...
Manipulating Arrays Effectively
While you can add and remove array elements with PowerShell arrays, this is an expensive operation and not recommended with large numbers of...