powershell - Set Outlook's 'show this address list first' option -
i need change default address list in outlook 2010 across thousands of computers. manually in outlook go address book>tools>options>and select address book 'when opening address book, show address list first:' drop down box.
this have 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 "system._comobject" value of type "system._comobject#{00063049-0000-0000-c000-000000000046}" type "microsoft.office.interop.outlook.addresslist"." @ line:1 char:1 + $abdialog.initialaddresslist = $session.addresslists | ? {$_.name -eq 'bae syste ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [], setvalueinvocationexception + fullyqualifiederrorid : exceptionwhensetting
please i'm going insane this!
i don't know if it's typo in :
$ab = $session.addresslists | ? {$_.name -eq 'example address book')}
you should remove last closing bracket
$ab = $session.addresslists | ? {$_.name -eq 'example address book'}
after code works me.
Comments
Post a Comment