Bra*_*tch 4 powershell certificate code-signing
PS cert:\currentuser\my> dir
Get-ChildItem : Access is denied.
At line:1 char:3
+ dir <<<<
Run Code Online (Sandbox Code Playgroud)
我无法访问我的任何代码签名证书来签署 PowerShell 脚本。我可以打开 MMC、证书,并看到我的代码签名证书已安装并在我的机器上有效(Windows XP SP 3)。
另一个奇怪的事情是我无法从 PowerShell 访问我的任何映射网络驱动器,但我可以在 Windows 资源管理器和 DOS 窗口中看到它们。
我已经卸载了 PowerShell,重新启动并重新安装了 PowerShell 1,但仍然有同样的问题。
编辑:我在这台机器上的日常帐户不是管理员,但我确实有一个管理员帐户,可以用于需要它的任务。代码签名证书分配给我的日常帐户,我应该不必成为管理员来签署代码。我不确定如何将此帐户权限授予证书存储区。
编辑 2: 我运行FileMon和RegMon来查看我被拒绝访问的内容。 cert:CurrentUser\My是文件夹C:\Documents and Settings\USERNAME\Application Data\Microsoft\SystemCertificates\My\Certificates。它还拒绝我访问C:\Documents and Settings\USERNAME\Local Settings\Temp. 我可以打开资源管理器并毫无问题地访问这些文件夹中的文件。我暂时授予Everyone了这些文件夹的完全权限,但仍然收到来自 PowerShell 的拒绝访问消息。
谷歌没有透露太多。我该怎么办?
来自 Windows PowerShell 事件日志的消息:
Provider Health: Attempting to perform the GetChildItems operation on
the 'Certificate' provider failed for path '\currentuser\my'. Access is denied.
Details:
ProviderName=Certificate
ExceptionClass=ProviderInvocationException
ErrorCategory=InvalidOperation
ErrorId=GetChildrenProviderException
ErrorMessage=Attempting to perform the GetChildItems operation on
the 'Certificate' provider failed for path '\currentuser\my'.
Access is denied.
Severity=Warning
SequenceNumber=146
HostName=ConsoleHost
HostVersion=1.0.0.0
.....
Run Code Online (Sandbox Code Playgroud)
听起来你有权限问题。
这是这台 PC 上的管理员帐户,您是否受域控制,并且是否启用了组策略?
我猜这台 PC 被锁定的次数比 PowerShell 想要的要多。有些管理员根本不允许它运行,因为它可能会造成一些损害。
运行
Set-ExecutionPolicy RemoteSigned
时有没有报错?
| 归档时间: |
|
| 查看次数: |
12729 次 |
| 最近记录: |