{"id":348,"date":"2015-11-18T11:30:12","date_gmt":"2015-11-18T11:30:12","guid":{"rendered":"https:\/\/www.sharepoint13.org\/?p=348"},"modified":"2015-11-18T13:04:03","modified_gmt":"2015-11-18T13:04:03","slug":"office365-useradmin-with-powershell-part-1-sitegroups","status":"publish","type":"post","link":"https:\/\/www.sharepoint13.org\/?p=348","title":{"rendered":"Office365 Useradmin with PowerShell &ndash;Part 1: SiteGroups"},"content":{"rendered":"<p>First of all let me tell you that you must save any .csv input files in UTF-8 format. This will allow your language spesific letters to display correct, for example the letters \u00e6,\u00f8,\u00e5&#160; are spesific to Norwegian. So use Notepad ++ to Encode to UTF-8<\/p>\n<p><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/snip1.png\"><img loading=\"lazy\" decoding=\"async\" title=\"snip1\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"snip1\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/snip1_thumb.png\" width=\"244\" height=\"114\" \/><\/a><\/p>\n<p>The first step (since I am an SP dude) is to add SiteGroups and their permission levels. Also you can create Custom permission levels. To create your own permission level I prefer to use GUI&#160; -notice that I have created a Custom permission level with read on items and versions, and the possibillity to manage personal views.&#160; <br \/><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image9.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb9.png\" width=\"244\" height=\"128\" \/><\/a><\/p>\n<p>Next step is to add SiteGroups and their PermissionLevels, to do this I use a comma separeted file, and import this with PowerShell to the sitecollection.<\/p>\n<p>PS Script:   <br \/><strong>PS&gt;Import-Csv C:\\admin\\SMGroupsAndPermissions.csv | ForEach-Object {New-SPOSiteGroup -Site $_.Site -Group $_.Group -PermissionLevels $_.PermissionLevels }<\/strong> <\/p>\n<p>My CSV file in Notepad ++ looks like this:<a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image10.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb10.png\" width=\"303\" height=\"97\" \/><\/a>    <br \/>-first line is the references to PowerShell \u2013scope, the permission level must exist (and offcourse url to site), groups will be created.<\/p>\n<p>Here\u2019s the outpout from PS ISE:   <br \/><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image11.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb11.png\" width=\"298\" height=\"122\" \/><\/a>    <br \/>Notice that some of my Groups allready existed, and you get a red PS Error \u2013that\u2019s no problem, the new ones will be created.<\/p>\n<p>Wanna remove a group, use this PS:   <br \/><strong>PS&gt;Remove-SPOSiteGroup -Site https:\/\/vaerpn.sharepoint.com\/sites\/github -Identity &quot;Administration Visitors&quot;<\/strong><\/p>\n<p>Useful References:   <br \/><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/fp161372.aspx\" target=\"_blank\">Set up the SharePoint Online Management Shell Windows PowerShell environment<\/a><\/p>\n<p><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/fp161382.aspx\" target=\"_blank\">Use Windows Powershell cmdlets to manage groups in SharePoint Online site collections<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First of all let me tell you that you must save any .csv input files in UTF-8 format. This will allow your language spesific letters to display correct, for example the letters \u00e6,\u00f8,\u00e5&#160; are spesific<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[17,11],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-office365","tag-office-365","tag-powershell"],"_links":{"self":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=348"}],"version-history":[{"count":2,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/348\/revisions"}],"predecessor-version":[{"id":356,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/348\/revisions\/356"}],"wp:attachment":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}