Skip to content

Instantly share code, notes, and snippets.

@whatwouldbradydo
Created August 22, 2016 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatwouldbradydo/c775690b5baa12ff7f2e8856b180be0f to your computer and use it in GitHub Desktop.
Save whatwouldbradydo/c775690b5baa12ff7f2e8856b180be0f to your computer and use it in GitHub Desktop.
$emailFromAddress = "admin@MyTestTenant.com"
$emailToAddress = "servicedesk@MyTestTenant.com"
$emailSMTPServer = "outlook.office365.com"
$emailSubject = "Office 365 License Report"
$credObject = Get-AutomationPSCredential -Name "MSOnline-Credentials"
Connect-MsolService -Credential $credObject
$O365Licenses = Get-MsolAccountSku | Out-String
Send-MailMessage -Credential $credObject -From $emailFromAddress -To $emailToAddress -Subject $emailSubject -Body $O365Licenses -SmtpServer $emailSMTPServer -UseSSL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment