WinRM cannot process the request

0

"Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x80090304 occurred while using Negotiate authentication: An unknown security error occurred."

I'm attempting to run scripts remotely to non-domain servers and the clients are also not part of a domain since our environment is based on MicroFocus eDirectory.

I've configured/tried the following on both client AND server:

winrm quickconfig
WinRM set winrm/config/client @{TrustedHosts="*"}
Set-item wsman:localhost\client\trustedhosts -value *  

And again, none of the machines are part of a domain but I assumed it would work with trustedhosts.

Code attempting to authenticate looks like this:

[xml]$windows=(Get-Content P:\script\windows.xml)

$windows.servers.host | ForEach-Object {

$password = ConvertTo-SecureString $_.pass -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "$_.name+$_.user",$password

Invoke-Command -ComputerName $_.name -Credential $credential -ScriptBlock {Get-Culture}
}  
powershell
powershell-remoting
winrm
asked on Stack Overflow Nov 30, 2016 by Patrik Persson

1 Answer

1

Your problem is in the formatting of the username. "$.name+$.user" will evaluate to a string with a + in the middle of it since the quotes are wrapped around both elements. correct way to write it would be "$($_.name)$($_.user)" or more likely if the source file does not place a trailing '\' on the name field "$($_.name)\$($_.user)"

answered on Stack Overflow Nov 30, 2016 by Mike Garuccio

User contributions licensed under CC BY-SA 3.0