Last week I met PowerShell and ActiveDirectory for the first time. I would like to find a list of users who are not admins or domain administrators.
So far, I know how to get all the properties for all ActiveDirectory users with the following command / operation:
Get-ADUser -Filter * -Properties *
What I would like to do is print only the usernames of current ActiveDirectory users who are not admins or domain admins.
Here is the pseudo-code / Powershell code of what I'm trying to do:
$users = Get-ADUser -Filter * -Properties *
foreach($u in $users){
if ($u isn't an administrator OR $u isn't a domain administrator){
Write-Host "User Name:" $u.Name
}
}
Get-ADUser -Filter * -Properties *, MemberOf , , , . AdminCount , Google ( - DomainAdminCount?).
PowerShell ActiveDirectory, , .
2 , PowerShell . .