
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.
1 2 3 4 5 6 7 |
#(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 other Variable which you can find out with.
1 |
get-msoluser -usersprincipalname "putusernamehere" | fl |
Error: Contact form not found.