在PowerShell脚本中找不到驱动器

在PowerShell脚本中找不到驱动器,powershell,Powershell,这是我面临的问题。如何解决此问题?请尝试以下代码。我只能给出你文章中显示的内容,因此代码显然不完整,你需要在这行的其余部分添加代码 Get-ItemProperty : Cannot find drive. A drive with the name 'HKEY_LOCAL_MACHINE' does not exist. At E:\Uniformance Insight R102 Diagnostic Capture Tool (1).ps1:12 char:17 + $InstallInf

这是我面临的问题。如何解决此问题?

请尝试以下代码。我只能给出你文章中显示的内容,因此代码显然不完整,你需要在这行的其余部分添加代码

Get-ItemProperty : Cannot find drive. A drive with the name 'HKEY_LOCAL_MACHINE' does not exist. At E:\Uniformance Insight R102 Diagnostic Capture Tool (1).ps1:12 char:17 + $InstallInfo = (Get-ItemProperty %SystemDrive%\HKEY_LOCAL_MACHINE:SOFTWARE\Wow64 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (%SystemDrive%\HKEY_LOCAL_MACHINE:String) [Get-ItemProperty], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
确保检查您的隐私和文件夹权限

特别是防火墙,我已经看到了这样的问题,并且能够在关闭防火墙设置时修复


但在继续之前,请确保您了解此敏感设置。

PowerShell不支持%-变量,并且%systemdrive%对于注册表路径将无效。您好,欢迎使用StackOverflow。请花些时间阅读帮助页面,特别是命名和的部分。更重要的是,请阅读。您可能还想了解。
$InstallInfo = (Get-ItemProperty -Path HKLM:\SOFTWARE\Wow64....)