PowerShell 5.0 Production Preview Issues with Azure


hi, 

i have installed powershell 5.0 production preview on windows 8.1 x64 machine , have tried run regular office 365 report script found on technet: https://gallery.technet.microsoft.com/office/office-365-licensing-report-86cf29d6

since installing 5.0, powershell crashes when running script.

josh 

here powershell script works in powershell v5.  run see:

# script code has been referenced http://gallery.technet.microsoft.com/scriptcenter/export-a-licence-b200ca2a#content param (  [string] $exportpath = $pwd )  function date_time() {     $datetime = (get-date -uformat "%y-%m-%d_%i-%m-%s_%p").tostring()     return $datetime } cd \ write-host "waiting input on tenant admin credentials" -foregroundcolor magenta $cred=get-credential import-module msonline connect-msolservice -credential $cred  $curdatetime = date_time $exportfile = "$exportpath\license_statistics_$curdatetime.csv"  $sku = @{      "mcoimp" = "lync online (plan 1)"     "mcostandard" = "lync online (plan 2)"     "mcovoiceconf" = "lync online (plan 3)"     "officesubscription" = "office professional plus"     "desklesspack" = "office 365 (plan k1)"      "desklesswoffpack" = "office 365 (plan k2)"      "litepack" = "office 365 (plan p1)"      "exchangestandard" = "exchange online (plan 1)"     "exchangeenterprise" = "exchange online (plan 2)"     "exchangearchive" = "exchange online archiving"     "exchangedeskless" = "exchange online kiosk"     "exchangetelco" = "exchange online pop"     "standardpack" = "microsoft office 365 (plan e1)"     "standardwoffpack" = "microsoft office 365 (plan e2)"     "enterprisepack" = "microsoft office 365 (plan e3)"     "enterprisepacklrg" = "microsoft office 365 (plan e3)"     "enterprisewithscal" = "microsoft office 365 (plan e4)"     "standardpack_student" = "microsoft office 365 (plan a1) students"     "standardwoffpackpack_student" = "microsoft office 365 (plan a2) students"     "enterprisepack_student" = "microsoft office 365 (plan a3) students"     "enterprisewithscal_student" = "microsoft office 365 (plan a4) students"     "standardpack_faculty" = "microsoft office 365 (plan a1) faculty"     "standardwoffpackpack_faculty" = "microsoft office 365 (plan a2) faculty"     "enterprisepack_faculty" = "microsoft office 365 (plan a3) faculty"     "enterprisewithscal_faculty" = "microsoft office 365 (plan a4) faculty"     "enterprisepack_b_pilot" = "microsoft office 365 (enterprise preview)"     "standard_b_pilot" = "microsoft office 365 (small business preview)"     "desklesspack_gov" = "microsoft office 365 (plan k1) government"     "desklesswoffpack_gov" = "microsoft office 365 (plan k2) government"      "officesubscription_gov" = "office professional plus government"     "exchangestandard_gov" = "microsoft office 365 exchange online (plan 1) government"     "exchangeenterprise_gov" = "microsoft office 365 exchange online (plan 2) government"     "standardpack_gov" = "microsoft office 365 (plan g1) government"     "standardwoffpack_gov" = "microsoft office 365 (plan g2) government"     "enterprisepack_gov" = "microsoft office 365 (plan g3) government"     "enterprisewithscal_gov" = "microsoft office 365 (plan g4) government"     "visioclient" = "visio pro office 365"     "intune_a" = "intune office 365"     "projectonline_plan_1" = "project online plan 1"     "projectonline_plan_2" = "project online plan 2"     "projectclient" = "project pro office 365"     "wacsharepointstd" = "office web apps sharepoint plan 1"     "wacsharepointent" = "office web apps sharepoint plan 2"     "sharepointstandard" = "sharepoint online (plan 1)"     "sharepointenterprise" = "sharepoint online (plan 2)"     "sharepointdeskless" = "sharepoint online kiosk"     "sharepointpartner" = "sharepoint online partner access"     "sharepointstorage" = "sharepoint online storage"      "power_bi_standalone" = "power bi office 365" }  write-host "working...please wait" $csvobject = @() $accountskus = get-msolaccountsku $msolusers = get-msoluser -all $i = 0 foreach ($msoluser in $msolusers) {     write-progress -activity "gathering license statistics...." -status $msoluser.displayname -percentcomplete (($i / $msolusers.count)  * 100)     $accountskuids = $msoluser.licenses     foreach ($accountsku in $accountskuids)       {               #write-host $accountsku.servicestatus         foreach ($row in $accountsku.servicestatus)         {              #write-host $row.serviceplan.servicename             switch -wildcard ($row.serviceplan.servicename)             {               "*bi_azure_p1*"  { $thislicense = "power bi reporting , analytics plan 1"}              "*sql_is_ssim*" { $thislicense = "power bi information services plan 1"}             "exc*archive" { $thislicense = "exchange online archiving" }              "exc*deskless" { $thislicense = "exchange online kiosk" }              "exc*enterprise" { $thislicense = "exchange online plan 2" }              "exc*lite" { $thislicense = "exchange online plan 1" }              "exc*standard" { $thislicense = "exchange online plan 1" }              "mcoim*" { $thislicense = "lync online plan 1" }              "mcos*" { $thislicense = "lync online plan 2" }              "lyn*standard*" { $thislicense = "lync online plan 1" }               "lyn*enterprise*" { $thislicense = "lync online plan 2" }              "mcovoice*" { $thislicense = "lync online plan 2" }              "off*" { $thislicense = "office professional plus" }               "sharepointenterprise" { $thislicense = "sharepoint online plan 2" }               "sharepointstandard"  { $thislicense = "sharepoint online (plan 1)"}              "sharepointenterprise" { $thislicense = "sharepoint online (plan 2)"}              "sharepointdeskless" { $thislicense = "sharepoint online kiosk"}              "sharepointpartner" { $thislicense = "sharepoint online partner access"}              "sharepointstorage" { $thislicense = "sharepoint online storage" }              "*wac*" { $thislicense = "office web apps" }               "wac*" { $thislicense = "office web apps" }               "intune*" { $thislicense = "intune" }              "project_client*" { $thislicense = "project professional" }              "sharepoint_proj*" { $thislicense = "project online" }              "rms_s_*" { $thislicense = "azure rms" }              "visio_client*" { $thislicense = "visio professional" }              default { $thislicense = $row.serviceplan.servicename }             }            #write-host $thislicense             $obj = new-object psobject -property @{"displayname" = $msoluser.displayname;  "accountsku" = $sku.item($accountsku.accountskuid.split(":")[1].toupper()); "servicename" = $thislicense; "provisioningstatus" =  $row.provisioningstatus }            $obj = $obj | select-object displayname,accountsku,servicename,provisioningstatus            $csvobject += $obj         }     }      $i++; } $csvobject |export-csv "$exportfile" -notype  write-host ("script completed.  results available in " + $exportfile) -foregroundcolor magenta 


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B