When you type winrm operation http://ServerName/wsman on a Windows Server 2003 R2 computer to send a request to a remote server using the Windows Remote Management command-line, Microsoft's implementation of the WS-Management protocol:
- The remote server send a http 302 status code to http://ServerName/wsman/. Notice the tailing slash.
- The WS-Management protocol repeats the request to the redirected URL.
- The remote server responds by sending a 401 authentication challenge.
Because of the added trailing slash, WinRM does not respond to the authentication challenge by sending credentials.
To workaround this behavior, use the -prefix switch:
winrm operation -machine:ServerName -prefix:wsman/ <ResourceURI>
Where <ResourceURI> is a short string that identifies a resource in the enterprise, such as a computer, a process, a disk drive, or a temperature sensor in a Baseboard Management Controller (BMC). The URI is the Web service addressing mechanism defined in Internet Engineering Task Force (IETF) Uniform Resource Identifier (URI): Generic Syntax \[RFC3986\].
NOTES: See the following: