为什么 PowerShell ISE 不允许我在以管理员身份运行时设置断点?
无法让 PowerGUI 正常工作 我'我们又求助于 PowerShell ISE。但是,如果我以管理员身份运行它,它不会让我设置任何断点。
如果我正常启动(我的登录名是管理员成员),一切都很好,但因为我需要编写一些需要完全管理员权限的任务脚本,所以这是不好的。
我已将脚本保存为正确的文件(即它不是“untitled1.ps1”),但没有任何乐趣。
我运行的是 Windows 7 x64 Ultimate。
奇怪的是,这在我的 Windows 2008 R2 开发机上似乎不是问题(我以管理员成员身份登录,然后“以管理员身份”运行 PS ISE,并设置并命中断点。
有什么想法吗?会是吗?
Having failed to get PowerGUI to work properly I've fallen back on PowerShell ISE. However if I run this as Administrator it won't let me set any breakpoints.
If I launch as normal (my login is a member of Administrators) all is well but because I need to script some tasks that require full administrator rights this is no good.
I have saved the script as a proper file (i.e. it's not "untitled1.ps1") but no joy.
I'm running Windows 7 x64 Ultimate.
Strangely this doesn't seem to be a problem on my Windows 2008 R2 dev box (I'm logging in as user that is a member of Administrators then running PS ISE "As Administrator" and breakpoints are set and hit.
Any ideas why this would be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我也遇到了同样的问题,将文件保存到物理位置启用了所有调试功能。
I also faced the same issue, saving the file to a physical location enabled all debugging capabilities.
PowerShell 以及文件夹和文件名中的方括号似乎存在问题。
如果正在调试的脚本位于名称中包含
[
或]
的文件夹中,则 PowerGUI 和 PowerShell ISE 都不会命中断点。It looks like there's a problem with PowerShell and square brackets in folder and filenames.
Both PowerGUI and PowerShell ISE won't hit breakpoint if the script being debugged resides in a folder with
[
or]
in the name.即使 powershell ISE 以管理员身份运行,我也遇到了同样的问题,将脚本保存到物理目录允许我具有调试功能。
I faced the same problem even when the powershell ISE was running as administrator, saving the script to physical directory allowed me to have debug capabilities.
我注意到你正在运行 x64。您是否有可能运行 x64 ISE,但仅将执行策略设置为远离 x86 限制(反之亦然)。
I notice you're running x64. Is there any chance that you're running x64 ISE but have only set the execution policy away from restricted on x86 (or vice-versa).
我正在使用 Visual Studio Code,就我而言,我缺少 powershell 扩展。
I am using Visual Studio Code and in my case, I was missing the powershell extension.
面临同样的问题,因为我使用其他编辑器对 ps1 文件进行更改。使用 PowerShell ISE 打开文件并单击“保存”后,我解决了这个问题。
Was facing the same issue because I had used other editor to make changes to the ps1 file. After opening the file with PowerShell ISE and clicking "Save" solved the issue for me.