作者:倚栏听风 | 来源:互联网 | 2023-10-12 10:10
IamusingthefollowingfunctiontoreadremoteregistrykeysinpowershellbutInowneedtopass
I am using the following function to read remote registry keys in powershell but I now need to pass alternate credentials. How do I do that?
我使用以下函数来读取PowerShell中的远程注册表项,但我现在需要传递备用凭据。我怎么做?
I already have my credentials stored in $cred using the get-credential command.
我已经使用get-credential命令将我的凭据存储在$ cred中。
Param($computer)
$HKEY_Local_Machine = 2147483650
$reg = [WMIClass]"\\$computer\ROOT\DEFAULT:StdRegProv"
$Key = "SOFTWARE\Wow6432Node\Symantec\Symantec Endpoint Protection\CurrentVersion\SharedDefs"
$ValueName = "DEFWATCH_10"
$results = $reg.GetStringValue($HKEY_LOCAL_MACHINE, $Key, $ValueName)
write $results.sValue
1 个解决方案