I’ve working with WMI a lot recently and frequently seen things like this
Get-WmiObject -Class Win32_OperatingSystem -ComputerName dc02
Get-WmiObject -Class Win32_ComputerSystem -ComputerName dc02
Get-WmiObject -Class Win32_LogicalDisk -ComputerName dc02
Each of these has to create a connection
is
$sb = {
Get-WmiObject -Class Win32_OperatingSystem
Get-WmiObject -Class Win32_ComputerSystem
Get-WmiObject -Class Win32_LogicalDisk
}
Invoke-Command -ScriptBlock $sb -ComputerName dc02
more efficient
In some cases yes depending on what you want to do with the information. Especially if need to filter data
By: Jason on August 2, 2011 at 10:40 am
Good method. But it requires WS-Management service running on the destination. On older servers it might be an issue.
By: RichardSiddaway on August 2, 2011 at 11:23 am
Yes it does but it can be installed on Windows 2003 and above.
Windows 2000 isn’t really an issue – its a year out of support and should be on the way out of the organisation if it hasn’t gone already.
By: Jason on August 2, 2011 at 2:40 pm
OT: for Windows 2000 boxes: it was easy to get rid of them when they were on the physical boxes – scheduled hw refresh would take care of it. But now after p2v’ed them, nobody bothers to touch them – the “if it ain’t broken, don’t fix it” mantality 🙁
By: RichardSiddaway on August 3, 2011 at 3:47 am
Agreed – I know of people still finishing off NT4 removal – but they do leave a security hole and have to go eventually