Friday, April 24, 2009

List all drivers (Client Machine)

<HTML>
<HEAD>
<SCRIPT language=JavaScript>

//This function returns the drive list from client system

function getDriveList() {

var objfs, s, n, e, x;

objfs = new ActiveXObject("Scripting.FileSystemObject");

e = new Enumerator(objfs.Drives);

s = "";

do {

x = e.item();

s = s + x.DriveLetter;

s += ": ";

if (x.DriveType == 3) n = x.ShareName;

else if (x.IsReady) n = x.VolumeName;

else n = "<font color=red>[Other Drive-not intialized]</font>";

s += n + "<br>";

e.moveNext();

} while (!e.atEnd());

return (s);

}

</SCRIPT>
</HEAD>
<BODY>
<h5>Available drives on Client system:</h5>
<SCRIPT language=JavaScript> document.write(getDriveList());</SCRIPT>
</BODY>
</HTML>
It Works in IE Only.

No comments: