after a LOT of hours researching solution to this problem and haven't found it yet, thought maybe you can help me...
I'm trying to automate mail migration process, in the client side I'm creating outlook profile file (PRF file, from the office customization tool), then update the settings etc. at the end i'm exporting the data to pst with the outlook com object(outlook.interop) so far so good, the thing is when I'm creating a profile and launch outlook i get the "ask for credential" window to enter the user/pass, if I check the "remember password", windows then save it to the vault credentials.
Now I want to pre-create the credential prior to the launch of outlook so outlook start without asking for the credentials and find it in the vault, but when I manually creating a credential in the vault, outlook not using it and asking for password, I try with cmdkey /generic:MS.Outlook:[email protected] /user:$email /pass:$pass- not working, what I figured out is: when I save a password through the outlook credential dialog it encrypt it with that specific user key, so other users can't see it, and vice versa when I manually create a credential it use the current logged on user as the key for encryption so when outlook open it not recognized the password, so I think that this is the reason why is not working, same like powershell securestring working just on the current user that encrypted it. (but that's only my opinion so far)
So, maybe one of you knows how to:
automate the creation of credential and link it to the outlook profile/account, or: create a credential as different user, also, I thought of invoke-command as different user and then execute the 'cmdkey' but the computer domain is not the same as my localcomputer,
Any idea is welcome, also through the outlook com object if possible, registry, script whatever, really important to my project, at the meanwhile I use the shell.sendkey to automate the fill of the user password but it's really not stable solution.
The Outlook object model provides the Logon method of the Namespace class which logs the user on to MAPI, obtaining a MAPI session. It allows to avoid the credentials dialog, just specify the ShowDialog parameter as false.