0

ユーザー資格情報への応答ファイルを使用して Invoke-Command を実行しようとしていますが、実行を完了できないようです。私はローカル管理者アカウントを使用しているため、ドメインには何もありません。ここに私が持っているものとエラーがあります:

$Username = "$Env:Computername\admin"
$Pass = ConvertTo-SecureString "12345" -AsPlainText -Force
$User = New-Object Management.Automation.PSCredential($UserName, $Pass)

Invoke-Command -ComputerName $Env:Computername -Credential $User -ScriptBlock { 
    $Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
    $Name = 'DontDisplayLastUserName'
    Set-ItemProperty -path $Path -name $Name -value 0
} 

そしてエラー:

[computer] Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: There are curren
tly no logon servers available to service the logon request.  

どんな助けでも大歓迎です。

作業ソリューション:

$Username = "$Env:Computername\admin"
$Pass = ConvertTo-SecureString "12345" -AsPlainText -Force
$User = New-Object Management.Automation.PSCredential($UserName, $Pass)

Invoke-Command -ComputerName localhost -Credential $User -ScriptBlock { 
    $Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
    $Name = 'DontDisplayLastUserName'
    Set-ItemProperty -path $Path -name $Name -value 0
} 
4

1 に答える 1

1

私は最終的に問題を理解し、ランダムに私を襲った。次の行を変更する必要がありました。

前:

Invoke-Command -ComputerName $Env:Computername

後:

Invoke-Command -ComputerName localhost

localhost がなければ、リモート コンピュータのように見え、アクセスを許可しませんでした。

于 2012-12-26T20:16:25.367 に答える