Cannot step through PowerShell script in debug

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
robwm1
Posts: 90
Joined: Wed May 07, 2008 6:46 am

Cannot step through PowerShell script in debug

Post by robwm1 » Thu Nov 17, 2016 3:16 pm

Product, version and build: 7.2.96.0
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64-bit
Operating system: Windows 10 Enterprise
32 or 64 bit OS: 64-bit

Hi,

I need to step through my PowerShell script to observe the execution path that is taken. I'm choosing Debug Elevated from the Debug Group. After doing this, it executes the entire script without stepping. Is this expected behavior when coding in PowerShell? I know this works with vbscript.

Thanks,
Rob

User avatar
Alexander Riedel
Posts: 7128
Joined: Tue May 29, 2007 4:43 pm

Re: Cannot step through PowerShell script in debug

Post by Alexander Riedel » Thu Nov 17, 2016 3:20 pm

Did you set a breakpoint?
VBScript stops at the first instruction if there is no breakpoint.
Powershell does not do that. You need to set a breakpoint yourself.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
robwm1
Posts: 90
Joined: Wed May 07, 2008 6:46 am

Re: Cannot step through PowerShell script in debug

Post by robwm1 » Thu Nov 17, 2016 3:24 pm

Ok, that makes sense. It's working following your advice.

Carnac the Magnificent is amazing!