Debugging Code

Hi Guys,

Could someone point me in the right direction in regards to ISE debugging please. I have been using the ISE Debug feature for sometime, but one thing I struggle with is when the debugger gets to a commandlet as part of the script and then goes off to debug that commmandlet.

Here is a simple IF statement

If ($IncludeMailboxAccess -eq $true) { Write-Log "AUDIT: Mailbox access permissions..." $Delegates = @() $Delegates = (Get-MailboxPermission $_.DistinguishedName | Where { $DelegatesToSkip -notcontains $_.User -and $_.IsInherited -eq $false }) If ($Delegates -ne $null) { ForEach ($Delegate in $Delegates) { $DelegateAccess = $Delegate.AccessRights Check-Delegates $Delegate.User} } }

So when the debugger gets to Get-MailboxPermission it then opens that function up which makes life difficult. Is there a way using line breakpoints, variable breakpoints, command breakpoints to resolve this?

This article explains the problem, and indeed provides a solution for the problem if you want to hide a function. In this case, I just want ISE to ignore certain commandlets (the ones I did write myself).

Would really appreciate some help


In the debugger, F10, will Step-Over your function and will go to the next line or command following that function.
So if you set a breakpoint at your function, use F10 to execute it and return. F11 will step-into your function. This is all in the debug menu.

Ah so it does, thanks all