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

asked on

Check accounts in Group and if Disabled , change to Enable

Hi EE

Should this be done differently ? I need to check an AD group and if an account is disabled , I need it to be enabled .
The group will have more than 5000 users and disabled users will vary from 1 - 10 at most .

The script below will work on a small group but on a large group how would you all do it ?

import-module ActiveDirectiry
Get-ADGroupMember -Identity MyGroup | select -expandproperty SamAccountName  | % {Enable-ADAccount  -Identity $_ }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

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 oBdA .. works perfect but can you explain to me what -verbose does ? or where I can read about it ?
Avatar of oBdA
oBdA

-Verbose is one of the common parameters (like WarningAction, ErrorAction, Whatif, ...); if the cmdlet supports it, it sends verbose output to the verbose stream.
Get-Help -Name about_CommonParameters -ShowWindow

Open in new window

Thank you oBdA ! your are always there to help .