I need to change default address list in outlook 2010 across thousands of computers. To manually do it in outlook you go to address book>tools>options>and select an address book from the 'When opening the address book, show this address list first:' drop down box.
This is what I have so far:
$outlook = $(New-Object -ComObject Outlook.Application)
$Session = $outlook.Session
$Session.Logon()
$ab = $Session.AddressLists | ? {$_.Name -eq 'Example Address Book')}
$abdialog = $Session.GetSelectNamesDialog()
$abdialog.InitialAddressList = $ab
The error I'm receiving is:
Exception setting "InitialAddressList": "Cannot convert the "System._ComObject" value of type "System._ComObject#{00063049-0000-0000-c000-000000000046}" to type "Microsoft.Office.Interop.Outlook.AddressList"." At line:1 char:1 + $abdialog.InitialAddressList = $Session.AddressLists | ? {$_.name -eq 'BAE Syste ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], SetValueInvocationException + FullyQualifiedErrorId : ExceptionWhenSetting
please help I'm going insane with this!