远程服务器登录错误
Remote server login error
您好,我想使用 power shell 登录到我的远程服务器。我为此编写了代码,但出现错误。
代码
$cred = get-credential - Prompts for username and password
Enter-PSSession -ComputerName servername -Credential $cred
错误
Get-Credential : A positional parameter cannot be found that accepts
argument 'Prompts'.At C:\documents\Untitled8.ps1:1 char:9
+ $cred = get-credential - Prompts for username and password
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-Credential], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetCredentialCommand
Enter-PSSession : Connecting to remote server XXXXX failed with the
following error message : Access is denied. For more information, see
the about_Remote_Troubleshooting Help topic.At
C:\documents\Untitled8.ps1:5 char:1
+ Enter-PSSession -ComputerName servername -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (servername:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
有关此的任何线索都会有所帮助....
Get-Credential : A positional parameter cannot be found that accepts argument 'Prompts'
任何人都知道如何使用服务器名登录到 power shell 中的远程服务器..任何关于此的 link 的线索都会有所帮助
问题是它无法找到接受 "Prompts" 的位置参数。如果您查看 Get-credential 的帮助文件,您会看到 -Credential 参数是位置参数,这意味着您不需要键入它。
试试这个
$cred = get-credential -Message "Prompts for username and password"
Enter-PSSession -ComputerName servername -Credential $cred
一些关于位置参数的阅读
https://itknowledgeexchange.techtarget.com/powershell/positional-parameters/
您好,我想使用 power shell 登录到我的远程服务器。我为此编写了代码,但出现错误。
代码
$cred = get-credential - Prompts for username and password
Enter-PSSession -ComputerName servername -Credential $cred
错误
Get-Credential : A positional parameter cannot be found that accepts argument 'Prompts'.At C:\documents\Untitled8.ps1:1 char:9 + $cred = get-credential - Prompts for username and password + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-Credential], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetCredentialCommand
Enter-PSSession : Connecting to remote server XXXXX failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.At C:\documents\Untitled8.ps1:5 char:1 + Enter-PSSession -ComputerName servername -Credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (servername:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
有关此的任何线索都会有所帮助....
Get-Credential : A positional parameter cannot be found that accepts argument 'Prompts'
任何人都知道如何使用服务器名登录到 power shell 中的远程服务器..任何关于此的 link 的线索都会有所帮助
问题是它无法找到接受 "Prompts" 的位置参数。如果您查看 Get-credential 的帮助文件,您会看到 -Credential 参数是位置参数,这意味着您不需要键入它。
试试这个
$cred = get-credential -Message "Prompts for username and password"
Enter-PSSession -ComputerName servername -Credential $cred
一些关于位置参数的阅读 https://itknowledgeexchange.techtarget.com/powershell/positional-parameters/