Change in Win32_Process

50 views Asked by At

I wrote a bunch of functions using Win32_Process to query remote computers. Primarily I used it to get the owner of the processes running on the remote machine to find out which one was currently logged in, so I can do some user specific changes.

I upgraded to Powershell 7 and this has broke all of my functions I used win32_process in because, this class no longer has the getowner method or getownersid method.

I did notice in Powershell 7 console it is showing this

PS ~> get-wmiObject -Class win32_process | GM

TypeName: Deserialized.System.Management.ManagementObject#root\cimv2\Win32_Process

This is different when I am running in a Powershell 5 console

PS ~> get-wmiobject -Class win32_process | gm

TypeName: System.Management.ManagementObject#root\cimv2\Win32_Process

Is there a way I can change Powershell 7 to use the older style of Win32_process that Powershell 5 used?

I've looked online, but haven't seen anything on these changes of win32_process. The place I work at does not have WinRM turned on, so changing to CIMInstance isn't an option for me at this moment.

0

There are 0 answers