Get-wmiobject vs wsman

I’ve been using get-wmiobject on remote machine with much convenience and flawlessly for years. What makes me wonder why is it so easy to access the classes within WMI remotely? And when the properties I need does not have an associated WMI class,I need to resort to start a CIM session remotely which always failed. Apparently WSMAN and psremoting needs to be enabled on remote machine in cim session scenario.

I don’t think this is really PowerShell help but it’s close enough that I’ll take a stab at the answer. TLDR;I think the answer is an increase in security. IIRC WMI remotely you need to be a local admin of the remote system and perhaps a few ports open, but there was a range of ports. Speaking from memory I don’t recall the specifics, I’m sure there’s an article on google somewhere. I think the PSRemoting was considered more secure.

1 Like

Just an FYI, Get-WmiObject has been deprecated. You can use Get-CimInstance instead.

Get-WmiObject is deprecated in PowerShell 3.0 and above.The preferred cmdlet is now Get-CIMInstance -Classname … Run Get-cimclass to discover the new property names. Basic speed comparison testing shows that CIM is significantly faster

2 Likes

Thank you for answering

I managed to get remoting to work with cIM session with DCOM protocol. I think this works best for me as I can acess both WMI and non WMI classes. Not every machines were psremoting enabled.