Debugging Code

Welcome Forums General PowerShell Q&A Debugging Code

This topic contains 2 replies, has 2 voices, and was last updated by

11 months ago.

  • Author
  • #96651

    Points: 0
    Rank: Member

    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?

    Hiding Code From ISE Debugger

    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


  • #96677

    Points: 31
    Rank: Member

    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.

    • #96765

      Points: 0
      Rank: Member

      Ah so it does, thanks all

The topic ‘Debugging Code’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort