Forum Discussion

eli_sorow's avatar
eli_sorow
Copper Contributor
Nov 25, 2020
Solved

send powershell script output by email

Hi all, i'm trying to send the output of a powershell script by mail. here's the script : collect o365 unused licenses and send the result by mail   $licenses = Get-MsolAccountSku foreach ($lic...
  • VasilMichev's avatar
    VasilMichev
    Nov 26, 2020

    You can do something like this:

     

    $output = @()
    $licenses = Get-MsolAccountSku

    foreach ($license in $licenses){
    $UnusedUnits = $license.ActiveUnits - $license.ConsumedUnits
    $output += "$($license.SkuPartNumber) has $unusedUnits unused licenses"
    }

Resources