Microsoft Surface Hub 2 SmCamera User Manual

Page 63

Advertising
background image


[System.Collections.ArrayList]$MeetingRoomOther_License = @()

#Licenses

OTHER than what should be applied to a Teams Room Resource Account


$Report = [System.Collections.Generic.List[Object]]::new()


#Updated to filter server side and not client side. See next line for new
filter.

#$Room_UPNs = get-mailbox | Where-Object {$_.recipientTypeDetails -eq
"roomMailbox"} | Select-Object DisplayName, PrimarySmtpAddress,
ExternalDirectoryObjectId




$Room_UPNs =

Get-ExoMailbox

-Filter

{recipientTypeDetails -eq

"RoomMailbox"

} |

Select-Object

DisplayName, PrimarySmtpAddress, ExternalDirectoryObjectId

Write-Host

$Room_UPNs.Length

" were found."

-ForegroundColor

Green

Write-Host

"Note that resource accounts can contain 0 or multiple licenses.

As such, the total of all licenses discovered may be different than the
number of resource accounts"

-ForegroundColor

Yellow

Write-Host




$i,$x = 0,$Room_UPNs.count

#Setup for counting devices

if

(

$null

-eq $x) {$x = 1}

#run through the loop at least once to print

results, otherwise will get a divide/0 error

# Note that resource accounts can contain multiple licenese. As such, the
sum of all licenses may exceed the number of resource accounts



ForEach

($UPN

in

$Room_UPNs){


$i++

Write-Progress

-activity

"Searching for resource accounts with

licenses..."

-status

"Scanned: $i of $x"


$UPN_license =

Get-MgUserLicenseDetail

-UserID

$UPN.ExternalDirectoryObjectId |

Select-Object

-ExpandProperty

SkuPartNumber


$temp =
[pscustomobject]@{

'DisplayName'

=$UPN.DisplayName;

'UPN'

=$UPN.PrimarySmtpAddre

ss;

'Licenses'

=$UPN_license

-join

", "

}

#pulls out the license from a UPN


Advertising