microsoft / omi

Open Management Infrastructure
Other
367 stars 116 forks source link

omicli not show all the field of Win32_OperatingSystem class #710

Closed zhiqiangwang08 closed 9 months ago

zhiqiangwang08 commented 2 years ago

Runing the omicli command line with WQL as following:

omicli --auth NegoWithCreds --hostname ip-of-windows-server -u administrator -p 'passwrod' --port 5985 --encryption http wql root/cimv2 "Select * from Win32_OperatingSystem"

the response as following:

instance of Win32_OperatingSystem { BootDevice=\Device\HarddiskVolume2 BuildNumber=14393 BuildType=Multiprocessor Free Caption=Microsoft Windows Server 2016 Standard CodeSet=1252 CountryCode=44 CreationClassName=Win32_OperatingSystem CSCreationClassName=Win32_ComputerSystem CSName=WIN-I7CV3F0E9VA CurrentTimeZone=-420 DataExecutionPrevention_32BitApplications=true DataExecutionPrevention_Available=true DataExecutionPrevention_Drivers=true DataExecutionPrevention_SupportPolicy=3 Debug=false Description= Distributed=false EncryptionLevel=256 ForegroundApplicationBoost=2 FreePhysicalMemory=2665588 FreeSpaceInPagingFiles=496424 FreeVirtualMemory=3211208 InstallDate= instance of InstallDate { Datetime=2021-04-10T00:03:23-07:00 } LastBootUpTime= instance of LastBootUpTime { Datetime=2021-10-01T15:02:55.254027-07:00 } LocalDateTime= instance of LocalDateTime { Datetime=2021-10-05T20:55:35.961-07:00 } Locale=0809 Manufacturer=Microsoft Corporation MaxNumberOfProcesses=4294967295 MaxProcessMemorySize=137438953344 MUILanguages={en-US, en-GB} Name=Microsoft Windows Server 2016 Standard|C:\Windows|\Device\Harddisk0\Partition4 NumberOfLicensedUsers=0 NumberOfProcesses=53 NumberOfUsers=6 OperatingSystemSKU=7 Organization= OSArchitecture=64-bit OSLanguage=1033 OSProductSuite=272 OSType=18 PortableOperatingSystem=false Primary=true ProductType=2 RegisteredUser=Windows User SerialNumber=00376-30000-00299-AA408 ServicePackMajorVersion=0 ServicePackMinorVersion=0 SizeStoredInPagingFiles=720896 Status=OK SuiteMask=272 SystemDevice=\Device\HarddiskVolume4 SystemDirectory=C:\Windows\system32 SystemDrive=C: TotalVirtualMemorySize=4914148 TotalVisibleMemorySize=4193252 Version=10.0.14393 WindowsDirectory=C:\Windows }

And According to the document of Win32_OperatingSystem class! , the following fields missing:

CSDVersion LargeSystemCache OtherTypeDescription PAEEnabled PlusProductID PlusVersionNumber TotalSwapSpaceSize

And i can get all of them if use wmic seems the omicli is incompatible with wmic.

JumpingYang001 commented 2 years ago

@zhiqiangwang08 query from Linux to Windows was using by powershell core, I think no other products use that scenario now, could you share me you use in which product to query remote Windows information on Linux? yes, omicli and wmic has different implementation, now you can run omicli on Linux/Unix, and wmic on Windows, they have some difference.

zhiqiangwang08 commented 2 years ago

Samba have a tool need wmic which can run on Linux to query windows server events.

And the wmic can retrieve all the data fields, but omicli can't, some data fields missing.

JumpingYang001 commented 2 years ago

@zhiqiangwang08 interesting, thanks for sharing it! I heard wmic runs on Linux first time. :)

zhiqiangwang08 commented 2 years ago

@JumpingYang001
it is caused by: https://github.com/microsoft/omi/blob/master/Unix/wsman/wsmanparser.c#L1074-L1078 it will skip null properties.

Thanks

JumpingYang001 commented 9 months ago

there is no supported scenario for remoting from Linux to Windows now. just close it.