Solved

Disk Quota With ASP

Posted on 2004-09-13
18
470 Views
Last Modified: 2008-01-09
Hi,

To cut a long story short, I need an ASP page to give me the space/quota for a mapped network drive. So far I have this (i'm no expert):

<%

Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set hdrv = fsoObject.GetDrive (fsoObject.GetDriveName("H:\"))
TotalQuata = FormatNumber(hdrv.TotalSize / 1024000,0)
FreeQuota = FormatNumber(hdrv.Freespace / 1024000,0)
Response.Write(TotalQuota)
Response.Write(FreeQuota)

%>

This works fine for a local drive (i.e. C) but when I try to change it to H (our mapped home drive letter), it gives this error:

Microsoft VBScript runtime error '800a0044'

Device unavailable

Is there something really easy i'm missing, or is it not possible to do this with an ASP page???

Thanks! ;-)
0
Comment
Question by:w00tastic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +3
18 Comments
 
LVL 13

Expert Comment

by:davidlars99
ID: 12050059
"H:" is a network drive right...? then you need to do this

Set WshNetwork = server.CreateObject("WScript.Network")
set NetDrive=WshNetwork.MapNetworkDrive("H:\", "\\Server\Share" )   'second parameter is optional

but I don't think you can get size of the network drive.




0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12050072
try this too...

dim fs,d,s
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("H:")
s=d.totalsize
0
 

Author Comment

by:w00tastic
ID: 12050151
davidlars99,

Point 1: Wouldn't that be to map a network drive?, if so, the drive is already mapped at log on to \\studentserver\studentname$
Point 2: Same error as I was getting before.

Thanks anyway!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:travisjhall
ID: 12050423
You don't have the drive already mapped on the server, where the ASP is running. You only have it mapped on the client. Remember, ASP stands for Active SERVER Pages. Nothing on the client computer matters when running ASP code.
0
 

Author Comment

by:w00tastic
ID: 12050520
You're right, I guess my head isn't screwed on straight today.
I thought it was working, but the C drive on the server just happens to be around the same size as on my machine here, and that's the size I was getting.

Okay, now what?

Is there some other way of doing this or not?

I want to put a number of things into a web page on the desktop that is mandatory on  all student profiles here, including how much space they have left in their H drive.

Thanks!
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12050877
did you try this?

dim fs,d,s
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("H:")
s=d.totalsize
0
 

Author Comment

by:w00tastic
ID: 12051463
Yeah, I did.
It works much the same as mine, gets the drive values from the server that the page is run from, rather than the client machine.

Any other ideas would be appreciated guys.

Thanks!
0
 
LVL 2

Expert Comment

by:benbalbo
ID: 12053761
How about running IIS on studentserver with a page that returns the quota info (which it can read) in XML, or other format, to the ASP page on your main web server.

Maybe a bit overkill though :-)
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 12058271
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12059044
wow..! isn't that cool or what. I tryied WMI on XP and sadly it did not work
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12059089
it's only supperted on NT platform
0
 
LVL 2

Expert Comment

by:kmalhotra
ID: 12059669
I do not know how familiar you are with ActiveX. That would be perfect for this job. Ofcourse then it will work only with IE. You need to check something on the client's machine. ASP can not allow you to do that. Need something on the client's machine. Then you can have your ASP page interactign with the Activex page.

LEt me know if you need help with this.

Thanks
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 12060517
0
 

Author Comment

by:w00tastic
ID: 12070522
Thanks for all the suggestions guys, i'll look into them.
Now i'm thinking a bit clearer, i've decided my way of tackling this problem wasn't quite right.
What I need to do is extract data directly from the quota entries on the student server, which just happens to be running IIS.

Any idea's on this one?

I've seen a few bits of code about, and even some stuff on Experts Exchange..... but nothing that really suits what I want.
0
 

Author Comment

by:w00tastic
ID: 12070553
By the way, it's Server 2003 running IIS 6.0 and we only use Internet Explorer here.
0
 
LVL 2

Expert Comment

by:kmalhotra
ID: 12074961
You can have a webservice running on the student server such that when you pass it a student id, it will return the size of the student's directory on the server. You will need to create a server objects to read files/folder and get their size.

Thanks
KM
0
 
LVL 15

Accepted Solution

by:
joeposter649 earned 250 total points
ID: 12075680
Not quite sure what you're looking for.  Maybe this...

Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1")
colDiskQuotas.UsernameResolution = 1
colDiskQuotas.Initialize "C:\", True

For Each objUser in colDiskQuotas
    response.Write objUser.LogonName & "<br>"
    response.Write objUser.QuotaLimit & "<br>"
    response.Write objUser.QuotaThreshold & "<br>"
    response.Write objUser.QuotaUsed & "<br>"
Next

Or this...

      Set oUser = GetObject("WinNT://yourdomain/username")
      Response.Write oUser.MaxStorage & "<br>"
0
 

Author Comment

by:w00tastic
ID: 12090724
Yep, that's it!!!
Well done, you have saved me.
Points well earned ;-)
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Grunt script for Build Process 1 63
Create an automated page index 9 78
Domain Service Not Responding 14 36
Web Easy Professional 10 Embedded Facebook 1 39
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question