我試圖修改UAC的權限與PowerShell腳本工作時像:拒絕PowerShell的管理員權限修改UAC
Start-Process powershell -Verb runAs Administrator
Set-ItemProperty -Path registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -Value 0
$UAC = Get-ItemProperty -Path registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA
$UAC.EnableLUA
即使我運行該腳本作爲管理員,我仍然得到以下錯誤:
Set-ItemProperty : Requested registry access is not allowed. At C:\Users\Bert\Desktop\autoLims.ps1:8 char:17 + Set-ItemProperty <<<< -Path registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -Value 0 + CategoryInfo : PermissionDenied: (HKEY_LOCAL_MACH...policies\system:String) [Set-ItemProperty], SecurityException + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.SetItemPropertyCommand
爲什麼它不會運行,即使我運行的腳本作爲管理員的腳本任何想法?還有什麼我需要改變?
我想你想只是'-Verb runAs' - 沒有'Administrator' – 2013-04-26 16:47:59
如果你想的是一個答案,我給你點。 – Thomas 2013-04-27 16:43:35