ms-office Security – How to Retrieve Exchange Password from Keychain

keychainms officepasswordSecurity

Is there a way using security find-internet-password or something similar to get my exchange credentials on the command line? I'm trying to write a script to auto-login into an exchange server and I'm sure the data exists somewhere but just unsure how to grab it.

Best Answer

security find-generic-password -ga <account>

You can find the account by opening Keychain Access, opening the application password (titled Exchange) and looking at the Account field. It should be in the form emailaddress@server e.g. ‘username@example.com@mail.example.com’.

Upon running this command, you will be prompted to allow access to the item in your Keychain, upon which you can Allow or Always Allow.

The password is printed in the last line of the output:

…
password: "abc123"