Reputation: 352
I have follow issue: I trying to run remote command on my server (windows server 2012 r2) via powershell command, powershell script looks follow
$password = ConvertTo-SecureString $pass -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PsCredential($deployadmin,$password)
$scriptBlock1 = {Get-NetAdapter}
Invoke-Command -computername $server -Credential $credentials -scriptblock $scriptBlock1
and I've get an error 'Access is denied'
I've tryied to run on server Enable-PSRemoting
for allow remote connection.
I use credential for user that is Administrator on that server.
Strange thing, that this command is succeeds for credentials of another user on this server, those user is also Administrator.
What I'm missing ? Thank for any advice
Update:
command Test-WSMan $server
is succeeds
try command winrm quickconfig
the system suggested setting up a remote access, after the configuration, the Invoke-Command
command was executed without errors
I would be grateful if anyone would explain this behavior
Upvotes: 0
Views: 1786
Reputation: 4178
Fun!
When you execute winrm quickconfig
the following happens:
This article has additional detail.
Upvotes: 1