Попытка найти активных пользователей рекламы за последние 12 месяцев фильтр ldap с получением рекламного пользователя powershell

Let’s get started.

Users That Can Log On To All Computers

You can search accounts that have log on restrictions set on the Account tab. In this example, I’ll list all accounts that can log on to all computers.

Get-ADUser -LDAPFilter "(!LogonWorkstations=*)" -Properties * | select-object samaccountname,givenname,surname,logonworkstations

Example 9. Find Users by Last Name

Get-ADUser -Filter "Surname -eq 'smith'"

Get All Users in the Domain

get-aduser -filter *

Example 7. Get All Users from an OU

You first need to get the distinguishedName of the OU.

To do this, right click on the OU, and select properties. Then select the Attribute Editor Tab and find the distinguishedName value.

get distinguishedName value
get-aduser -filter * -SearchBase "OU=Accounting,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com"

Get All Users & The Department Attribute

get-aduser -filter * -Properties * | select displayname, department

Get All Phone Numbers for a User

Get-ADUser -Identity Alice.Mills -Properties * | select name, *phone*

Get a Single User

get-aduser -Identity robert.allen

Example screenshot below.

Get All Users with a Logon Script

Get-ADUser -Filter {Scriptpath -ne "$Null"} -Properties * | select name, scriptpath

Get All Users and Format the Output

To make the previous example easier to read you can output the results in columns using the format-table option.

get-aduser -filter * | Format-Table

You can see below this format is much easier to read.

Example 13. Search Users by City

 get-aduser -filter {City -like "Indianapolis"} -Properties * | select name, city

Topics: Search Active Directory

Get All Users Email Addresses

get-aduser -filter * -Properties * | select givenname, sn, mail

Find Users by First Name

Get-ADUser -Filter "GivenName -eq 'mark'"

Video Tutorial

If you don’t like videos or need more instructions, then continue reading.

Get a Single User and All User Properties

get-aduser -Identity robert.allen -Properties *