2

I am implementing OMI client on CentOs in C++ to communicate with windows WMI I have installed OMI on Linux CentOS 7 and trying to connect to Windows 7 using the sample utility provided by OMI.

Reference: https://github.com/Microsoft/omi

Also configured WINRM on Windows to receive basic authentication calls.

I am not able to get the sample working. Getting the following error:

root@LinuxMachine bin]# ./omicli --auth Basic --hostname WinMachine.TEST.COM -u admin -p adminpassaword ei root/cimv2 Win32_Environment --port 5985
./omicli: result: MI_RESULT_FAILED
./omicli: result: ERROR_INTERNAL_ERROR: The WS-Management service cannot process the request. A DMTF resource URI was used to access a non-DMTF class. Try again using a non-DMTF resource URI.

Below is the WINRM configuration for the destination machine for reference

C:\Windows\system32>winrm get winrm/config

Config
    MaxEnvelopeSizekb = 150
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = true [Source="GPO"]
        Auth
            Basic = true [Source="GPO"]
            Digest = true [Source="GPO"]
            Kerberos = true [Source="GPO"]
            Negotiate = true [Source="GPO"]
            Certificate = true
            CredSSP = true [Source="GPO"]
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    Service
        RootSDDL = O:NSG:BAD:P(A;;AG;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GWGX;;;WD)
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 15
        EnumerationTimeoutms = 60000
        MaxConnections = 25
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = true
        Auth
            Basic = true [Source="GPO"]
            Kerberos = true [Source="GPO"]
            Negotiate = true [Source="GPO"]
            Certificate = false
            CredSSP = true [Source="GPO"]
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 180000
        MaxConcurrentUsers = 5
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 15
        MaxMemoryPerShellMB = 150
        MaxShellsPerUser = 5

Am I missing anything obvious? Any help with getting the sample working is much appreciated.

slayerbot
  • 75
  • 9
MUKHTAR INAMDAR
  • 85
  • 4
  • 17
  • 1
    can someone who have rights please add omicli or omi tag https://github.com/Microsoft/omi – MUKHTAR INAMDAR Aug 20 '18 at 15:53
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Aug 20 '18 at 16:54
  • @jww I need to implement the omi client on cent os in C++ to communicate remotely with windows.but before that I have to install omi and check if it getting connected using sample utility that comes with library i.e. omicli – MUKHTAR INAMDAR Aug 21 '18 at 03:57
  • @jww I check the link https://stackoverflow.com/help/on-topic It is mentioned over there that we can ask question for 'https://stackoverflow.com/help/on-topic' and the question is regarding 'omicli' developer tool provided as a sample for omiclient So I feel the question is not a off-topic so please help me not getting any information why it is not able to connect – MUKHTAR INAMDAR Aug 21 '18 at 04:09

1 Answers1

2

I had encountered similar issue. I have resolved this by upgrading power-shell version on my server.

Windows 7 by-default shows uses powershell version 2.0.

PS C:\> test-wsman <clientName>

wsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor   : Microsoft Corporation
ProductVersion  : OS: 0.0.0 SP: 0.0 Stack: 2.0

By-default CIM session uses WSMAN protocol, specifically newer version of protocol. This won't work for computers running powershell version 2.0 or no powershell at all. Upgrade your to resolve this issue.

Refer URL https://mcpmag.com/articles/2013/05/07/remote-to-second-powershell.aspx for more details.

  • 1
    Thanks I have download and installed Poswershell of version 4.0 from https://www.microsoft.com/en-in/download/details.aspx?id=40855 then try same command from Cent OS machine it is executed successfully – MUKHTAR INAMDAR Aug 21 '18 at 07:49