Skip to content

Instantly share code, notes, and snippets.

@maravedi
Created April 5, 2020 02:03
Show Gist options
  • Save maravedi/e083d90a45da2b05d77964dfd8e6297a to your computer and use it in GitHub Desktop.
Save maravedi/e083d90a45da2b05d77964dfd8e6297a to your computer and use it in GitHub Desktop.
PowerShell function to get specific details for an AD user
function Get-Employee {
param(
[String]$Username,
[String]$ProxyAddressesFilter
)
If($Username) {
Get-ADUser -Identity $Username -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber
} Else {
Get-ADUser -Filter "proxyAddresses -like `"*$($ProxyAddressesFilter)*`"" -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment