As promised, here's the transcript of the PowerShell commands I used in my talk:
TechEdTranscript.txt (107.64 KB)
The bulkservers scripts that I used were from Ben Pearce's blog: Administering Servers in Bulk. I've uploaded my versions of the scripts here: BulkServerScripts.zip
Following is a synopsis of the commands I used in the talk.
Get a list of all classes in the CIMV2 namespace:
> get-wmiobject -namespace "root\cimv2" -list
Get a list of all disks on a remote machine:
> gwmi -class win32_logicaldisk -computer columbus
Update the Volume Name of a disk. Note that often when making changes to WMI properties, you need to Put() the object to set your changes back on the original machine:
> $disks[0].VolumeName = "Kirks disk"> $disks[0].Put()
List hotfixes applied to a machine:
> gwmi win32_quickfixengineering | format-table hotfixid
Get a representation of the running OS. You can shutdown, reboot etc:
> $os = gwmi win32_operatingsystem
Get all the network adapters on a machine:
> $nics = gwmi win32_networkadapterconfiguration
You can update the IP addresses, netmasks etc:
> $mynic.enablestatic($newip, $newmask)
Get a list of the Hyper-V virtual machines:
$vms = Gwmi –namespace “root\virtualization” –class msvm_computersystem
Set one of the virtual machines to the running state:
> $VM.RequestStateChange(2)
I hope that these examples show you the variety and power of things you can manipulate using PowerShell over WMI. You can access almost every physical or logical device that is connected to your computer (or another computer on your network), as well as administer many different software products.
Kirk
Remember Me
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.