{"id":1562,"date":"2011-07-12T09:10:59","date_gmt":"2011-07-12T13:10:59","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1562"},"modified":"2011-07-11T21:13:26","modified_gmt":"2011-07-12T01:13:26","slug":"get-shared-resource","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/","title":{"rendered":"Get Shared Resource"},"content":{"rendered":"<p>I was poking around WMI the other day in PowerShell and was intrigued by the Win32_Share class. This is a great way to find out what items are shared on a server such as printers and folders, although it's not limited to those types of resources. I thought this would make a useful function; one that you might use to audit a collection of computers.<!--more--><\/p>\n<p>The function, Get-ShareResource, takes a computername as a parameter, but it defaults to the local computername. I didn't add support for alternate credentials so if connecting to a remote machine you'll need to make sure you have admin rights on the computer. You could add support for alternate credentials if you are so inclined. Here's the main part of the function.<\/p>\n<p>[cc lang=\"PowerShell\"]<\/p>\n<p>Function Get-ShareResource {<\/p>\n<p>[cmdletbinding()]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0,ValuefromPipeline=$True)]<br \/>\n[Alias(\"Name\")]<br \/>\n[string[]]$Computername=$env:computername<br \/>\n)<\/p>\n<p>Begin {<br \/>\n    Write-Verbose \"Starting $($myinvocation.mycommand)\"<br \/>\n}<\/p>\n<p>Process {<\/p>\n<p>    Foreach ($computer in $computername) {<br \/>\n        Write-Verbose \"Querying $($computer.ToUpper())\"<br \/>\n        Try {<br \/>\n            Get-WmiObject -Class Win32_Share -ComputerName $Computername -erroraction \"Stop\" |<br \/>\n            Select Name,Path,Description,Status,<br \/>\n            @{Name=\"Type\";Expression={<br \/>\n              Switch ($_.Type) {<br \/>\n               0 {\"File\"}<br \/>\n               1 {\"Printer\"}<br \/>\n               2 {\"Device\"}<br \/>\n               3 {\"IPC\"}<br \/>\n               2147483648 {\"AdminDisk\"}<br \/>\n               2147483649 {\"AdminPrint\"}<br \/>\n               2147483650 {\"AdminDevice\"}<br \/>\n               2147483651 {\"AdminIPC\"}<br \/>\n               Default {$_.Type}<br \/>\n              }<br \/>\n            }},<br \/>\n            @{Name=\"Hidden\";Expression={<br \/>\n            #use a regular expression and check if the name ends in a $<br \/>\n            #which indicates a hidden share<br \/>\n            if ($_.Name -match \"[\\$]$\") {<br \/>\n               $True<br \/>\n            }<br \/>\n            else {<br \/>\n               $False<br \/>\n            }<br \/>\n            }},<br \/>\n            @{Name=\"Computername\";Expression={$_.__SERVER}}<br \/>\n        }<br \/>\n        Catch {<br \/>\n            $msg=\"Failed to get share information from {0}. {1}\" -f $($computer.ToUpper()),$_.Exception.Message<br \/>\n            Write-Warning -Message $msg<br \/>\n        }<\/p>\n<p>    }#foreach<\/p>\n<p>} #process<\/p>\n<p>End {<br \/>\n    Write-Verbose \"Ending $($myinvocation.mycommand)\"<\/p>\n<p>}<\/p>\n<p>} #end function<br \/>\n[\/cc]<\/p>\n<p>The core command is a Get-WmiObject expression to retrieve all instances of the Win32_Share class from the specified computer.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nTry {<br \/>\n            Get-WmiObject -Class Win32_Share -ComputerName $Computername -erroraction \"Stop\"<br \/>\n[\/cc]<\/p>\n<p>But I then select a few properties to write to the pipeline. I also \"convert\" a few properties into more meaningful values. For example, the Type property is a numeric value so I use a Switch construct to create a \"better\" value.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n Select Name,Path,Description,Status,<br \/>\n            @{Name=\"Type\";Expression={<br \/>\n              Switch ($_.Type) {<br \/>\n               0 {\"File\"}<br \/>\n               1 {\"Printer\"}<br \/>\n               2 {\"Device\"}<br \/>\n               3 {\"IPC\"}<br \/>\n               2147483648 {\"AdminDisk\"}<br \/>\n               2147483649 {\"AdminPrint\"}<br \/>\n               2147483650 {\"AdminDevice\"}<br \/>\n               2147483651 {\"AdminIPC\"}<br \/>\n               Default {$_.Type}<br \/>\n              }<br \/>\n            }},<br \/>\n[\/cc]<\/p>\n<p>If you're wondering where I got the values, I looked up the Win32_Share class on MSDN. I also thought it would be handy to have a boolean value to check if share is hidden or not. A hidden share name will end in a $ so I use a regular expression comparison.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n@{Name=\"Hidden\";Expression={<br \/>\n            #use a regular expression and check if the name ends in a $<br \/>\n            #which indicates a hidden share<br \/>\n            if ($_.Name -match \"[\\$]$\") {<br \/>\n               $True<br \/>\n            }<br \/>\n            else {<br \/>\n               $False<br \/>\n            }<br \/>\n            }},<br \/>\n[\/cc]<\/p>\n<p>The last custom property is for the computername. The class itself lacks a property but I can always use the system class, __SERVER.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n @{Name=\"Computername\";Expression={$_.__SERVER}}<br \/>\n[\/cc]<\/p>\n<p>So, assuming I don't run into errors getting the WMI objects, I end up with results like this:<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nPS S:\\> get-shareresource<\/p>\n<p>Name         : ADMIN$<br \/>\nPath         : C:\\Windows<br \/>\nDescription  : Remote Admin<br \/>\nStatus       : OK<br \/>\nType         : AdminDisk<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : C$<br \/>\nPath         : C:\\<br \/>\nDescription  : Default share<br \/>\nStatus       : OK<br \/>\nType         : AdminDisk<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : Download$<br \/>\nPath         : c:\\users\\jeff\\downloads<br \/>\nDescription  :<br \/>\nStatus       : OK<br \/>\nType         : File<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : E$<br \/>\nPath         : E:\\<br \/>\nDescription  : Default share<br \/>\nStatus       : OK<br \/>\nType         : AdminDisk<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : IPC$<br \/>\nPath         :<br \/>\nDescription  : Remote IPC<br \/>\nStatus       : OK<br \/>\nType         : AdminIPC<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : print$<br \/>\nPath         : C:\\Windows\\system32\\spool\\drivers<br \/>\nDescription  : Printer Drivers<br \/>\nStatus       : OK<br \/>\nType         : File<br \/>\nHidden       : True<br \/>\nComputername : SERENITY<\/p>\n<p>Name         : Users<br \/>\nPath         : C:\\Users<br \/>\nDescription  :<br \/>\nStatus       : OK<br \/>\nType         : File<br \/>\nHidden       : False<br \/>\nComputername : SERENITY<br \/>\n[\/cc]<\/p>\n<p>The computername parameter can accept pipelined input so it's pretty easy to create an audit report.<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nPS C:\\> Get-Content c:\\work\\computers.txt | Get-ShareResource | Export-CSV c:\\work\\ShareAudit.csv<br \/>\n[\/cc]<\/p>\n<p>This isn't an especially fancy function, but I hope you'll pick up on using Switch to \"decode\" and provide more meaningful information.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/07\/Get-ShareResource.txt' target='_blank'>Get-ShareResource<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was poking around WMI the other day in PowerShell and was intrigued by the Win32_Share class. This is a great way to find out what items are shared on a server such as printers and folders, although it&#8217;s not limited to those types of resources. I thought this would make a useful function; one&#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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75,19],"tags":[224,103,534,540,547],"class_list":["post-1562","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-wmi","tag-function","tag-get-wmiobject","tag-powershell","tag-scripting","tag-wmi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get Shared Resource &#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\/wmi\/1562\/get-shared-resource\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Shared Resource &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I was poking around WMI the other day in PowerShell and was intrigued by the Win32_Share class. This is a great way to find out what items are shared on a server such as printers and folders, although it&#039;s not limited to those types of resources. I thought this would make a useful function; one...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-07-12T13:10:59+00:00\" \/>\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\\\/wmi\\\/1562\\\/get-shared-resource\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get Shared Resource\",\"datePublished\":\"2011-07-12T13:10:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/\"},\"wordCount\":665,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"Function\",\"Get-WMIObject\",\"PowerShell\",\"Scripting\",\"WMI\"],\"articleSection\":[\"PowerShell v2.0\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/\",\"name\":\"Get Shared Resource &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-07-12T13:10:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wmi\\\/1562\\\/get-shared-resource\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Shared Resource\"}]},{\"@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 Shared Resource &#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\/wmi\/1562\/get-shared-resource\/","og_locale":"en_US","og_type":"article","og_title":"Get Shared Resource &#8226; The Lonely Administrator","og_description":"I was poking around WMI the other day in PowerShell and was intrigued by the Win32_Share class. This is a great way to find out what items are shared on a server such as printers and folders, although it's not limited to those types of resources. I thought this would make a useful function; one...","og_url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-07-12T13:10:59+00:00","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\/wmi\/1562\/get-shared-resource\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get Shared Resource","datePublished":"2011-07-12T13:10:59+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/"},"wordCount":665,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["Function","Get-WMIObject","PowerShell","Scripting","WMI"],"articleSection":["PowerShell v2.0","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/","url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/","name":"Get Shared Resource &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-07-12T13:10:59+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1562\/get-shared-resource\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Get Shared Resource"}]},{"@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":3497,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3497\/resolving-sids-with-wmi-wsman-and-powershell\/","url_meta":{"origin":1562,"position":0},"title":"Resolving SIDs with WMI, WSMAN and PowerShell","author":"Jeffery Hicks","date":"October 15, 2013","format":false,"excerpt":"In the world of Windows, an account SID can be a very enigmatic thing. Who is S-1-5-21-2250542124-3280448597-2353175939-1019? Fortunately, many applications, such as the event log viewer resolve the SID to an account name. The downside, is that when you are accessing that same type of information from PowerShell, you end\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"win32_sid-fail","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1209,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1209\/get-ip-data\/","url_meta":{"origin":1562,"position":1},"title":"Get IP Data","author":"Jeffery Hicks","date":"March 10, 2011","format":false,"excerpt":"I was doodling in PowerShell this morning and ended up with what I hope is a useful function to retrieve IP configuration information, sort of like IPCONFIG, but using WMI. The beauty is that I can connect to remote machines and the output is an object which leads to all\u2026","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":[]},{"id":1413,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1413\/get-registry-size-and-age\/","url_meta":{"origin":1562,"position":2},"title":"Get Registry Size and Age","author":"Jeffery Hicks","date":"May 4, 2011","format":false,"excerpt":"I'm not sure why the registry has been on my mind lately. I probably need a vacation to get out more. But I put together a relatively simple Windows PowerShell function to retrieve registry statistics that you might find useful. My Get-Registry function will return information about the size of\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/registry.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1532,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1532\/get-local-administrators-with-wmi-and-powershell\/","url_meta":{"origin":1562,"position":3},"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":3555,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3555\/get-powershell-version-with-wmi\/","url_meta":{"origin":1562,"position":4},"title":"Get PowerShell Version with WMI","author":"Jeffery Hicks","date":"November 13, 2013","format":false,"excerpt":"With the release of PowerShell 4.0, it is possible you might end up with a mix of systems in your environment. I know I do because I do a lot of writing, testing and development that requires multiple versions in my test network. Recently I was doing some Group Policy\u2026","rel":"","context":"In &quot;Group Policy&quot;","block_context":{"text":"Group Policy","link":"https:\/\/jdhitsolutions.com\/blog\/category\/group-policy\/"},"img":{"alt_text":"get-wmipshell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/get-wmipshell-1024x244.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/get-wmipshell-1024x244.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/get-wmipshell-1024x244.png?resize=525%2C300 1.5x"},"classes":[]},{"id":654,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/654\/new-wmi-object\/","url_meta":{"origin":1562,"position":5},"title":"New WMI Object","author":"Jeffery Hicks","date":"May 17, 2010","format":false,"excerpt":"I have one more variation on my recent theme of working with WMI objects. I wanted to come up with something flexible and re-usable where you could specify a WMI class and some properties and get a custom object with all the classes combined. My solution is a function called\u2026","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\/1562","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=1562"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1562\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}