I'm trying to connect to a Windows Machine via PowerShell in a Linux Machine to get some system's info, but I need to achieve it without use the WinRm.
Firstly, I installed the PowerShell following the instructions here. Starting the PowerShell with
pwsh worked fine.
Then I tried to get some info through WMI using the following command:
Get-WmiObject -Class Win32_Process -Impersonation 3 -ComputerName IP_ADDRESS
The return is
Get-WmiObject : The term 'Get-WmiObject' is not recognized as the name of a cmdlet, function, script file, or operable program..
Following the changelog for the version 6.0 of PowerShell's core, I found that the Get-Wmi* functions should be replaced for Get-Cmi* equivalents. Let's try:
Get-CimInstance -Class Win32_Process -Impersonation 3 -ComputerName IP_ADDRESS
The return is:
Get-CimInstance : The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program.
Looking for the list of commands, typing
Get- and then Tab, the return indeed does not show any Wmi or Cim function.
I'm able to connect to the same computer using the cmdlet
Invoke-Command, but as I said, I need to achieve it without the use of WinRm, and, apparently, this is not the case of Invoke-Comand
Finally, I found this blog post with fits like a glove with my needs. However, It suggest the use of the cmdlets
Invoke-CimMethod that, for surprise of nobody, aren't recognized commands.
My question is: Are there anyway to run a WMI query to get some Windows info through PowerShell in a linux machine without the use of WinRm?
Note1: I'm able to run the
Get-Cim* cmdlets in Windows machine PowerShell (connected via RPC, for example);
Note2: I know a workaround to deal with it in linux without PowerShell and it should work for someone with similar problem, but it didn't work for me due to an unsolvable (for now, at least) encoding problem;
OS: Debian 8.10
Remote Windows: W10 Pro