views:

143

answers:

2

I have PS V2 and PowerGUI (1.9.6.1027). I set a debug point in my script in PowerGUI, but I cannot get debug workin when I start debug from tool bar or menu item. I got a dialog of "Continue with this operation?" as caption. There are 4 options "Yes", "Yes to All", "NO" and "No to All".

Not sure if there is any thing or option I have to set in PowerGUI?

Here is the snap-shot of dialog window prompt when I tried to debug my codes: alt text

If I force to close the window, I got an exception in Powershell console (embedded):

An error of type "System.Management.Automation.Host.PromptingException" has occurred. System.Management.Automation

A: 

Have you set your execution policy to allow for the execution of scripts? You can see your current execution policy by executing Get-ExecutionPolicy in the embedded PowerShell console in the PowerGUI Script Editor or by opening a native (blue) PowerShell console and running the command there. By default the execution policy is set to restricted and you'll have to set it to remotesigned or allsigned to run scripts.

Poshoholic
yes i did and it is ok.
David.Chu.ca
Ok, next question: what is the dialog you see asking you to confirm? Some cmdlets will display a dialog in PowerGUI when they need to confirm. If you run your script in PowerShell itself, does it prompt you to confirm anything? If that's the case then PowerGUI will prompt you to confirm the same thing as well. Any dialog asking you to continue with an operation is a confirmation dialog. Here's an example using PowerShell 2.0 that shows a confirmation prompt in PowerShell or a dialog in PowerGUI:Get-Service wuauserv | Restart-Service -Confirm
Poshoholic
Oh, and one more thing. Make sure that you _don't_ have PowerShell's built-in debugger turned on (i.e. that you didn't call Set-PSDebug -Step). PowerGUI doesn't use that for debugging. If you turned that on, invoke Set-PSDebug -Off in the embedded console and then run it through the debugger.
Poshoholic
Hi David, I just wanted to follow-up and see if these other comments highlighted what the problem might be. Please let me know either way. Thanks!
Poshoholic
Sorry for late reply. I updated my question with the dialog window.
David.Chu.ca
A: 

My guess is that you are on some CTP of PowerShell 2.0. Please upgrade to the RTM version here: http://support.microsoft.com/kb/968929

DSotnikov