删除与CredsSP一起使用的委托计算机



我在桌面上启用了credssp客户端,以允许双跳远程对许多服务器进行远程远程操作。这些服务器中的一些现在已经取消了,所以我的问题是如何删除那些特定的代表,而不会禁用和重新确定credssp,这是我到目前为止所做的?

例如,要添加一个额外的委托:

Enable-WSManCredSSP -Role Client -DelegateComputer "mynewserver.mydomain.local"

所以我希望能够做类似的事情:

Remove-WSMANCredSSPDelegate -DelegateComputer "mynewserver.mydomain.local"

,但我所能做的就是

Disable-WSManCredSSP -Role Client

有什么想法?

委托计算机的设置保留在注册表中: software policies microsoft microsoft windows windows windows porterentialsdelegation 允许freshcredentials

我尝试直接修改这些值,但在可以删除的情况下发现它没有生效。幸运的是,使用注册表值,您可以将现有值与要保留vs vs vs vs vs vs vs vs vs vs vs vs vs/disable/reconable的值进行比较。

这是一个例子,如果需要,应该很容易转换为cmdlet:

$remove = 'COMPUTER-TO-REMOVE'
$item = Get-Item 'HKLM:SOFTWAREPoliciesMicrosoftWindowsCredentialsDelegationAllowFreshCredentials'
$keep = $item | Select-Object -ExpandProperty 'Property' `
    | ForEach-Object { $item.GetValue($_).TrimStart('wsman/') } `
    | Where-Object { $_ -ne $remove }
Disable-WSManCredSSP -Role Client
if ($keep) {
    Enable-WSManCredSSP -Role Client -DelegateComputer $keep -Force 1>$null
}
Disable-WSManCredSSP -Role Server

Disable-WSManCredSSP -Role Client

=所有清洁

最新更新