{"id":24,"date":"2006-03-15T17:59:00","date_gmt":"2006-03-15T21:59:00","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/2006\/03\/15\/get-percent-free-space\/"},"modified":"2009-08-05T13:03:51","modified_gmt":"2009-08-05T17:03:51","slug":"get-percent-free-space","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/","title":{"rendered":"Get Percent Free Space"},"content":{"rendered":"<p>I've put together a function that will return the percentage free space on a given logical drive for a specified server.  The function in the following script is really doing all the hard work.  The rest of the script is simply a demonstration on how to call the function. The script uses WMI and queries the Win32_LogicalDisk for the size and freespace properties.  With these values it's pretty simple to calculate a percentage.<\/p>\n<p><span style=\"font-family:courier new;font-size:85%;\">'GetPercentFreeDrive.vbs<\/span><span style=\"font-size:85%;\"><\/p>\n<p>'<span style=\"font-family: courier new;\">specify alternate credentials for remote systems<\/span><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">strUsername=\"\"<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">strPassword=\"\"<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">strSrv=InputBox(\"What computer do you want to query\",\"Get Percent Free\",\"localhost\")<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">strDeviceID=InputBox(\"What drive do you want to query?\",\"Get Percent Free\",\"c:\")<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">WScript.Echo UCase(strDeviceID) & \" on \" &amp; UCase(strSrv) & \" has \" &amp; GetPercent(strSrv,strDeviceID,strUsername,strPassword) & \" free space.\"<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">Function GetPercent(strSrv,strDeviceID,strUsername,strPassword)<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">'deviceID is the drive letter and colon, eg E: with no trailing \\<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">On Error Resume Next<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">Dim SWBemlocator,objWMI,objRef<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">Const wbemFlagReturnImmediately=&amp;h10<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">Const wbemFlagForwardOnly=&h20<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">strQuery=\"Select DeviceID,Size,FreeSpace from Win32_LogicalDisk WHERE DeviceID='\" &amp; strDeviceID & \"'\"<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">'strip out any trailing \\ if found<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">If Right(strDeviceID,1)=\"\\\" Then strDeviceID=Replace(strDeviceID,\"\\\",\"\")<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">'validate strDeviceID<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">If Len(strDeviceID)=2 And Right(strDeviceID,1)=\":\" Then<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">Set SWBemlocator = CreateObject(\"WbemScripting.SWbemLocator\")<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">SWBemlocator.Security_.ImpersonationLevel=3<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">SWBemlocator.Security_.AuthenticationLevel=WbemAuthenticationLevelPktPrivacy<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">Set objWMI=SWBemlocator.ConnectServer(strSrv,\"\\root\\CIMV2\",strUsername,strPassword)<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span> <span style=\"font-family:courier new;font-size:85%;\">Set objRef=objWMI.ExecQuery(strQuery,\"WQL\",wbemForwardOnly+wbemFlagReturnImmediately)<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\"> For Each dev In objRef<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"> iFreeSpace=dev.FreeSpace<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"> iSize=dev.Size<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">Next<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"><br \/> If iSize=\"\" Then<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">  GetPercent=\"Drive Not Found\"<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"> Else<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\">  GetPercent=FormatPercent(iFreeSpace\/iSize,2)<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"> End If<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">Else<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family:courier new;font-size:85%;\"> GetPercent=\"ERROR\"<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">End If<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family:courier new;font-size:85%;\">End Function<\/span><span style=\"font-size:85%;\"><br \/><\/span><\/p>\n<p><font face=\"tahoma\" size=1>Technorati Tags:<br \/><a href=\"http:\/\/www.technorati.com\/tags\/wmi\" rel=\"tag\">WMI<\/a><br \/><a href=\"http:\/\/www.technoratic.com\/tags\/scripting\" rel=\"tag\">Scripting<\/a><br \/><a href=\"http:\/\/www.technoratic.com\/tags\/VBScript\" rel=\"tag\">VBScript<\/a><br \/><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve put together a function that will return the percentage free space on a given logical drive for a specified server. The function in the following script is really doing all the hard work. The rest of the script is simply a demonstration on how to call the function. The script uses WMI and queries&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","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":[8],"tags":[535,547],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-scripting","tag-vbscript","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 Percent Free Space &#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\/scripting\/24\/get-percent-free-space\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Percent Free Space &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve put together a function that will return the percentage free space on a given logical drive for a specified server. The function in the following script is really doing all the hard work. The rest of the script is simply a demonstration on how to call the function. The script uses WMI and queries...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2006-03-15T21:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-08-05T17:03:51+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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get Percent Free Space\",\"datePublished\":\"2006-03-15T21:59:00+00:00\",\"dateModified\":\"2009-08-05T17:03:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/\"},\"wordCount\":267,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"VBScript\",\"WMI\"],\"articleSection\":[\"Scripting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/\",\"name\":\"Get Percent Free Space &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2006-03-15T21:59:00+00:00\",\"dateModified\":\"2009-08-05T17:03:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/24\\\/get-percent-free-space\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Scripting\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/scripting\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Percent Free Space\"}]},{\"@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 Percent Free Space &#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\/scripting\/24\/get-percent-free-space\/","og_locale":"en_US","og_type":"article","og_title":"Get Percent Free Space &#8226; The Lonely Administrator","og_description":"I've put together a function that will return the percentage free space on a given logical drive for a specified server. The function in the following script is really doing all the hard work. The rest of the script is simply a demonstration on how to call the function. The script uses WMI and queries...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/","og_site_name":"The Lonely Administrator","article_published_time":"2006-03-15T21:59:00+00:00","article_modified_time":"2009-08-05T17:03:51+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":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get Percent Free Space","datePublished":"2006-03-15T21:59:00+00:00","dateModified":"2009-08-05T17:03:51+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/"},"wordCount":267,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["VBScript","WMI"],"articleSection":["Scripting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/","name":"Get Percent Free Space &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2006-03-15T21:59:00+00:00","dateModified":"2009-08-05T17:03:51+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/24\/get-percent-free-space\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Scripting","item":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},{"@type":"ListItem","position":2,"name":"Get Percent Free Space"}]},{"@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":449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/449\/drive-report-console-chart\/","url_meta":{"origin":24,"position":0},"title":"Drive Report Console Chart","author":"Jeffery Hicks","date":"October 15, 2009","format":false,"excerpt":"In thinking about some of my recent posts, I realize I should make clear that these scripts and functions are not necessarily good PowerShell examples. They don\u2019t take advantage of objects and the pipeline. They are single purpose and one-dimensional. Not that there\u2019s anything wrong with that. My recent examples,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"drivereport screenshot","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/10\/drivereport_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1413,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1413\/get-registry-size-and-age\/","url_meta":{"origin":24,"position":1},"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":654,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/654\/new-wmi-object\/","url_meta":{"origin":24,"position":2},"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":[]},{"id":14,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/14\/finding-service-uptime\/","url_meta":{"origin":24,"position":3},"title":"Finding Service Uptime","author":"Jeffery Hicks","date":"January 10, 2006","format":false,"excerpt":"Ever wonder how long a particular service has been running? With WMI you can come pretty close to getting a handle on this. We start with Win32_Service to get the current process handle. Once we have that, we can query the Win32_Process class and get the creation time for that\u2026","rel":"","context":"In &quot;Scripting&quot;","block_context":{"text":"Scripting","link":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3661,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3661\/creating-cim-scripts-without-scripting\/","url_meta":{"origin":24,"position":4},"title":"Creating CIM Scripts without Scripting","author":"Jeffery Hicks","date":"January 29, 2014","format":false,"excerpt":"When Windows 8 and Windows Server 2012 came out, along with PowerShell 3.0, we got our hands on some terrific technology in the form of the CIM cmdlets. Actually, we got much more than people realize. One of the reasons there was a big bump in the number of shipping\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":1625,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1625\/get-process-owner\/","url_meta":{"origin":24,"position":5},"title":"Get Process Owner","author":"Jeffery Hicks","date":"August 25, 2011","format":false,"excerpt":"I've been working on my second training course for Train Signal on managing Windows Server 2008 with Windows PowerShell, specifically the lesson on managing processes. I thought I'd share a little tidbit I worked out. In fact, I hope you'll stay tuned for other little goodies over the next several\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\/24","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=24"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}