If you like to add your Users to a Office 365 Security group, here is a script which adds Users with a specific Licenses Aggrement to the Testgroup all Securitygroup.
|
#(C) 2016 Adrian Reinhard (reinhard.be), 15.03.2017 #Add Users with specific License Aggrement to a Security Group #Change "Testgroup all", "domain:SMB_BUSINESS_PREMIUM" $groupid = Get-MsolGroup | Where-Object {$_.DisplayName -eq “Testgroup all”} $users = Get-MsolUser -all | Where-Object {$_.Licenses.AccountSkuId -like 'domain:SMB_BUSINESS_PREMIUM'} $users | foreach {Add-MsolGroupMember -GroupObjectId $groupid.ObjectId -GroupMemberObjectId $_.ObjectId -GroupMemberType User} |
You can change the Variable $_.Licenses.AkkountSkuID with any…
Read more