{"id":99522,"date":"2020-04-11T00:18:35","date_gmt":"2020-04-11T00:18:35","guid":{"rendered":"https:\/\/daoudisamir.com\/?p=99522"},"modified":"2025-05-22T00:44:20","modified_gmt":"2025-05-22T00:44:20","slug":"powershell-part-5-security-groups","status":"publish","type":"post","link":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/","title":{"rendered":"PowerShell (Part 5) &#8211; Security Groups"},"content":{"rendered":"<p>Now we can create start looking at the more serious stuffs, such as creating security groups and assigning users<\/p>\n<h1>1- Create a Security Group<\/h1>\n<p>In order to create a security group, we can simple do:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">New-MsolGroup -DisplayName \"SocialMedia\" -Description \"Social Media\"<\/pre>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"99523\" data-permalink=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/screenshot-2020-04-11-00-50-20\/\" data-orig-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?fit=2264%2C392&amp;ssl=1\" data-orig-size=\"2264,392\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2020-04-11 00.50.20\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?fit=640%2C111&amp;ssl=1\" class=\"aligncenter size-large wp-image-99523\" src=\"https:\/\/i0.wp.com\/daoudisamir.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20-1024x177.png?resize=640%2C111&#038;ssl=1\" alt=\"\" width=\"640\" height=\"111\" srcset=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?resize=1024%2C177&amp;ssl=1 1024w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?resize=300%2C52&amp;ssl=1 300w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?resize=768%2C133&amp;ssl=1 768w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?resize=1536%2C266&amp;ssl=1 1536w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?resize=2048%2C355&amp;ssl=1 2048w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?w=1280 1280w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.50.20.png?w=1920 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h1>2- Retrieve a Security Group<\/h1>\n<p>We can either do a Get-MsolGroup which will list all the groups, or a better and cleaner way doing is by<a href=\"https:\/\/samtech365.com\/powershell-part-4-commands\/\"> filtering<\/a> by a specific keyword<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-linenumbers=\"false\">Get-MsolGroup | Where-Object {$_.DisplayName -eq \"SocialMedia\"}<\/pre>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"99524\" data-permalink=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/screenshot-2020-04-11-00-53-24\/\" data-orig-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?fit=2308%2C322&amp;ssl=1\" data-orig-size=\"2308,322\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2020-04-11 00.53.24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?fit=640%2C89&amp;ssl=1\" class=\"aligncenter size-large wp-image-99524\" src=\"https:\/\/i0.wp.com\/daoudisamir.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24-1024x143.png?resize=640%2C89&#038;ssl=1\" alt=\"\" width=\"640\" height=\"89\" srcset=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?resize=1024%2C143&amp;ssl=1 1024w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?resize=300%2C42&amp;ssl=1 300w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?resize=768%2C107&amp;ssl=1 768w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?resize=1536%2C214&amp;ssl=1 1536w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?resize=2048%2C286&amp;ssl=1 2048w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?w=1280 1280w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.53.24.png?w=1920 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h1>3- List a Security Group members<\/h1>\n<p>If you want to display the users in a certain <a href=\"https:\/\/jv.wikipedia.org\/wiki\/Windows_PowerShell\">Security<\/a> Group, we can simply do:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-linenumbers=\"false\">$LogiSam = Get-MsolGroup | Where-Object {$_.DisplayName -eq \"LogiSam\"}\nGet-MsolGroupMember -GroupObjectId $LogiSam.ObjectId<\/pre>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"99525\" data-permalink=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/screenshot-2020-04-11-01-12-19\/\" data-orig-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?fit=2248%2C428&amp;ssl=1\" data-orig-size=\"2248,428\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2020-04-11 01.12.19\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?fit=640%2C122&amp;ssl=1\" class=\"aligncenter size-large wp-image-99525\" src=\"https:\/\/i0.wp.com\/daoudisamir.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19-1024x195.png?resize=640%2C122&#038;ssl=1\" alt=\"\" width=\"640\" height=\"122\" srcset=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?resize=1024%2C195&amp;ssl=1 1024w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?resize=300%2C57&amp;ssl=1 300w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?resize=768%2C146&amp;ssl=1 768w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?resize=1536%2C292&amp;ssl=1 1536w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?resize=2048%2C390&amp;ssl=1 2048w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?w=1280 1280w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.12.19.png?w=1920 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h1>4- Add a member to a Security Group<\/h1>\n<p>In order to add a new member to an existing Security Group, we can do:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"99526\" data-permalink=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/screenshot-2020-04-11-01-15-49\/\" data-orig-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?fit=2822%2C222&amp;ssl=1\" data-orig-size=\"2822,222\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2020-04-11 01.15.49\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?fit=640%2C51&amp;ssl=1\" class=\"aligncenter size-large wp-image-99526\" src=\"https:\/\/i0.wp.com\/daoudisamir.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49-1024x81.png?resize=640%2C51&#038;ssl=1\" alt=\"\" width=\"640\" height=\"51\" srcset=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?resize=1024%2C81&amp;ssl=1 1024w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?resize=300%2C24&amp;ssl=1 300w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?resize=768%2C60&amp;ssl=1 768w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?resize=1536%2C121&amp;ssl=1 1536w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?resize=2048%2C161&amp;ssl=1 2048w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?w=1280 1280w, https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-01.15.49.png?w=1920 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now we can create start looking at the more serious stuffs, such as creating security&#8230;<\/p>\n","protected":false},"author":1,"featured_media":99516,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18,59],"tags":[197],"class_list":["post-99522","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-m365","category-powershell","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Mastering PowerShell Security: Best Practices<\/title>\n<meta name=\"description\" content=\"Discover essential PowerShell security tips. Master best practices for securing scripts and environments effectively.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell (Part 5) - Security Groups\" \/>\n<meta property=\"og:description\" content=\"Now we can create start looking at the more serious stuffs, such as creating security groups and assigning users 1- Create a Security Group 2- Retrieve a Security Group 3- List a Security Group members 4- Add a member to a Security Group\" \/>\n<meta property=\"og:url\" content=\"https:\/\/samtech365.com\/powershell-part-5-security-groups\/\" \/>\n<meta property=\"og:site_name\" content=\"SamTech 365 - Samir Daoudi Technical Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-11T00:18:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-22T00:44:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1760\" \/>\n\t<meta property=\"og:image:height\" content=\"598\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Samir Daoudi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"PowerShell (Part 5) - Security Groups\" \/>\n<meta name=\"twitter:description\" content=\"Now we can create start looking at the more serious stuffs, such as creating security groups and assigning users 1- Create a Security Group 2- Retrieve a Security Group 3- List a Security Group members 4- Add a member to a Security Group\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\" \/>\n<meta name=\"twitter:creator\" content=\"@daoudi_samir\" \/>\n<meta name=\"twitter:site\" content=\"@daoudi_samir\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Samir Daoudi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/\"},\"author\":{\"name\":\"Samir Daoudi\",\"@id\":\"http:\\\/\\\/samtech365.com\\\/#\\\/schema\\\/person\\\/92fc47c88485daac9dc759ad3f9e18e6\"},\"headline\":\"PowerShell (Part 5) &#8211; Security Groups\",\"datePublished\":\"2020-04-11T00:18:35+00:00\",\"dateModified\":\"2025-05-22T00:44:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/\"},\"wordCount\":118,\"publisher\":{\"@id\":\"http:\\\/\\\/samtech365.com\\\/#\\\/schema\\\/person\\\/92fc47c88485daac9dc759ad3f9e18e6\"},\"image\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\",\"keywords\":[\"PowerShell\"],\"articleSection\":[\"Microsoft 365\",\"PowerShell\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/\",\"url\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/\",\"name\":\"Mastering PowerShell Security: Best Practices\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/samtech365.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\",\"datePublished\":\"2020-04-11T00:18:35+00:00\",\"dateModified\":\"2025-05-22T00:44:20+00:00\",\"description\":\"Discover essential PowerShell security tips. Master best practices for securing scripts and environments effectively.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1\",\"width\":1760,\"height\":598,\"caption\":\"PowerShell Security\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/samtech365.com\\\/powershell-part-5-security-groups\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/samtech365.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell (Part 5) &#8211; Security Groups\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/samtech365.com\\\/#website\",\"url\":\"http:\\\/\\\/samtech365.com\\\/\",\"name\":\"SamTech 365 - Samir Daoudi Technical Blog\",\"description\":\"PowerPlatform, Power Apps, Power Automate, PVA, SharePoint, C#, .Net, SQL, Azure News, Tips ....etc\",\"publisher\":{\"@id\":\"http:\\\/\\\/samtech365.com\\\/#\\\/schema\\\/person\\\/92fc47c88485daac9dc759ad3f9e18e6\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/samtech365.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\\\/\\\/samtech365.com\\\/#\\\/schema\\\/person\\\/92fc47c88485daac9dc759ad3f9e18e6\",\"name\":\"Samir Daoudi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1\",\"width\":192,\"height\":96,\"caption\":\"Samir Daoudi\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/samtech365.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1\"},\"url\":\"https:\\\/\\\/samtech365.com\\\/author\\\/daoudi-samirgmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mastering PowerShell Security: Best Practices","description":"Discover essential PowerShell security tips. Master best practices for securing scripts and environments effectively.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell (Part 5) - Security Groups","og_description":"Now we can create start looking at the more serious stuffs, such as creating security groups and assigning users 1- Create a Security Group 2- Retrieve a Security Group 3- List a Security Group members 4- Add a member to a Security Group","og_url":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/","og_site_name":"SamTech 365 - Samir Daoudi Technical Blog","article_published_time":"2020-04-11T00:18:35+00:00","article_modified_time":"2025-05-22T00:44:20+00:00","og_image":[{"width":1760,"height":598,"url":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","type":"image\/png"}],"author":"Samir Daoudi","twitter_card":"summary_large_image","twitter_title":"PowerShell (Part 5) - Security Groups","twitter_description":"Now we can create start looking at the more serious stuffs, such as creating security groups and assigning users 1- Create a Security Group 2- Retrieve a Security Group 3- List a Security Group members 4- Add a member to a Security Group","twitter_image":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","twitter_creator":"@daoudi_samir","twitter_site":"@daoudi_samir","twitter_misc":{"Written by":"Samir Daoudi","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#article","isPartOf":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/"},"author":{"name":"Samir Daoudi","@id":"http:\/\/samtech365.com\/#\/schema\/person\/92fc47c88485daac9dc759ad3f9e18e6"},"headline":"PowerShell (Part 5) &#8211; Security Groups","datePublished":"2020-04-11T00:18:35+00:00","dateModified":"2025-05-22T00:44:20+00:00","mainEntityOfPage":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/"},"wordCount":118,"publisher":{"@id":"http:\/\/samtech365.com\/#\/schema\/person\/92fc47c88485daac9dc759ad3f9e18e6"},"image":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","keywords":["PowerShell"],"articleSection":["Microsoft 365","PowerShell"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/","url":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/","name":"Mastering PowerShell Security: Best Practices","isPartOf":{"@id":"http:\/\/samtech365.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#primaryimage"},"image":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","datePublished":"2020-04-11T00:18:35+00:00","dateModified":"2025-05-22T00:44:20+00:00","description":"Discover essential PowerShell security tips. Master best practices for securing scripts and environments effectively.","breadcrumb":{"@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/samtech365.com\/powershell-part-5-security-groups\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#primaryimage","url":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","contentUrl":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","width":1760,"height":598,"caption":"PowerShell Security"},{"@type":"BreadcrumbList","@id":"https:\/\/samtech365.com\/powershell-part-5-security-groups\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/samtech365.com\/"},{"@type":"ListItem","position":2,"name":"PowerShell (Part 5) &#8211; Security Groups"}]},{"@type":"WebSite","@id":"http:\/\/samtech365.com\/#website","url":"http:\/\/samtech365.com\/","name":"SamTech 365 - Samir Daoudi Technical Blog","description":"PowerPlatform, Power Apps, Power Automate, PVA, SharePoint, C#, .Net, SQL, Azure News, Tips ....etc","publisher":{"@id":"http:\/\/samtech365.com\/#\/schema\/person\/92fc47c88485daac9dc759ad3f9e18e6"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/samtech365.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/samtech365.com\/#\/schema\/person\/92fc47c88485daac9dc759ad3f9e18e6","name":"Samir Daoudi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2025\/05\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1","url":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2025\/05\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1","contentUrl":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2025\/05\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1","width":192,"height":96,"caption":"Samir Daoudi"},"logo":{"@id":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2025\/05\/samtech365_v3-e1755126237898.png?fit=192%2C96&ssl=1"},"url":"https:\/\/samtech365.com\/author\/daoudi-samirgmail-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/samtech365.com\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-11-00.07.38.png?fit=1760%2C598&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/posts\/99522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/comments?post=99522"}],"version-history":[{"count":0,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/posts\/99522\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/media\/99516"}],"wp:attachment":[{"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/media?parent=99522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/categories?post=99522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/samtech365.com\/wp-json\/wp\/v2\/tags?post=99522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}