why -whatif (GUI) in the foreach?

Hello,

Wondering why I am getting prompted by the GUI -whatif for the following one-liner where it is not explicitly set?

foreach ($user in $Users) {Remove-ADUser $user.samAccountName -Credential $creds}

…because I am attempting to delete 400 Users but am getting prompted for each of them.

thank you

Commands have an attribute called ConfirmImpact. By default, any command with a ConfirmImpact of ‘High’ will prompt you unless you explicitly tell PowerShell not to (such as with -Confirm:$false).

Dave, worked a charm and many thanks for the speedy reply. Much appreciated

Just to be 100% accurate you’re getting prompted for a confirmation not a whatif. -Whatif parameter just produces a statement saying it would do something not a prompt to confirm an action

100% understood Richard and thank you for clarifying.