Just a thought

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

Published Wed, Jul 27 2011 9:54 by RichardSiddaway

Comments

# re: Just a thought

Good method. But it requires WS-Management service running on the destination. On older servers it might be an issue.

Tuesday, August 02, 2011 10:40 AM by Jason

# re: Just a thought

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.

Tuesday, August 02, 2011 11:23 AM by RichardSiddaway

# re: Just a thought

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 :(

Tuesday, August 02, 2011 2:40 PM by Jason

# re: Just a thought

Agreed - I know of people still finishing off NT4 removal - but they do leave a security hole and have to go eventually

Wednesday, August 03, 2011 3:47 AM by RichardSiddaway

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: