Link to home
Start Free TrialLog in
Avatar of MilesLogan
MilesLoganFlag for United States of America

asked on

Powershell - How to remove confirmation window from script

Hi EE

I have the script below that removes the users from the listed groups .. but it is prompting me to confirm for each user .. how can I remove that ? or any way to make this better ?

I basically need to remove a set of users from the groups in groups.tst

Foreach ($User in GC e:\Projects\Groups\Users2.txt){
GC e:\Projects\groups\groups2.txt | % {
Remove-ADGroupmember -identity $_ -member $User
      }
}
SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MilesLogan

ASKER

Thank you both ! that was it ..