16 lines
507 B
PowerShell
16 lines
507 B
PowerShell
|
if(!$creds){
|
||
|
$creds = Get-Credential
|
||
|
}
|
||
|
$list = Get-ADUser -Credential $creds -server lbdc01.mpe.ca -SearchBase "OU=MPEUsers,DC=mpe,DC=ca " -Filter * -Properties telephoneNumber,title,DisplayName
|
||
|
$newList = @()
|
||
|
foreach($person in $list){
|
||
|
if(!$person.telephoneNumber -or !$person.title){
|
||
|
$personObject = [PSCustomObject]@{
|
||
|
"Name"=$person.DisplayName
|
||
|
"Title"=$person.title
|
||
|
"Phone"=$person.telephoneNumber
|
||
|
}
|
||
|
$newList += $personObject
|
||
|
}
|
||
|
}
|