Scripting Office Communicator

Just for an exercise I thought I would try to do something with the Office Communicator.
Once I found the comobject and asked a few dumb questions I came up with this.
Nothing fancy, but it will write out your contacts to an Excel file.

Function showContacts{
$xl = new-object -comobject excel.application
$xl.Visible = $true
$xl.DisplayAlerts = $False
$wb = $xl.Workbooks.Add()
$ws = $wb.Worksheets.Item(1)
$range = $ws.range("A1:B1")
$range.font.bold = "true"
$ws.Cells.Item(1,1) = "Friendly Name"
$ws.Cells.Item(1,2) = "Sign in Name"
$row = 2 
$v = ""
$w = ""
$p = New-Object -comobject "Communicator.UIAutomation"
# This signs you in to your local account, So run this under your mail account name.
$s = $p.MyContacts |
ForEach-Object {
$v = $_.FriendlyName
$w = $_.SigninName
$ws.Cells.Item($row,1) = $v
$ws.Cells.Item($row,2) = $w

3 thoughts on “Scripting Office Communicator

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s