Powershell 在其他用户上安装证书';s当前用户存储
我当前正在使用以下代码将证书从本地计算机存储添加到当前用户存储,其中$cert是证书Powershell 在其他用户上安装证书';s当前用户存储,powershell,x509certificate,powershell-4.0,Powershell,X509certificate,Powershell 4.0,我当前正在使用以下代码将证书从本地计算机存储添加到当前用户存储,其中$cert是证书 $DestStoreScope = 'CurrentUser' $DestStoreName = 'My' $DestStore = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList $DestStoreName, $DestStoreScope $DestStore.Ope
$DestStoreScope = 'CurrentUser'
$DestStoreName = 'My'
$DestStore = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList $DestStoreName, $DestStoreScope
$DestStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
$DestStore.Add($cert)
$SourceStore.Close()
$DestStore.Close()
是否有一种方法可以将此证书添加到此计算机上的其他用户当前存储。它将在管理员帐户下运行。任何帮助都将不胜感激。如果你还需要什么,请告诉我
CurrentUser
/HKEY\U CURRENT\U USER
是注册表中的一个抽象。实际用户数据存储在键HKEY\U USERS\
中。由于CurrentUser
总是指当前登录的用户,并且API不允许通过用户的SID访问证书存储,因此您的唯一选项(AFAICS)是在您希望安装证书的用户的上下文中运行脚本。和HKEY\U USERS\
只是%USERPROFILE%\NTUSER.DAT的表示形式。如果在RegEdit中选择了HKEY_用户
,则可以转到文件->加载配置单元
,并通过导航到该文件来加载已卸载的用户注册表。