{"id":2910,"date":"2013-04-02T10:15:22","date_gmt":"2013-04-02T14:15:22","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2910"},"modified":"2013-04-02T10:15:22","modified_gmt":"2013-04-02T14:15:22","slug":"get-local-admin-group-members-in-a-new-old-way","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/","title":{"rendered":"Get Local Admin Group Members in a New Old Way"},"content":{"rendered":"<p>Yesterday I posted a quick <a title=\"How Old is the Admin Password?\" href=\"http:\/\/jdhitsolutions.com\/blog\/2013\/04\/how-old-is-the-admin-password\/\" target=\"_blank\">article<\/a> on getting the age of the local administrator account password. It seemed appropropriate to follow up on a quick and dirty way to list all members of the local administrator group. Normally, I would turn to WMI (and have written about this in the past). But WMI is relatively slow for this task and even using the new CIM cmdlets in PowerShell 3.0 don't improve performance. Instead I'm going to return to an old school technique using the NET command.<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">PS C:\\&gt; net localgroup administrators\r\nAlias name     administrators\r\nComment        Administrators have complete and unrestricted access to the computer\/domain\r\n\r\nMembers\r\n\r\n-------------------------------------------------------------------------------\r\nAdministrator\r\nGLOBOMANTICS\\Domain Admins\r\nlocaladmin\r\nThe command completed successfully.<\/pre>\n<p>It is very easy to see members. To query a remote computer all I need to do is wrap this in Invoke-Command and use PowerShell remoting.<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">PS C:\\&gt; invoke-command {net localgroup administrators} -comp chi-fp01\r\nAlias name     administrators\r\nComment        Administrators have complete and unrestricted access to the computer\/domain\r\n\r\nMembers\r\n\r\n-------------------------------------------------------------------------------\r\nAdministrator\r\nGLOBOMANTICS\\Chicago IT\r\nGLOBOMANTICS\\Domain Admins\r\nThe command completed successfully.<\/pre>\n<p>Yes, there is some overhead for remoting but overall performance is pretty decent. And if you already have an established PSSession, even better. For quick and dirty one-liner it doesn't get much better. Well, maybe it can.<\/p>\n<p>I have no problem using legacy tools when they still get the job done and this certainly qualifies. To make it more PowerShell friendly though, let's clean up the output by filtering out blanks, that last line and skipping the \"header\" lines.<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">PS C:\\&gt; invoke-command {\r\n&gt;&gt; net localgroup administrators | \r\n&gt;&gt; where {$_ -AND $_ -notmatch \"command completed successfully\"} | \r\n&gt;&gt; select -skip 4\r\n&gt;&gt; } -computer chi-fp01\r\n&gt;&gt;\r\nAdministrator\r\nGLOBOMANTICS\\Chicago IT\r\nGLOBOMANTICS\\Domain Admins<\/pre>\n<p>Boom. Now I only get the member names. Let's go one more level and write an object to the pipeline and be better at handling output from multiple computers. I came up with a scriptblock like this:<\/p>\n<pre class=\"lang:ps decode:true\">$members = net localgroup administrators | \r\n where {$_ -AND $_ -notmatch \"command completed successfully\"} | \r\n select -skip 4\r\nNew-Object PSObject -Property @{\r\n Computername = $env:COMPUTERNAME\r\n Group = \"Administrators\"\r\n Members=$members\r\n }<\/pre>\n<p>This will create a simple object with a properties for the computername, group name and members. Here's how I can use it with Invoke-Command.<\/p>\n<pre class=\"lang:ps decode:true crayon-selected\">invoke-command {\r\n$members = net localgroup administrators | \r\n where {$_ -AND $_ -notmatch \"command completed successfully\"} | \r\n select -skip 4\r\nNew-Object PSObject -Property @{\r\n Computername = $env:COMPUTERNAME\r\n Group = \"Administrators\"\r\n Members=$members\r\n }\r\n} -computer chi-fp01,chi-win8-01,chi-ex01 -HideComputerName | \r\nSelect * -ExcludeProperty RunspaceID<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2913\" alt=\"get-netlocalgroup\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png\" width=\"625\" height=\"305\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-300x146.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-624x305.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup.png 1059w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a>Now I have objects that I can export to XML, convert to HTML or send to a file. But since I've come this far, I might as well take a few more minutes and turn this into a reusable tool.<\/p>\n<pre class=\"lang:ps decode:true\">Function Get-NetLocalGroup {\r\n[cmdletbinding()]\r\n\r\nParam(\r\n[Parameter(Position=0)]\r\n[ValidateNotNullorEmpty()]\r\n[object[]]$Computername=$env:computername,\r\n[ValidateNotNullorEmpty()]\r\n[string]$Group = \"Administrators\",\r\n[switch]$Asjob\r\n)\r\n\r\nWrite-Verbose \"Getting members of local group $Group\"\r\n\r\n#define the scriptblock\r\n$sb = {\r\n Param([string]$Name = \"Administrators\")\r\n$members = net localgroup $Name | \r\n where {$_ -AND $_ -notmatch \"command completed successfully\"} | \r\n select -skip 4\r\nNew-Object PSObject -Property @{\r\n Computername = $env:COMPUTERNAME\r\n Group = $Name\r\n Members=$members\r\n }\r\n} #end scriptblock\r\n\r\n#define a parameter hash table for splatting\r\n$paramhash = @{\r\n Scriptblock = $sb\r\n HideComputername=$True\r\n ArgumentList=$Group\r\n }\r\n\r\nif ($Computername[0] -is [management.automation.runspaces.pssession]) {\r\n    $paramhash.Add(\"Session\",$Computername)\r\n}\r\nelse {\r\n    $paramhash.Add(\"Computername\",$Computername)\r\n}\r\n\r\nif ($asjob) {\r\n    Write-Verbose \"Running as job\"\r\n    $paramhash.Add(\"AsJob\",$True)\r\n}\r\n\r\n#run the command\r\nInvoke-Command @paramhash | Select * -ExcludeProperty RunspaceID\r\n\r\n} #end Get-NetLocalGroup<\/pre>\n<p>This function lets me specify a group of computers or PSSessions as well as the local group name. Today I may need to know who belongs to the local administrator's group but tomorrow it might be Remote Desktop Users.<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">PS C:\\&gt; Get-NetLocalGroup -Group \"remote desktop users\" -Computername $sessions\r\n\r\nGroup        : remote desktop users\r\nComputername : CHI-FP01\r\nMembers      : \r\n\r\nGroup        : remote desktop users\r\nComputername : CHI-WIN8-01\r\nMembers      : \r\n\r\nComputername : CHI-EX01\r\nMembers      : \r\nGroup        : remote desktop users\r\n\r\nGroup        : remote desktop users\r\nComputername : CHI-DC01\r\nMembers      : jfrost<\/pre>\n<p>Sometimes even old school tools can still be a part of your admin toolkit.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I posted a quick article on getting the age of the local administrator account password. It seemed appropropriate to follow up on a quick and dirty way to list all members of the local administrator group. Normally, I would turn to WMI (and have written about this in the past). But WMI is relatively&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_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":[72,4,8],"tags":[32,122,534,87,540],"class_list":["post-2910","post","type-post","status-publish","format-standard","hentry","category-commandline","category-powershell","category-scripting","tag-functions","tag-invoke-command","tag-powershell","tag-remoting","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Yesterday I posted a quick article on getting the age of the local administrator account password. It seemed appropropriate to follow up on a quick and dirty way to list all members of the local administrator group. Normally, I would turn to WMI (and have written about this in the past). But WMI is relatively...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-02T14:15:22+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get Local Admin Group Members in a New Old Way\",\"datePublished\":\"2013-04-02T14:15:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/\"},\"wordCount\":363,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/get-netlocalgroup-1024x500.png\",\"keywords\":[\"functions\",\"Invoke-Command\",\"PowerShell\",\"remoting\",\"Scripting\"],\"articleSection\":[\"CommandLine\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/\",\"name\":\"Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/get-netlocalgroup-1024x500.png\",\"datePublished\":\"2013-04-02T14:15:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/get-netlocalgroup.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/get-netlocalgroup.png\",\"width\":1059,\"height\":518},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2910\\\/get-local-admin-group-members-in-a-new-old-way\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CommandLine\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/commandline\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Local Admin Group Members in a New Old Way\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator","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:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/","og_locale":"en_US","og_type":"article","og_title":"Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator","og_description":"Yesterday I posted a quick article on getting the age of the local administrator account password. It seemed appropropriate to follow up on a quick and dirty way to list all members of the local administrator group. Normally, I would turn to WMI (and have written about this in the past). But WMI is relatively...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-04-02T14:15:22+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get Local Admin Group Members in a New Old Way","datePublished":"2013-04-02T14:15:22+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/"},"wordCount":363,"commentCount":5,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png","keywords":["functions","Invoke-Command","PowerShell","remoting","Scripting"],"articleSection":["CommandLine","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/","name":"Get Local Admin Group Members in a New Old Way &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup-1024x500.png","datePublished":"2013-04-02T14:15:22+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-netlocalgroup.png","width":1059,"height":518},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2910\/get-local-admin-group-members-in-a-new-old-way\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"CommandLine","item":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},{"@type":"ListItem","position":2,"name":"Get Local Admin Group Members in a New Old Way"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1532,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1532\/get-local-administrators-with-wmi-and-powershell\/","url_meta":{"origin":2910,"position":0},"title":"Get Local Administrators with WMI and PowerShell","author":"Jeffery Hicks","date":"July 1, 2011","format":false,"excerpt":"Earlier this week I was helping someone out on a problem working with the local administrators group. There are a variety of ways to enumerate the members of a local group. The code he was using involved WMI. I hadn't really worked with the WMI approach in any great detail\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2338,"url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/2338\/query-local-administrators-with-wmi\/","url_meta":{"origin":2910,"position":1},"title":"Query Local Administrators with WMI","author":"Jeffery Hicks","date":"May 23, 2012","format":false,"excerpt":"I have a quick post today on using WMI to list members of the local administrators group. It is very simple to get the group itself with the Win32_Group class. PS S:\\> get-wmiobject win32_group -filter \"name='Administrators'\" Caption Domain Name SID ------- ------ ---- --- SERENITY\\Adminis... SERENITY Administrators S-1-5-32-544 But the\u2026","rel":"","context":"In &quot;WMI&quot;","block_context":{"text":"WMI","link":"https:\/\/jdhitsolutions.com\/blog\/category\/wmi\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2342,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2342\/query-local-administrators-with-cim\/","url_meta":{"origin":2910,"position":2},"title":"Query Local Administrators with CIM","author":"Jeffery Hicks","date":"May 24, 2012","format":false,"excerpt":"Yesterday I posted an article on listing members of the local administrators group with PowerShell and Get-WmiObject. PowerShell 3.0 offers an additional way using the CIM cmdlets. The CIM cmdlets query the same WMI information, except instead of using the traditional RPC\/DCOM connection, these cmdlets utilize PowerShell's remoting endpoint so\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/talkbubble-v3-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4908,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4908\/get-local-group-members-with-powershell\/","url_meta":{"origin":2910,"position":3},"title":"Get Local Group Members with PowerShell","author":"Jeffery Hicks","date":"February 17, 2016","format":false,"excerpt":"Recently I posted a function to get information about local user accounts. I received a lot of positive feedback so it seemed natural to take this the next step and create a similar function to enumerate or list members of a local group, such as Administrators. The function, Get-LocalGroupMember, also\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-7.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-7.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-7.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1355,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1355\/get-comon-data\/","url_meta":{"origin":2910,"position":4},"title":"Get Common Data","author":"Jeffery Hicks","date":"April 18, 2011","format":false,"excerpt":"While judging entries in this year's Scripting Games I realized there were some common properties that were repeatedly used. This got me thinking about a simple way to retrieve that information with a single command Then you could access the data values from within your script. I've put together a\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":170,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/170\/friendly-wmi-dates\/","url_meta":{"origin":2910,"position":5},"title":"Friendly WMI Dates","author":"Jeffery Hicks","date":"August 5, 2009","format":false,"excerpt":"Gee..you think you know something only to find out you don\u2019t. Or maybe this falls into the category of teaching an old dog new tricks. When I first started using PowerShell several years ago, I learned about how to convert a WMI date to a more user friendly format...","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2910"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2910\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}