Forum Discussion
dmarquesgn
Aug 18, 2022Iron Contributor
Running a powershell "MessageTrace" command within a scheduled task
Hi, I need to run a powershell script 4 times a day, to return the number of emails sent from a specific mailbox. I've got my code running fine and returing an email with the count of sent emails...
- Aug 18, 2022There are two ways mentioned in that article, one with a PFX password and one using a certificate thumbprint which is from the certificate in the user certificate store from the account that will run the scheduled account (https://adamtheautomator.com/exchange-online-v2/#Authenticating_Using_Certificate_Thumbprint) I use that method too in on of my scripts for 365 Health status too https://powershellisfun.com/2022/05/23/get-365-service-health-status-using-powershell/
Aug 18, 2022
You can use the Secrets Management module for that https://devblogs.microsoft.com/powershell/secretmanagement-and-secretstore-are-generally-available/ ?
- dmarquesgnAug 18, 2022Iron ContributorHi,
Thanks for the quick reply. I've read the article and configured my Vault and my secret.
But as I'm quite new to Powershell, now how can I use that secret to authenticate to Exchange?
Thanks- Aug 18, 2022You can store and retrieve credentials in that, there are quite a few articles about that. But perhaps this is also a solution for you? https://adamtheautomator.com/exchange-online-v2/ (App registration and certificate)
- dmarquesgnAug 18, 2022Iron ContributorThanks, I'll read it carefully.
So based on this last link, I don't need the Secrets Management module right?