##Get-ADUserProfile.ps1
#Get all user properties, or just one, with a wildcard
#You can just filter the output with export-csv and sort
#Set the date first
$day = (get-date).ToString("yyyyMMdd")
Import-Module ActiveDirectory -ea Inquire -NoClobber
$user = read-host -prompt "What partial username?"
(Get-ADUser -Properties Name,GivenName,SurName,UserPrincipalName,Enabled,ProfilePath -SearchScope Subtree -SearchBase "DC=YourDomain,DC=YourRootDomain,DC=YourHostRoot" -Filter ("UserPrincipalName -like '*$user*'") -EA silentlycontinue|where ObjectClass -eq 'user'|select -ExcludeProperty SID,DistinguishedName -Property Name,GivenName,SurName,UserPrincipalName,enabled,ProfilePath) `
|export-csv .\output\$day-userproperties.csv -append -force
Check Wildcarded AD User Properties with PowerShell 5.1
by
Tags: