Tags » Powershell-basics

CIM filters

I was looking up Win32_SystemDriver on the MSDN site and noticed there was some PowerShell example code

Get-WmiObject -Class Win32_SystemDriver |
Where-Object -FilterScript {$_.State -eq “Running”} | … 77 more words

PowerShell And WMI

Multiple expands

PowerShell outputs objects but sometimes you need just the values. The –Expandproperty parameter of select-object can pull the values from a property. Compare:

£> Get-VM | select Name… 221 more words

Powershell Basics

Playing with the range operator

The range operator allows you to reference a range of numbers


is equivalent to


If you want anything other than numbers you’re stuck as the range operator only works with integers… 53 more words

Powershell Basics

Typing variables

I was recently asked a question about typing variables after thinking about it came up with this demonstration.

Create a variable with an integer value… 263 more words

Powershell Basics

Modifying text

I needed to modify some text somewhere in a file. The file looks like this

## start file
This is some text.

I want to change something. 180 more words

Powershell Basics

Variable select

I was working on some code that accesses a SQL database this afternoon. I only needed to pull back a single column from a single row but which column to pull back is variable depending on other data. 164 more words

Powershell Basics

Awkward file and folder names

Spent some time today dealing with a situation where there were special characters – namely [ ] in folder a file names

£> Get-ChildItem -Path C:\Test… 348 more words

Powershell Basics