update
This commit is contained in:
29
Azure Active Directory/MSolLicences.ps1
Normal file
29
Azure Active Directory/MSolLicences.ps1
Normal 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
|
Reference in New Issue
Block a user