{"id":473627,"date":"2016-05-13T15:15:38","date_gmt":"2016-05-13T20:15:38","guid":{"rendered":"https:\/\/mkncreations.com\/site\/?p=473627"},"modified":"2017-01-18T09:59:55","modified_gmt":"2017-01-18T14:59:55","slug":"vbscript-to-show-volume-size-info","status":"publish","type":"post","link":"https:\/\/mkncreations.com\/site\/2016\/05\/vbscript-to-show-volume-size-info\/","title":{"rendered":"VBScript to show volume size info"},"content":{"rendered":"<p>Here is an example of a vbscript that will show you volume size info for C. It will display the following info:<\/p>\n<p>&#8211; Computer Name\/hostname<br \/>\n&#8211; Volume name, File System<br \/>\n&#8211; Free space<br \/>\n&#8211; Used space<br \/>\n&#8211; Total size<\/p>\n<blockquote><p>\n strComputer = &#8220;.&#8221; <\/p>\n<p>Set objWMIService = GetObject(&#8220;winmgmts:\\\\&#8221; &#038; strComputer &#038; &#8220;\\root\\CIMV2&#8221;)<br \/>\nSet colItems = objWMIService.ExecQuery( _<br \/>\n    &#8220;SELECT * FROM Win32_LogicalDisk where DeviceID=&#8217;c:'&#8221;,,48) <\/p>\n<p>For Each objItem in colItems <\/p>\n<p>if len(objItem.VolumeName)>0 then<\/p>\n<p>Wscript.Echo &#8220;&#8221; &#038; vbCrLf _<br \/>\n\t\t&#038; &#8220;Computer Name:&#8221;  &#038; vbTab &#038; objItem.SystemName   &#038; vbCrLf _<br \/>\n        &#038; &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221; &#038; vbCrLf _<br \/>\n\t\t&#038; &#8220;Volume Name:&#8221; &#038; vbTab &#038; objItem.VolumeName &#038; &#8221; (&#8221; &#038; objItem.Name &#038; &#8220;)&#8221;  &#038; &#8221; (&#8221; &#038; objItem.FileSystem &#038; &#8220;)&#8221;  &#038; vbCrLf _<br \/>\n        &#038; &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221; &#038; vbCrLf _<br \/>\n        &#038; &#8220;Free Space:&#8221; &#038; vbTab _<br \/>\n        &#038; FormatNumber((CDbl(objItem.FreeSpace)\/1024\/1024\/1024))  &#038; &#8221; (&#8221; &#038; FormatNumber(((FormatNumber((CDbl(objItem.FreeSpace)\/1024\/1024\/1024))) \/ (FormatNumber((CDbl(objItem.Size)\/1024\/1024\/1024))) )*100,2) &#038; &#8220;%)&#8221; &#038; vbCrLf _<br \/>\n        &#038; &#8220;Used Space:&#8221; &#038; vbTab _<br \/>\n        &#038; FormatNumber((CDbl(objItem.Size &#8211; objItem.FreeSpace)\/1024\/1024\/1024)) &#038; &#8221; (&#8221; &#038; FormatNumber(((FormatNumber((CDbl(objItem.Size &#8211; objItem.FreeSpace)\/1024\/1024\/1024))) \/ (FormatNumber((CDbl(objItem.Size)\/1024\/1024\/1024))) )*100,2) &#038; &#8220;%)&#8221; &#038; vbCrLf _<br \/>\n        &#038; &#8220;Total Size:&#8221; &#038; vbTab &#038; vbTab _<br \/>\n        &#038; FormatNumber((CDbl(objItem.Size)\/1024\/1024\/1024))<br \/>\n\t\t&#8216; &#038; objItem.Label FileSystem Name<br \/>\n   end if<br \/>\nNext\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here is an example of a vbscript that will show you volume size info for C. It will display the following info: &#8211; Computer Name\/hostname&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,16],"tags":[171,170,173,168,169,167,172],"class_list":["post-473627","post","type-post","status-publish","format-standard","hentry","category-how_to","category-misc","tag-drive","tag-script","tag-size","tag-vb","tag-vbs","tag-vbscript","tag-volume"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/posts\/473627"}],"collection":[{"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/comments?post=473627"}],"version-history":[{"count":2,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/posts\/473627\/revisions"}],"predecessor-version":[{"id":671886,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/posts\/473627\/revisions\/671886"}],"wp:attachment":[{"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/media?parent=473627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/categories?post=473627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mkncreations.com\/site\/wp-json\/wp\/v2\/tags?post=473627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}