Winrm allows me to query WMI via the WS-MAN protocol as opposed to DCOM. However, in the DCOM implementation I can retrieve the data types of the various properties of the various classes I query. However, if I use winrm I just get back the values. Is there any way to query the datatypes?
For example c:> winrm enum wmicimv2/* -dialect:wql -filter:"Select * FROM Win32_ComputerSystem"
Will return something like
<wsman:Results xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman/results">
<p:Win32_ComputerSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_ComputerSystem" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xsi:type="p:Win32_ComputerSystem_Type" xml:lang="en-US">
<p:AdminPasswordStatus>3</p:AdminPasswordStatus>
<p:AutomaticManagedPagefile>true</p:AutomaticManagedPagefile>
<p:AutomaticResetBootOption>true</p:AutomaticResetBootOption>
<p:AutomaticResetCapability>true</p:AutomaticResetCapability>
<p:BootOptionOnLimit xsi:nil="true"/><p:BootOptionOnWatchDog xsi:nil="true"/>
<p:BootROMSupported>true</p:BootROMSupported>
<p:BootupState>Normal boot</p:BootupState>
.....
However, as you can see, the data types are not there. I do know the data types because this is a standard Win32 object. The schema is online and I could statically figure it out. However, there may be custom classes. The DCOM Wmi approach allowed me to query the properties and find out a little more details about them, such as their data type and if they were an array or not. Can I do the same via winrm/wsman. I know this can be done via powershell. I'm looking for a winrm/wsman approach and not powershell
Thanks
You can do this multiple ways that will return an object which has them all in their defined data type. You can then take this object and get each values data type.
This give you the WMI object and you can do what you want with it from there. the $WMI.psobject.Members enumerates each value and allows you to loop through the object looking at each.
the Get-WmiObject is not useing WS-Management to connect to the remote computer and therefore dosen't require the remote machine to have WS-Management configured. It is using DCOM here. If you want to use WinRM you can use
$Results = Invoke-Command -scriptblock { get-wmiobject -class Win32_ComputerSystem } -computerName <ComputerName>
The variable in this one will be a Deserialized.System.Management.ManagementObject#root\cimv2\Win32_ComputerSystem but with a few added properties.