Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - View Hard Drive Properties
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

View Hard Drive Properties

 Post Reply Post Reply
Author
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Topic: View Hard Drive Properties
    Posted: 03 October 2003 at 7:01am
Anyone know how to view the properties of a hard drive remotely?
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2003 at 7:21am
If you want to know capacity and what's on it you can use FSO but ig you want to see wether it's a Maxtor or Seagate and Cylinders and Heads and stuff I do not think it is possible without a component, unless you use the WMI Provider withing a WSH script or so, that should work. If you were using ASP.Net you could use WSI to get System Properties.
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2003 at 7:30am

I have this script, and it gives a Server.CreateObject Failed error for the A: drive. Is that because there's not floppy in the drive?

<%@ LANGUAGE = "VBSCRIPT" %>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
 <meta http-equiv="Content-Language" content="bg">
 <title>Show all available drives on local computer.</title>
</head>
<body>
<table border="1" cellpadding="0" width="475" cellspacing="0">
<%
 Dim mfObject
 Dim show
 
 ' Check if drive(s) is ready if ready you can list directory on next page
 Sub ch_Drive ( dr_Name )
  If show.IsReady = True Then
   Response.write "<a href='sh_drive.asp?nDrive=" & show.RootFolder & "&Type="& show.DriveType &"'>" & show.DriveLetter & dr_Name & "</a>"
  Else
   Response.write show.DriveLetter & dr_Name
  End If
 End Sub
 
 ' set file Object
 Set mfObject=Server.CreateObject("Scripting.FileSystemObject")
%>
  <tr>
  <td width="51" valign="middle" align="center" height="27" bgcolor="#FF0000"><font face="Verdana" size="2" color="#FFFFFF"><b>Type</b></font></ td>
  <td width="133" valign="middle" align="center" height="27" bgcolor="#FF0000"><font face="Verdana" size="2" color="#FFFFFF"><b>Name</b></font></ td>
    <td width="131" valign="middle" align="center" height="27" bgcolor="#FF0000"><b><font face="Verdana" color="#FFFFFF" size="1">Total size in bytes</font></b></td>
    <td width="142" valign="middle" align="center" height="27" bgcolor="#FF0000"><b><font face="Verdana" color="#FFFFFF" size="1">Free Space in bytes</font></b></td>
   </tr>
<%
 ' Display all available drives in you local computer
 FOR EACH show in mfObject.Drives
%>
  <tr>
    <td valign="middle" align="center" width="51">
<%
 ' What type is your drive ?
 Select Case show.DriveType
  Case 1
   Response.write "<img border='0' src='images/flopys.gif'>"
  Case 2
   Response.write "<img border='0' src='images/disks.gif'>"
  Case 4
   Response.write "<img border='0' src='images/cdroms.gif'>"
 End Select
%>
  </td>
  <td valign="middle" width="133"><font face="Verdana" size="1" color="#000000">
<%
 Select Case show.DriveType
  Case 1
   Call ch_Drive ( ":> Floppy Disk" )
  Case 2
   Call ch_Drive ( ":> Local Disk" )
  Case 4
   Call ch_Drive ( ":> Compact Disk" )
  End Select
%>
  </font></td>
  <td valign="middle" width="131" align="center"><font face="Verdana" size="1" color="#000000">
<%
 ' max size in bytes
  on error resume next
  Response.write show.TotalSize
  Call err_Describe ( 71 )
%>
  </font></td>
  <td valign="middle" width="142" align="center"><font face="Verdana" size="1" color="#000000">
<%
 ' max available size in bytes
 on error resume next
 Response.write show.AvailableSpace
 Call err_Describe ( 71 )
%>
  </font></td>
 </tr>
<% Next %>
</table>
<%
 ' Catch error number
 Sub err_Describe ( er_number )
  If err.number = er_number Then
   Response.write "<b><font face='Verdana' size='1' color='#FF0000'>"
   Response.write err.description
   Response.write "</b></font>"
  End If
 End Sub
