How to Skip Confirmation in a PowerShell Script

I have recently used PowerShell script to add user to AD groups. It works pretty well except it asks for confirmation everything I run Add-ADGroupMember. It’s cumbersome if you have a lot of groups in your script. Later I found out, the solution is quite easy. You just add -Confirm:$false to the end of the command. The complete command is like this

Add-ADGroupMember ad-group ad-user -Confirm:$false


This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.

Be the first to comment

Leave a Reply