Isaias Perez
asked on
Powershell- Get-ADUser specific Attribute with Filter
I am trying to put together a PS script that will search my entire user database and find all users who's description match this exactly "ACCTMGR - Account Manager" but filter out all Users who's Enabled Property is True. In other words only search users who are active and not disabled.
I have tried the following script but something is wrong with it. Can anyone help me fix it please.
Then ultimately i want to take all of these users "Account Managers" and add them a Distribution List
Account_Managers_All.
I have tried the following script but something is wrong with it. Can anyone help me fix it please.
Get-ADUser -Filter {description -like 'ACCTMGR - Account Manager'} | Where-Object {$_.Enabled -eq True}
Then ultimately i want to take all of these users "Account Managers" and add them a Distribution List
Account_Managers_All.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much. Figured out the rest of the code to add those users to a Security Group:
Import-CSV C:\all_directorofops.csv -Header SamAccountName | ForEach-Object {Add-AdGroupMember -Identity "Powerbi_All_Directors" -members $_.SamAccountName}
Import-CSV C:\all_directorofops.csv -Header SamAccountName | ForEach-Object {Add-AdGroupMember -Identity "Powerbi_All_Directors" -members $_.SamAccountName}
Open in new window