Friday, June 4, 2021

To enable winRM

To enable winRM

Source: https://support.infrasightlabs.com/help-pages/how-to-enable-winrm-on-windows-servers-clients/#:~:text=In%20the%20Group%20Policy%20Management,configuration%20of%20listeners%E2%80%9D%20policy%20setting.

test winRM is working or not.
PS C:\Users\ctdh4743> Test-WSMan


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: 3.0

follow below 
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\WINDOWS\system32> winrm enumerate winrm/config/Listner
WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request. The resource URI does not support the Enumerate operation.

Error number:  -2144108495 0x80338031
The WS-Management service cannot process the request because the WS-Addressing Action URI in the request is not compatible with the resource.
PS C:\WINDOWS\system32> winrm emunerate winrm/config/Listner
Error: Unknown operation name: 'emunerate'
PS C:\WINDOWS\system32> winrm enumerate winrm/config/Listner
WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request. The resource URI does not support the Enumerate operation.

Error number:  -2144108495 0x80338031
The WS-Management service cannot process the request because the WS-Addressing Action URI in the request is not compatible with the resource.
PS C:\WINDOWS\system32> $url = https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
>>
>>
>> ^C
PS C:\WINDOWS\system32> $url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> $file = "$env:temp\ConfigureRemotingForAnsible.ps1"
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
PS C:\WINDOWS\system32> powershell.exe -ExecutionPolicy ByPass -File $file
Self-signed SSL certificate generated; thumbprint: 2239709A676E19C945F2A6CDA58D93D01F465D06


wxf                 : http://schemas.xmlsoap.org/ws/2004/09/transfer
a                   : http://schemas.xmlsoap.org/ws/2004/08/addressing
w                   : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
lang                : en-US
Address             : http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
ReferenceParameters : ReferenceParameters

Ok.



PS C:\WINDOWS\system32> winrm enumerate winrm/config/Listner
WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request. The resource URI does not support the Enumerate operation.

Error number:  -2144108495 0x80338031
The WS-Management service cannot process the request because the WS-Addressing Action URI in the request is not compatible with the resource.
PS C:\WINDOWS\system32> winrm enumerate winrm/config/Listener
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 127.0.0.1, 192.168.29.167, 192.168.29.226, ::1

Listener
    Address = *
    Transport = HTTPS
    Port = 5986
    Hostname = EQ-EQ6283300
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint = 2239709A676E19C945F2A6CDA58D93D01F465D06
    ListeningOn = 127.0.0.1, 192.168.29.167, 192.168.29.226, ::1















Get-WmiObject -Class Win32_ComputerSystem -ComputerName 192.168.100.100 -Credential domain\mywmiuser

No comments: