To create a PSSession or run commands on a remote computer, by default, the current user must be a member of the Administrators group on the remote computer. Credentials are sometimes required even when the current user is logged on to an account that is a member of the Administrators group.
If you do not provide administrator credentials when they are required, Windows PowerShell generates the following error message.
Copy Code | |
---|---|
ERROR: ACCESS IS DENIED |
To provide administrator credentials
-
If the current user is a member of the Administrators group on the remote computer or can provide the credentials of a member of the Administrators group, use the Credential parameter of the New-PSSession, Enter-PSSession, or Invoke-Command cmdlets to connect remotely.
For example, the following command provides the credentials of an administrator.
Copy Code Invoke-Command -ComputerName Server01 -Credential Domain01\Admin01