C drive name

Tech-Archive recommends: Fix windows errors by optimizing your registry



Im trying to simply get the drive name of the C drive. Nothing else.

Unfortunetely all the scripts I see and play with want to look at all
the drive letters A C D E etc and give me names if there is one.

How can I just get the C drive name.

I have the following script which is nice. But cant narrow it down
just to the C drive.
'--------------------------------------------------------------------------------------
' LogicalDisk.vbs
' Sample VBScript to interrogate a Logical disk with WMI
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.8 - November 2005
' -------------------------------------------------------------'
Option Explicit
Dim objWMIService, objItem, colItems, strComputer

On Error Resume Next
strComputer = "."

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")

For Each objItem in colItems
Wscript.Echo "Computer: " & objItem.SystemName & VbCr & _
" ==================================" & VbCr & _
"Drive Letter: " & objItem.Name & vbCr & _
"Description: " & objItem.Description & vbCr & _
"Volume Name: " & objItem.VolumeName & vbCr & _
"Drive Type: " & objItem.DriveType & vbCr & _
"Media Type: " & objItem.MediaType & vbCr & _
"VolumeSerialNumber: " & objItem.VolumeSerialNumber & vbCr & _
"Size: " & Int(objItem.Size /1073741824) & " GB" & vbCr & _
"Free Space: " & Int(objItem.FreeSpace /1073741824) & _
" GB" & vbCr & _
"Quotas Disabled: " & objItem.QuotasDisabled & vbCr & _
"Supports DiskQuotas: " & objItem.SupportsDiskQuotas & vbCr & _
"Supports FileBasedCompression: " & _
objItem.SupportsFileBasedCompression & vbCr & _
"Compressed: " & objItem.Compressed & vbCr & _
""
Next

WSCript.Quit
.



Relevant Pages

  • What do i need to change in this script to make it detect my DNS r
    ... Set objWMIService = GetObject("winmgmts:" _ ... For Each objItem in colItems ...
    (microsoft.public.windows.server.scripting)
  • Scripting Printers
    ... I have a couple of scripts from Script Center ... that add a printer, add a port, list port properties and list printer ... The only problem is that NT only supports the List printer ... Set objWMIService = GetObject("winmgmts:" _ ...
    (microsoft.public.scripting.vbscript)
  • Re: Scripting Groups
    ... sections from two scripts together, my overall aim is to have the ... ' Constants required for name translate ... ' from the NETBIOS name of the computer (strcomputer) ... ' and the NETBIOS name of the domain using ...
    (microsoft.public.scripting.vbscript)
  • Re: Monitoring the growth of a file
    ... I found some scripts and merged as a result: ... strComputer = "computername" ... I would suggest you use the GetFileSize function in the Windows API: ... Or perhaps better use the last modification time for the file using the ...
    (microsoft.public.windowsxp.basics)
  • Look over this script.....could anything be done better?
    ... I am learning VBScripting and have several scripts. ... We are running these scripts in production environments. ... Dim objWMIService, colFixedDrives, objFD ... Dim strComputer ...
    (microsoft.public.scripting.vbscript)