Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How does Powershell Get multiple specified user properties using the get-aduser filter

$
0
0

How does Powershell Get multiple specified user properties using the get-aduser filter

I need to get the email addresses of users a, b, c ,It needs to be obtained once in -fiter。

Get-ADUser -Filter 'SamAccountName -like “a” -and Mail -like “ *”'

Or some other method.

Second question

$DN = "ou=chx,DC=hpi,DC=com,DC=cn"
$1 = "aa","bb"
########################################
Get-ADUser -SearchBase $DN -Filter "SamAccountName -like '$1[0]'"

The user cannot be obtained using this method and how to implement it.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>