This commit is contained in:
2023-07-04 12:59:44 +02:00
parent 2cef42a718
commit 09c2faad93
231 changed files with 261001 additions and 4 deletions

View File

@ -0,0 +1,29 @@
$License = 'hitea:STANDARDPACK'
$EnabledPlans = @(
'TEAMS1'
'WHITEBOARD_PLAN1'
)
$Exclusions = @(
'Sync_ADCONNECT1@hitea.onmicrosoft.com'
)
$AllPlans = (Get-MsolAccountSku | Where-Object { $_.AccountSkuId -eq $License } | Select-Object -ExpandProperty ServiceStatus).ServicePlan.ServiceName
$DisabledPlans = $AllPlans | Where-Object { $EnabledPlans -notcontains $_ }
$E1CustomizedLicense = New-MsolLicenseOptions -AccountSkuId $License -DisabledPlans $DisabledPlans
$Users = Get-MsolUser -UnlicensedUsersOnly -All -EnabledFilter EnabledOnly
foreach ($User in $Users) {
if ($User.UsageLocation -ne 'FR') {
Set-MsolUser -UserPrincipalName $User.UserPrincipalName -UsageLocation PL
}
if ($User.IsLicensed -eq $false -and $Exclusions -notcontains $User.UserPrincipalName) {
Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -AddLicenses $License -LicenseOptions $E1CustomizedLicense
}
}
$LicensePlans = Get-MsolAccountSku | ForEach-Object {
[PSCustomObject] @{
LicenseName = $_.AccountSkuId
Plans = $_.ServiceStatus.ServicePlan.ServiceName -join ', '
}
}
$LicensePlans | Format-Table -AutoSize