Use a certificate instead
https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All
i have a server and from that server i connect to exchange online but the server has a policy that if you are idle for 15 minutes, the session gets logged off.
i dont want to put my password always when i connect to exchange online.
I want to try something like the below but i am not sure. i dont want my password to be in plain text.
i have saved my user account password in c:\temp\pwd.txt
$username = "myuser@Company portal .com"
$password = Get-Content 'c:\temp\pwd.txt' | Convertto-securestring
$usercredentials = new-object -typename System.Management.PSCredential -argumentlist $username, $password
Connect-ExchangeOnline -Credential $usercredentials
Use a certificate instead
https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps