jslate1980 Posted October 30, 2016 Posted October 30, 2016 Hi is it possible to add users to a office365 unified group using powershell? I need to add 250 students to a group but don't want to have to add them manually through the gui? I can view the group using Get-UnifiedGroup -Identity after importing a ps session, but am finding it difficult to find the right command.
jslate1980 Posted October 30, 2016 Author Posted October 30, 2016 Took me two minutes after posting this to work it out. Here is the command Add-UnifiedGroupLinks -Identity "Legal Department" -LinkType Members -Links [email protected],[email protected] 1
OverWorked Posted November 1, 2016 Posted November 1, 2016 (edited) @jslate1980 Where did you get the Add-UnifiedGroupLinks cmdlet from? It's not in the MSOnlone module. I'm trying to bulk add members to an Office 365 group. All I can find on the web is how to add members to distribution or security groups. *edit* I've fixed it. It was the way I'd opened the session. I'm new to managing Office 365 with Powershell. $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session Edited November 1, 2016 by OverWorked
jslate1980 Posted November 1, 2016 Author Posted November 1, 2016 (edited) It's not you have import ps session as it's in exchange online see https://support.office.com/en-gb/article/Use-PowerShell-to-manage-Office-365-Groups-Admin-help-aeb669aa-1770-4537-9de2-a82ac11b0540 Edit Sorry didn't see that you had edited the last post. The link above shows the different commands you can use with 365 groups. Edited November 1, 2016 by jslate1980
dsquared2 Posted December 8, 2016 Posted December 8, 2016 Has anyone found a way of exporting classes from Sims and importing them into O365 groups via PowerShell?
jslate1980 Posted December 8, 2016 Author Posted December 8, 2016 Has anyone found a way of exporting classes from Sims and importing them into O365 groups via PowerShell? Are students at your school email accounts added to sims? And does their upn match there email?
dsquared2 Posted December 8, 2016 Posted December 8, 2016 I have there school email address in sims but there UPN doesn't match there Office log in. They log in with [email protected]. Would I need to change to using there UPN?
jslate1980 Posted December 8, 2016 Author Posted December 8, 2016 I believe so (but I may be wrong and there is far more clever people on here than me). I am currently making usernames and email addresses the same to try and simplify the process. But trying to make students email addresses random enough so keeping students protected for safe guarding. 1
dsquared2 Posted December 8, 2016 Posted December 8, 2016 Safe guarding is a very good point. Maybe best changing to UPN for that reason. At the moment my script I've been testing is: New-UnifiedGroup -DisplayName Engineering Department10 -Alias engineering10 -AccessType Private -AutoSubscribeNewMembers -HiddenGroupMembershipEnabled -Language en-GB -Owner [email protected] -Members [email protected], [email protected] This does what I need it to do but I have to make a separate script for every class. Copying and pasting it from an excel spreadsheet. Very time consuming
jslate1980 Posted December 8, 2016 Author Posted December 8, 2016 There are a few examples of adding users to a distribution list from csv in office 365. I don't think it would be that hard to change for unified groups. Will have a play about tomorrow to see what I can come up with.
jslate1980 Posted December 8, 2016 Author Posted December 8, 2016 That looks interesting example https://paulgilbride.com/2012/04/26/add-multiple-members-to-a-distribution-group-in-o365-2/. Wonder changing distribution to unified group would work?
jslate1980 Posted December 9, 2016 Author Posted December 9, 2016 (edited) Creating groups from .csv:- Import-CSV “C:\unifiedgroup.csv” | foreach {New-UnifiedGroup -DisplayName $_.name -Alias $_.Alias -AccessType $_.Type} CSV file looks like:- Name, Alias, Type, *test1, test1, Private *test2, test2, Private Adding users from a separate csv:- Import-Csv “C:\list.csv” | foreach {Add-UnifiedGroupLinks -Identity “*test1” -Links $_.Links -LinkType $_.LinkType} CSV file looks like:- Links, LinkType, [email protected], Members, [email protected], Owners, Edited December 9, 2016 by jslate1980 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now