I am able to connect to domain controller via below scrip remotely, but after that i want to run
Get-ADUser command but I am getting error
Get-ADUser : The server has rejected the client credentials.
How can I call active directory command in single script file?
$password = ConvertTo-SecureString "Password" -AsPlainText -Force $cred= New-Object System.Management.Automation.PSCredential ("Lab\dcadmin", $password) Enter-PSSession -ComputerName dc-01 -Port 5985 -Credential $cred