简体   繁体   English

解决 PowerShell 的“您当前无权访问此文件夹”问题

[英]Working around the "You don't currently have permission to access this folder" issue for PowerShell

When navigating to C:\\Users\\%SomeUsername% as an administrator on a Windows 2008 R2 server I get the error You don't currently have permission to access this folder , Click Continue to permanently get access to this folder .在 Windows 2008 R2 服务器上以管理员身份导航到C:\\Users\\%SomeUsername% ,我收到错误You don't currently have permission to access this folderClick Continue to permanently get access to this folder Clicking Continue resolves this problem.单击Continue可解决此问题。

If I try the same by PowerShell (eg get-childitem 'C:\\Users\\' -Directory | get-childitem -Force ; or some variant), any profiles to which I've not already granted myself access explicitly give the error Access to the path 'C:\\Users\\%SomeUsername%' is denied.如果我通过 PowerShell 尝试相同的操作(例如get-childitem 'C:\\Users\\' -Directory | get-childitem -Force ;或某些变体),我尚未授予自己访问权限的任何配置文件都会明确给出错误Access to the path 'C:\\Users\\%SomeUsername%' is denied. ; ; even with the Force switch included.即使包括强制开关。

Is there a way to "click continue" via PowerShell;有没有办法通过PowerShell“点击继续”; ie have the system give me access to anything which I don't strictly have access to, though as an administrator on the server can grant myself access to.即让系统允许我访问我没有严格访问的任何内容,尽管作为服务器上的管理员可以授予自己访问权限。 Ideally this would be done as I access the files (eg by a switch on the Get-Item command) rather than having to code something to explicitly go through all files checking and amending permissions.理想情况下,这将在我访问文件时完成(例如,通过Get-Item命令上的开关),而不必编写代码来明确检查所有文件并修改权限。

Make sure about start Powershell Run As Admin if you want always run it as administrator make shortcut from powershell.exe and follow this image :如果您想始终以管理员身份运行它,请确保启动 Powershell Run As Admin,从 powershell.exe 创建快捷方式并按照以下图像操作: 在此处输入图片说明

My mistake;我的错; I hadn't been running the PowerShell session as administrator (ie UAC).我没有以管理员身份(即 UAC)运行 PowerShell 会话。

  • right click on powershell.exe右键单击powershell.exe
  • run as administrator以管理员身份运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ForEachLoop 不能在 PowerShell 中工作,但我有完全访问权限是什么问题? - ForEachLoop not working in PowerShell, but I have full access what is the issue? PowerShell更改您不知道的内容 - PowerShell change something you don't know 将系统设置为有权通过Powershell写入文件夹 - Setting System to have permission to write to a folder via powershell 当您无法访问-Extension时,使用Select-Object是否合适? - Is using Select-Object suitable when you don't have access to -Extension? Powershell 无权访问网络共享 - Powershell doesn't have access to a network share Powershell - 如何返回没有“伙伴”的文件名的结果 - Powershell - how to return results of filenames that don't have a “partner” TFS构建系统中Powershell脚本中的工作文件夹问题 - Working folder issue in Powershell script in TFS build system 使用 powershell 解压缩并访问文件夹 - Unzip and access folder with powershell 变量似乎在 PowerShell 中的 function 内部不起作用 - Variables don't seem to be working inside of the function in PowerShell 如果您不知道,如何在Powershell中获取JSON对象的名称字段? - How do you get the name field of a JSON object in Powershell if you don't know it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM