Removing AD Group Membership (PowerShell)
<p>I have a script for people who leave my organization.  It basically creates a user backup folder and file before changing the password, removing the manager, backing up all member of groups, removing all group memberships, disabling the account and moving to different OU. </p>

<p>The part that i seem to be stuck on is the membership removals. This is what i have for that task:</p>

<pre><code>Get-ADPrincipalGroupMembership -Identity "$Username" | % {Remove-ADPrincipalGroupMembership -Identity "$Username" -MemberOf $_}
</code></pre>

<p>This DOES work but I am prompted to confirm Yes or No to each group. When i add:</p>

<pre><code>-confirm $false
</code></pre>

<p>at the end, none of the groups are removed.  How can I get it to not ask for confirmation while still removing the groups?</p>

<p>Thank You!</p>