Forum Discussion
Office 365 license consumption alert
- Mar 23, 2017
In terms of alerts, no. A quick glance at the Admin portal or the Reports can give you this info. If you need it automated it really takes few lines of PowerShell code to check for available licenses and fire up an email notification.
In terms of alerts, no. A quick glance at the Admin portal or the Reports can give you this info. If you need it automated it really takes few lines of PowerShell code to check for available licenses and fire up an email notification.
- LutzAndi475Sep 11, 2021Copper ContributorHallo zusammen, Danke für die Super Unterstützung
- Markus KalmbachFeb 28, 2018Copper Contributor
Hi everyone,
even if this threat appears to be stuck or dead - I would be very interested to get the powershell code for getting alerts on low license counts - based on comparision of purchased and assigned licenses directly on the tenant level.
Would be very appreciated.
best regards
Markus
- VasilMichevMar 01, 2018MVP
It takes two lines of PowerShell, and you have all the building blocks in the replies above.
- Markus KalmbachMar 01, 2018Copper Contributor
Hi Vasil,
thank you for the reply. The parts I can find above are how to send mails via powershell - got that, no issue.
I want to go straight to the available license information within the Admin Center -NOT- exporting all licensed users, counting them, storing in a file / variable looping through E1 and E3 users, and then compare it against the SUM of available licenses in the tenant.
I just want to get the latest part done - get the amount of purchased licenses from the tenant. Do you have an hint, how to get this information direct?
best regards
Markus
- Carlos GomezMar 23, 2017Brass Contributor
Hi Vasil,
Do you know if there is a way to schedule the reports to be send? instead of going every day to open the admin portal and look for the report.
Regards.
- BenSteginkMar 24, 2017Iron Contributor
If you go the PowerShell route and want a schedule report you can always set it up on a server to run as a schedule task on a recurring basis. I've done a few reporting solutions this way to achieve a scheduled report :)
- Carlos GomezMar 24, 2017Brass ContributorMust probably we will use this way, but would be nice if microsoft provides this out of the Box.
- VasilMichevMar 24, 2017MVP
Unfortunately no, only few reports have the schedule functionality (the EOP related ones).
- Kamal IbrahimMar 23, 2017Copper Contributor
I was wondering if someone has got that Powershell code for viewing license and setting up for email notification.
I know how to view license (Get-MsolUser -UserPrincipalName belindan@litwareinc.com).Licenses.ServiceStatus - how do i add this to a notification email.
Thanks
- VasilMichevMar 23, 2017MVP
Sending messages via PowerShell is very easy. Get the information you want via the licensing cmdlets, then simply use something like:
$body = "blabla you have $somevariable available licenses out of $anothervariable blabla"
Send-MailMessage -SmtpServer outlook.office365.com -To user@domain.com -From you@domain.com -Subject "Free licenses report" -Body $body -BodyAsHtml -UseSSL -Credential (Get-Credential)
Of course if you aim to automate it you can use a different account, store the credentials securely and reuse them. You can also use your own SMTP server instead of O365 ones, etc.
- Kamal IbrahimMar 24, 2017Copper Contributor
Thanks Vasil much appreciated