问题
I was trying to find a specific certificate on my machine, and I ran into an odd issue. I was seeing The specified network resource or device is no longer available
errors when calling:
Get-ChildItem -Path "XXXXX" -Recurse
Where "XXXX"
was the thumbprint of the certificate I was looking for.
To try to narrow down the issue, I started by removing the thumbprint of my command (i.e. calling Get-ChildItem -Recurse
), and found that the script failed when trying to read from the UserDS
certificate store (see abbreviated screenshot of output, below):
I then tried to cd
into the UserDS
certificate store to see if it would even let me, and to see if I could see anything in that location. Upon trying to call ls
I received the same error (see below):
I can't figure out what's causing this issue or how to fix it. It's blocking me on the local installation of a client's solution, so any help or ideas are very much appreciated. Thanks!
回答1:
The UserDS
store (or Active Directory User Object
in the certmgr.msc
) displays active directory stored certificates of the user (see here, here, here and here).
The error 0x80070037
(the specified network resource or device is no longer available
) message occurs when a local device (like an usb stick is unavailable) or a network connection is interrupted while accessing a resource.
The store has a key in the windows registry (Computer\HKEY_CURRENT_USER\Software\Microsoft\SystemCertificates\UserDS
) and saves information on certificates which are read from active director.
I see two options:
- The information in the registry is corrupt
- you have issues accessing the active directory
If you want to handle the error when calling Get-ChildItem
look at this SO post
来源:https://stackoverflow.com/questions/57116536/powershell-fails-when-trying-to-read-certificate-store-with-the-specified-netwo