Posted in : Uncategorized By tony.pham Translate with Google ⟶

1 week ago

There are ways to bypass manual authentication where you need to fill in credentials. In this guide, I will show you a smart way to bypass this. This guide is for MFA-disabled/excluded users.

OBS it’s not recommended. This is more for automate powershell script (in Task Scheduler) with service account.

  1. You begin with creating a .txt file and store your encrypted password. The following cmdlet will do it. You will only need to type this manually ONCE!Read-Host -assecurestring | convertfrom-securestring | out-file C:\mysecurestring.txt
  2. Now you will predefine your credentials:$username = “YourUserName”
    $password = Get-content “C:\mysecurestring.txt” | ConvertTo-SecureString
    $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
  3. The only thing left is to connect your predefined credentials with the authentication.

$credentials = get-credential -credential $cred
Connect-Exchangeonline -credential $credentials

Now you will be able to trigger a script without needing authentication!

Tags : #Script, Automation, credentials, Exchange, Exchange Online, password, PowerShell, predefined, scheduler, task, username

Personlig rådgivning

Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.

Add comment

Your comment will be revised by the site if needed.