#get all AD users in forest with name like v- and status is enable
$allusers = (get-adforest).domains| %{get-aduser -filter {SamAccountName -like “v-*” -and Enabled -eq $true} -Properties EMployeeNumber -Server $psitem}
# get same account name and employenumber and destinguishname and saved to csv file
$allusers | ?{$PSItem.EmployeeNumber -eq $null} | select SamAccountName,EmployeeNumber,DistinguishedName,@{l=”Domain”;e={($PSItem.DistinguishedName -split “,DC=”)[1..4] -join “.”}} | Export-Csv c:\temp\employnumber.csv -NoTypeInformation
Great – I should definitely pronounce, impressed with your site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or anything, website theme . a tones way for your customer to communicate. Excellent task..