Powershell one liners collections – hashtables, arrays and strings
An example on how you can use split and join to get the result you need.
Login to Azure/Office 365 in a script
How you can programmatically login to Azure/Office 365 in a script.
Start Powershell script in Task Scheduler
An easy way to get the output from a script in a log file. Save this as a cmd and use it as the trigger.