%>
</body>
</html>

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2003 at 10:00am

Here's my finished code in case anyone has a use for it:

<%@ LANGUAGE = "VBSCRIPT" %>
<% Option Explicit %>
<%
    Dim fso, connectedDrives, drv
    Dim strInfo, driveName
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    Set connectedDrives = fso.drives
    On Error Resume Next
%>
<HTML>
<HEAD>
 <TITLE>Drive Information</TITLE>
</HEAD>
<BODY>
<TABLE CELLPADDING="3" CELLSPACING="1" style="border: solid 1px #000000; font-family: Arial; font-size: 10pt;">
 <TR BGCOLOR="F5F5F5" style="font-weight: bold;">
  <TD style="border: solid 1px #000000;">Drive Letter</TD>
  <TD style="border: solid 1px #000000;">Drive Type</TD>
  <TD style="border: solid 1px #000000;">File System</TD>
  <TD style="border: solid 1px #000000;">Serial Number</TD>
  <TD style="border: solid 1px #000000;">Name</TD>
  <TD style="border: solid 1px #000000;">Available Space</TD>
  <TD style="border: solid 1px #000000;">Total Size</TD>
  <TD style="border: solid 1px #000000;">Ready/Not Ready</TD>
 </TR>
<%
 For Each drv In connectedDrives
%>
 <TR>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.DriveLetter%>:&nbsp;</TD> ;
  <TD style="border: solid 1px #F5F5F5;"><%=drv.DriveType%>&nbsp;</TD>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.FileSystem%>&nbsp;</TD>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.SerialNumber%>&nbsp;</TD> ;
<% If drv.DriveType = 3 Then %>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.ShareName%>&nbsp;</TD>
<% Else %>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.VolumeName%>&nbsp;</TD>
<% End If %>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.AvailableSpace%>&nbsp;</TD& gt;
<% If drv.IsReady Then %>
  <TD style="border: solid 1px #F5F5F5;"><%=drv.TotalSize%>&nbsp;</TD>
  <TD style="border: solid 1px #F5F5F5;">Ready</TD>
<% Else %>
  <TD style="border: solid 1px #F5F5F5;">&nbsp;</TD>
  <TD style="border: solid 1px #F5F5F5;">Not Ready</TD>
<% End If %>
 </TR>
<% Next %>
</TABLE>
<BR>
<TABLE CELLPADDING="1" CELLSPACING="1" style="border: solid 1px #000000; font-family: Arial; font-size: 10pt;">
 <TR>
  <TD style="font-weight: bold;">Drive Letter: </TD>
  <TD>Returns the drive letter of the drive.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Drive Type: </TD>
  <TD>Returns the drive type, a numerical value, which can be 0 - Unknown,1 - Removable, 2 - Fixed, 3 - Network, 4 - CD-ROM, 5 - RAM Disk.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">File System: </TD>
  <TD>Returns the filesystem of the drive, e.g. NTFS,FAT32.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Serial Number: </TD>
  <TD>Returns the serial number of the drive.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Name: </TD>
  <TD>If the drive is shared on a network, this returns the shared-name of the drive.</TD>
 </TR>
 <TR>
  <TD></TD>
  <TD>If the drive hasn't been named and is called the default 'Local Disk' then this property returns an empty string.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Available Space: </TD>
  <TD>Returns available space left on drive.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Total Size:</TD>
  <TD>Returns the total size of the drive.</TD>
 </TR>
 <TR>
  <TD style="font-weight: bold;">Ready / Not Ready</TD>
  <TD>Returns whether the drive is ready. If the drive is removable such as a floppy drive returns true if there is a disk or media in the drive.</TD>
 </TR>
</TABLE>
</BODY>
</HTML>
<%
 Set connectedDrives = Nothing
 Set fso = Nothing
%>

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.