-
As a final test I want to see what happened when I ran multiple commands against the remote machine. PS> 1..100 | foreach { Measure-Command -Expression{1..100 | foreach { Get-WmiObject -Class Win32_ComputerSystem -ComputerName W12SUS; Get-WmiObject...
-
Following on from my previous post we’ll look at how the two types of cmdlets compare for accessing remote machines. I used a similar format to the previous tests but was accessing a remote machine. First off was the WMI cmdlet – using DCOM to access...
-
PowerShell provides the Stop-Computer cmdlet for closing down a remote machine. I find this especially useful in my virtual test environment. I’ll have several machines running but won’t necessarily have logged onto them. Using Stop-Computer means that...
-
The CIM cmdlets are found in the CIMcmdlets module. Get-Command -Module CimCmdlets produces this list of names. I’ve added some information on the tasks they perform Get-CimAssociatedInstance is for working with WMI associated classes...
-
An email debate yesterday regarding the use of the CIM cmdlets (new in PowerShell 3) vs the WMI cmdlets made me realise that other people are probably wondering the same thing, The question is really part of a the semi-philosophical debate about when...
-
Last time we saw the Get-NetAdapter cmdlet from the NetAdapter module PS> Get-NetAdapter | ft Name, InterfaceDescription, Status -a Name InterfaceDescription ...
-
The WMI classes Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration have seen a lot of use over the years. They can be a bit fiddly to use which is why the NetAdapter module in Windows 8/2012 is a so welcome. Lets start by looking at basic information...
-
When you used the WMI cmdlets Get-WmiObject -Class Win32_logicalDisk -ComputerName RSLAPTOP01 You were using DCOM to access the remote machine. Even if you accessed the local machine you were using DCOM. This changes in PowerShell v3 when using the CIM...
-
A forum question regarding retrieving WMI based data from multiple servers and displaying it as HTML was interesting. I would approach it like this $servers = Get-Content -Path C:\scripts\servers.txt $data = @( ) foreach ( $server in $servers )...
-
One thing that I don’t think I’ve mentioned is that the Get-CimClass output changed during the development process. In PowerShell v3 RTM you can dig into a WMI class like this Get-CimClass -ClassName Win32_OperatingSystem | select -ExpandProperty CimClassMethods...
-
PowerShell v3 features updateable help. The help files are not quite complete at the moment but a recent update to the help that is available brought a couple of very useful files: about_WMI about_WQL The first gives a good overview of WMI and the...
-
One parameter that seems to get overlooked on Get-WmiObject is the –Property parameter. It is used to specify the properties you want returned. This is what you would normally get by default: PS> Get-WmiObject -Class Win32_Service | select -f...
-
Background jobs were one of the most undervalued aspects of PowerShell v2. With the introduction of PowerShell v3 we get ways to schedule those jobs. In this post though I want to look at the new CIM cmdlets and jobs. Using the WMI cmdlets most PowerShell...
-
Every time I look at PowerShell v3 I seem to find a new way to access WMI! I’ve covered the –ComputerName and –CimSession parameters before but to recap We duplicate the way Get-WmiObject works: $computer = $env:COMPUTERNAME Get-CimInstance -ClassName...
-
In Windows 8/2012 you can mount a VHD into the file system. Is there a way to discover the drive letter of the mounted VHD function get-mountedvhdDrive { $disks = Get-CimInstance -ClassName Win32_DiskDrive | where Caption -eq "Microsoft Virtual Disk"...