{"id":108,"date":"2025-04-18T09:52:48","date_gmt":"2025-04-18T09:52:48","guid":{"rendered":"https:\/\/burlage.it\/?p=108"},"modified":"2025-04-18T09:56:52","modified_gmt":"2025-04-18T09:56:52","slug":"powershell-ad","status":"publish","type":"post","link":"https:\/\/burlage.it\/index.php\/2025\/04\/18\/powershell-ad\/","title":{"rendered":"PowerShell &#8211; AD"},"content":{"rendered":"\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# AD - Search for an AD user\nGet-ADUser -Filter { UserPrincipalName -like 'john.doe@domain.com' }\n\n# AD - Create AD group\nNew-ADGroup -Path 'OU=Room,OU=Department,DC=domain,DC=com' -Name 'Group Name' -GroupScope DomainLocal -GroupCategory Security -Description 'Used for SSO for Entra application ABC'\n\n# AD - Set info field of an AD group\nSet-ADGroup -Identity 'Group Name' -Replace @{'info' = 'Used for SSO for Entra application ABC'}\n\n# AD - Add member to an AD group\nAdd-ADGroupMember -Identity 'Group Name' -Members 'SamAccountName'\n\n# AD - Display an AD group\nGet-ADGroup -Identity 'Group Name'\n\n# AD - Display all properties of an AD group\nGet-ADGroup -Identity 'Group Name' -Properties *\n\n# AD - Display members of an AD group\nGet-ADGroupMember -Identity 'Group Name'\n\n\n\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># AD - Search for an AD user<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-ADUser<\/span><span style=\"color: #D4D4D4\"> -Filter { UserPrincipalName -like <\/span><span style=\"color: #CE9178\">&#39;john.doe@domain.com&#39;<\/span><span style=\"color: #D4D4D4\"> }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Create AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">New-ADGroup<\/span><span style=\"color: #D4D4D4\"> -Path <\/span><span style=\"color: #CE9178\">&#39;OU=Room,OU=Department,DC=domain,DC=com&#39;<\/span><span style=\"color: #D4D4D4\"> -Name <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><span style=\"color: #D4D4D4\"> -GroupScope DomainLocal -GroupCategory Security -Description <\/span><span style=\"color: #CE9178\">&#39;Used for SSO for Entra application ABC&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Set info field of an AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Set-ADGroup<\/span><span style=\"color: #D4D4D4\"> -Identity <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><span style=\"color: #D4D4D4\"> -Replace <\/span><span style=\"color: #569CD6\">@<\/span><span style=\"color: #D4D4D4\">{<\/span><span style=\"color: #CE9178\">&#39;info&#39;<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&#39;Used for SSO for Entra application ABC&#39;<\/span><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Add member to an AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Add-ADGroupMember<\/span><span style=\"color: #D4D4D4\"> -Identity <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><span style=\"color: #D4D4D4\"> -Members <\/span><span style=\"color: #CE9178\">&#39;SamAccountName&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Display an AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-ADGroup<\/span><span style=\"color: #D4D4D4\"> -Identity <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Display all properties of an AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-ADGroup<\/span><span style=\"color: #D4D4D4\"> -Identity <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><span style=\"color: #D4D4D4\"> -Properties *<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># AD - Display members of an AD group<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-ADGroupMember<\/span><span style=\"color: #D4D4D4\"> -Identity <\/span><span style=\"color: #CE9178\">&#39;Group Name&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":3,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}