The ISE has a new look in PowerShell v3. The scripting pane remains but the output and interactive panes have been amalgamated to produce a single console like pane.

When I first saw it I didn’t like it but after jumping between PowerShell v2 and v3 recently the single console pane has grown on me and I actually prefer it as a way of working.

If you haven’t looked at PowerShell v3 yet now is the time to start. With the release candidate of Windows 8 expected in early June we will get the RC of PowerShell v3. Barring any last minute changes (more likely to be removals than additions – its just the way it works) thats what we will be working with once it ships.

My ISE add-ons like the ISE pack from the Windows 7 PowerShell powerpack still appear to work in the v3 version.

Many WMI classes have methods. Methods allow us to perform some action on the object. A recent question on the forum about using methods made me realise that there are still a lot of people following the old VBScript way of doing things.

We will experiment with the BITS service as it is safe for these purposes.

The person asking the question was trying to use the InvokeMethod method

$service.InvokeMethod('StopService',$Null)

and wondering why it was failing. If you look back to the list of methods above you won’t see InvokeMethod. That’s because it is on the base object. PowerShell, in many instances, doesn’t return the pure .NET object. There are methods and properties added or removed to create the object we normally see.

LocalSystemHost - Activate provider in the provider host process that is running under the LocalSystem account.

LocalSystemHostOrSelfHost - The provider is self-hosted or loaded into the Wmiprvse.exe process running under the LocalSystem account.

NetworkServiceHost - Activate provider in the provider host process that is running under the NetworkService account.

LocalServiceHost - Activate provider in the provider host process that is running under the LocalService account.

NetworkServiceHostOrSelfHost - The provider is self-hosted or loaded into the WmiPrvse.exe process running under the NetworkService account. NetworkServiceHostOrSelfHost is the default configuration when the HostingModel property in __Win32Provider is NULL. Because NetworkServiceHostOrSelfHost is the default, providers from earlier operating systems can continue to work in Windows Vista, Windows Server 2008, and later operating systems.

Get-CIMInstance is a new cmdlet in PowerShell v3. It is part of the new API for working with WMI. I will be blogging about these in greater detail over the next weeks and months as Powershell v3 is released.

The –FilterScript parameter (positional as 1 so don’t have to use it) supplies a script block that performs the filtering. In this case it looks at the current object on the pipeline (indicated by $_) and compares the CPU property to 25. If the property has a greater value it is passed.

Any of the comparison operators could be used in the filter block.

With PowerShell v3 it gets easier

Get-Process | where CPU -gt 25

We can just give the property name, the comparison operator and the value.