Dec 10 2018 02:30 AM
Hi experts
i have a csv file where i have userprincipalnames i.e
user1@mydomain.com
user2@mydomain.com
user3@mydomain.com
i want to import this csv file and pull the information i.e skype is enabled or not for the user, if skype is enabled for the user what is its SipAddress & RegistrarPool info and i want to export this into csv file. experts help me how to achieve this
Dec 10 2018 05:01 AM
Hi,
I think you could try something like this
$Inputfile = "D:\Temp\Sip.csv"
$OutputFile = "D:\Temp\SipExport.csv"
$CSVFile = Import-CSV -Path $Inputfile -Header "UserPrincipalName"
ForEach ($row in $CSVFile)
{
$row.UserPrincipalName
Try{
$CheckCsUser = Get-CsUser -Identity $row.UserPrincipalName -ErrorAction Stop | Select-Object SipAddress, RegistrarPool
}
catch{
Write-Host $row.UserPrincipalName "is not a Skype-enabled User" -ForegroundColor Red
Continue
}
if($CheckCsUser)
{
$CheckCsUser | Export-Csv -Path $OutputFile -Append -NoTypeInformation
}
}