Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Script Issue - Help Please

$
0
0

Hi all.  Have the below script, but seem to have issues.  What i would like it to do is ignore any entry that already has an SIP address, and add only to addresses that do.  Could any one assist? 

 

Add-PSSnapin Quest.ActiveRoles.ADManagement

$Users = Get-QADUser -SizeLimit 3000000 -SearchRoot "DC=ad,DC=pvt" 

ForEach($user in $Users) {

$samAccount = $user.SamAccountName

$Firstname = $user.givenName

$LastName = $user.LastName

    $logonname = $user.LogonName

    $Proxy = $user.ProxyAddresses

$SIP = "SIP:$logonname@pressassociation.com"

if ($Proxy -notlike '*SIP*')

{Set-QADUser $samAccount -ObjectAttributes @{proxyaddresses=@{Append=@($SIP)}}}

else

{Write-Host "SIP Address found on ($User), Skipped"} 

}


Viewing all articles
Browse latest Browse all 6937

Trending Articles