{"id":5500,"date":"2020-06-15T17:00:00","date_gmt":"2020-06-15T15:00:00","guid":{"rendered":"https:\/\/www.razumny.no\/?p=5500"},"modified":"2020-04-29T14:16:24","modified_gmt":"2020-04-29T12:16:24","slug":"powershell-check-remote-computer-disk-capacity","status":"publish","type":"post","link":"https:\/\/www.razumny.no\/?p=5500","title":{"rendered":"PowerShell: Check Remote Computer Disk Capacity"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">From time to time, I get tickets where one of many possible root causes may be a full disk. While accessing this information over RDP is often an option, it is rather more intrusive than needed. What&#8217;s more, I usually don&#8217;t have access to access file servers over RDP. Enter PowerShell and the <code>get-WmiObject<\/code> query!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using the <code>Win32_LogicalDisk<\/code> class, and specifying the computer I want to access with the <code>-ComputerName<\/code>parameter, I get the information readily enough. The complete query looks like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>get-WmiObject win32_logicaldisk -Computername ComputerID<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The output looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"391\" src=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-25.png?resize=749%2C391&#038;ssl=1\" alt=\"Screenshot of Powershell query, showing the results of the query:\n\nDeviceID     : C:\nDriveType    : 3\nProviderName : \nFreeSpace    : 440359514112\nSize         : 510914457600\nVolumeName   : OSDisk\n\nDeviceID     : I:\nDriveType    : 4\nProviderName : \\\\REDACTED\nFreeSpace    : 244771405824\nSize         : 1073738674176\nVolumeName   : Data1\n\nDeviceID     : K:\nDriveType    : 4\nProviderName : \\\\REDACTED\nFreeSpace    : 244771405824\nSize         : 1073738674176\nVolumeName   : Data1\n\" class=\"wp-image-5502\" title=\"Screenshot of Powershell query, showing the results of the query:  DeviceID     : C: DriveType    : 3 ProviderName :  FreeSpace    : 440359514112 Size         : 510914457600 VolumeName   : OSDisk  DeviceID     : I: DriveType    : 4 ProviderName : \\\\REDACTED FreeSpace    : 244771405824 Size         : 1073738674176 VolumeName   : Data1  DeviceID     : K: DriveType    : 4 ProviderName : \\\\REDACTED FreeSpace    : 244771405824 Size         : 1073738674176 VolumeName   : Data1\" srcset=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-25.png?w=749&amp;ssl=1 749w, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-25.png?resize=300%2C157&amp;ssl=1 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see from the screenshot above, the output returns <code>FreeSpace<\/code> in Bytes. Divide by 1&#8217;024, 1&#8217;048&#8217;576, or 1&#8217;073&#8217;741&#8217;824 to get available space in KB, MB, or GB, respectively (though a thousand, a million, and a billion should get you close enough for government work).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You might also note that the output lists ALL mapped drives, including mapped network drives, which means that the command is also useful to see whether a drive is mapped, and whether it&#8217;s mapped correctly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From time to time, I get tickets where one of many possible root causes may be a full disk. While accessing this information over RDP is often an option, it is rather more intrusive than needed. What&#8217;s more, I usually don&#8217;t have access to access file servers over RDP. Enter PowerShell and the get-WmiObject query! [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":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},"jetpack_post_was_ever_published":false},"categories":[615,820],"tags":[1255,1252,969,1253,1254],"class_list":["post-5500","post","type-post","status-publish","format-standard","hentry","category-how-to-2","category-powershell","tag-computername","tag-get-wmiobject","tag-powershell","tag-win32","tag-win32_logicaldisk"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p2ukSU-1qI","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":6835,"url":"https:\/\/www.razumny.no\/?p=6835","url_meta":{"origin":5500,"position":0},"title":"PowerShell: Troubleshoot network connectivity","author":"Aleksander Nordgarden-R\u00f8dner","date":"15\/08\/2022","format":false,"excerpt":"A while back, a customer contacted us because they were having problems connecting to Amazon WorkSpaces. This led me to dig into a PowerShell command which was new to me; Test-NetConnection. In its simplest form, the command simply checks your network connectivity: I, however, needed to confirm that I was\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-100.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-100.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-100.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-100.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5459,"url":"https:\/\/www.razumny.no\/?p=5459","url_meta":{"origin":5500,"position":1},"title":"PowerShell: Check computer last logon date","author":"Aleksander Nordgarden-R\u00f8dner","date":"18\/05\/2020","format":false,"excerpt":"In a recently closed ticket, I had specified that the solution would be automatically applied upon reboot of a computer. As so often happens one of the twenty or so users affected by the solution emailed to say that it didn't work. Having dealt with said user before, I had\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5446,"url":"https:\/\/www.razumny.no\/?p=5446","url_meta":{"origin":5500,"position":2},"title":"Powershell: Retrieving all properties for a given user object","author":"Aleksander Nordgarden-R\u00f8dner","date":"20\/04\/2020","format":false,"excerpt":"I was asked to provide an overview of all available properties in an Active Directory user object for an upcoming project. As it turns out, that is very easily accomplished. Unsurprisingly, PowerShell has an applet for this. We use the Get-ADUser applet, with the parameters Identity to identify the user\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"Output of get-aduser command, filtering on identity and specific proeprties","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5400,"url":"https:\/\/www.razumny.no\/?p=5400","url_meta":{"origin":5500,"position":3},"title":"PowerShell: Find all enabled user accounts","author":"Aleksander Nordgarden-R\u00f8dner","date":"17\/02\/2020","format":false,"excerpt":"Some time ago, I was asked to provide a list of all enabled user accounts in Active Directory. My thoughts immediately went to PowerShell, assuming that there would be tools available to achieve that task. I knew that the Get-ADUser query, combined with a parameter, would likely be the ticket.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5402,"url":"https:\/\/www.razumny.no\/?p=5402","url_meta":{"origin":5500,"position":4},"title":"PowerShell: Count enabled user accounts","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/03\/2020","format":false,"excerpt":"A few weeks ago, I showed you how to get a list of all enabled user accounts in PowerShell. Perhaps unsurprisingly, after having presented this to my customer, it transpired that what they really wanted, was to know how many enabled user accounts existed in Active Directory. Once more, my\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5451,"url":"https:\/\/www.razumny.no\/?p=5451","url_meta":{"origin":5500,"position":5},"title":"PowerShell: Pipe output to CSV file","author":"Aleksander Nordgarden-R\u00f8dner","date":"11\/05\/2020","format":false,"excerpt":"Last week, I showed you how to get specific properties for all users in a given OU. Knowing that the output of that query quickly gets hard to navigate, wanting to remove the extraneous data that the customer didn't request, and assuming that they wanted to manipulate the data, I\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5500"}],"version-history":[{"count":3,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5500\/revisions"}],"predecessor-version":[{"id":5505,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5500\/revisions\/5505"}],"wp:attachment":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}