Hi AngryTechies,
Today we have a new video on Microsoft 365 automation Prerequisites which is Automating logins to Microsoft 365 PowerShell without password.
So once this part is done, you will be able to automate your reporting and schedule them in to Task Schedular for prepetual reporting.
Commands Shown in Slide:
#Convert Password to encrypted text:
One time use command once it is used, you don't need it again in any automation script.
$Convertpassword = 'Faj81591'| ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Automation\credentials\MSOnlineCred2.txt"
#Set the Veriables for Credentials
$username = "[email protected]"
$password = Get-Content "C:\Automation\credentials\MSOnlineCred2.txt" | ConvertTo-SecureString
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
#Try to connect Exchange Online:
Connect-ExchangeOnline -Credential $cred
#Try to Connect MSOL:
Connect-MsolService -Credential $cred
#Another Method:
One time command: Get-Credential "[email protected]" | Export-Clixml .\creds.xml
Add in Automation Script Login part:
$cred = Import-Clixml .\creds.xml
Connect-ExchangeOnline -Credential $cred
Make sure to Like and Subscribe for more Microsoft 365 tips and tricks.