Search code examples
powershellwindows-server-2012windows-server-2012-r2

Invoke-command doesn't need credentials


I have 2 servers (windows server 2012 R2) in the same domain. I execute a command on server01:

Invoke-Command -ComputerName server02 -Credential Administrator -ScriptBlock {Get-Culture}

I give the password of my Administrator (of server2) and it works well. But when I try:

Invoke-Command -ComputerName server02 -ScriptBlock {Get-Culture}

It also seems to work. Probably because the 2 servers are in the same domain. While I only want it to work when you can provide the right credentials. Can someone help me with it?


Solution

  • You are probably doing this by Domain Admin account or account that it's in Domain Admins group or so.

    In any case this results because your account has privelegies on that computer.