

If Get-ADUser finds an object then $Manager will contain that user object. Given that the statement in ( ) evaluated to $false, the loop continues on. This then gets cast to boolean, which evaluates to $false. In this particular case, if Get-ADUser does not return an object then $Manager will be $null. When PowerShell casts a value to boolean 0, $null, $false, and an empty string all evaluate to $false. The way that do-until loops ( as well as if-then blocks and the like ) work is they cast the statement ( ) to boolean. If it errors out then $Manager will be $null. No, that line, if successful, will contain an AD user object. $Manager = get-aduser $input -ErrorAction Stop Given that Get-ADUser throws an error when the value provided to its -Identity parameter is invalid, the catch block will get triggered if the account provided for the manager is invalid. In this particular case, the error action of Stop causes Get-ADUser to throw a terminating error if it encounters any error, which a try-catch block requires.

Size = New-Object is a common parameter ( parameters that are available on most, if not all, cmdlets ) that controls how PowerShell will respond to an error coming from that cmdlet.

SHow Messagebox with message, title, Exclamation icon with 10 sec timeout

PS C:\> Show-MessageBox -Message 'Everything Lost !' -Title 'This is the end' -Icon Exclamation -Timeout 10 SHow Messagebox with message, title, Yes/No buttons and Information icon Show-MessageBox -Message 'My Message' -Title 'MB title' -Buttons = 'YesNo' -Icon Information Learn more about bidirectional Unicode characters To review, open the file in an editor that reveals hidden Unicode characters. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
