Why won't PowerShell ISE let me set breakpoints when running as Administrator?

倾然丶 夕夏残阳落幕 提交于 2020-01-23 06:45:08

问题


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?


回答1:


I also faced the same issue, Saving the file to a physical location enabled all debugging capabilities.




回答2:


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.




回答3:


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).



来源:https://stackoverflow.com/questions/4368612/why-wont-powershell-ise-let-me-set-breakpoints-when-running-as-administrator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!