Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Scripts If you need or have any scripts then get 'em here.

Go Back   EduGeek.net Forums > Coding and Web Development > Scripts
Reply
 
LinkBack Thread Tools Search Thread
Sponsored Links
Old 03-09-2008, 04:14 PM   #1
 
strawberry's Avatar
 
Join Date: Mar 2007
Posts: 807
uk
Thanks: 25
Thanked 43 Times in 43 Posts
Rep Power: 13 strawberry has a spectacular aura aboutstrawberry has a spectacular aura aboutstrawberry has a spectacular aura about
Default vbs overflow error

following script gives an overflow error, help!
---------------
On Error Resume Next
strComputer = "10.0.0.3"
MailServer="10.0.0.5"
Dim emailaddy
Dim holder
dim diskspace1
dim diskspace2
dim a
dim b
dim c
Dim objWMI : Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

strDrive = "Win32_LogicalDisk.DeviceID=" & chr(34) & "D:" & chr(34)

Set colQuotas = objWMI.ExecQuery ("Select * from Win32_DiskQuota Where QuotaVolume = '" & strDrive & "'")

For Each objQuota in colQuotas

If objQuota.Status=2 Then

diskspace1 = objQuota.DiskSpaceUsed\1000000

diskspace2 = objQuota.Limit\1000000

a = objQuota.DiskSpaceUsed
b = objQuota.Limit
c = (a - b) \1000000


holder = objQuota.User
holder = right(holder,len(holder)-40)
holder = left(holder,len(holder)-1)


Wscript.Echo " Mailing : " & emailaddy
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "you have reached your Quota limit."
????: EduGeek.net Forums http://www.edugeek.net/forums/scripts/23367-vbs-overflow-error.html
objMessage.From = "Quotacheck@***.co.uk"
objMessage.To = "*****"
objMessage.TextBody = "Hello, You have used all the diskspace afforded to your by your quota. Please consider removing some of the files you have placed on the network."



'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.0.0.5"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

else
END IF
Next
  Reply With Quote
Old 03-09-2008, 05:44 PM   #2
 
powdarrmonkey's Avatar
 
Join Date: Feb 2008
Location: Alcester, Warwickshire
Posts: 2,583
uk
Thanks: 136
Thanked 305 Times in 261 Posts
Rep Power: 66 powdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant future
Default

On which line does it overflow?
  Reply With Quote
Old 03-09-2008, 05:49 PM   #3
 
SYNACK's Avatar
 
Join Date: Oct 2007
Location: Auckland, New Zealand
Posts: 2,730
new zealand
Thanks: 115
Thanked 614 Times in 501 Posts
Blog Entries: 4
Rep Power: 127 SYNACK ooh
SYNACK oohSYNACK oohSYNACK oohSYNACK oohSYNACK oohSYNACK ooh
Send a message via MSN to SYNACK
Default

Have you made sure that none of the variables are ending up as zero?
Overflow when trying to divide - ASP Free
  Reply With Quote
The Following User Says Thank You to SYNACK For This Useful Post:
strawberry (04-09-2008)
Old 03-09-2008, 06:33 PM   #4
 
strawberry's Avatar
 
Join Date: Mar 2007
Posts: 807
uk
Thanks: 25
Thanked 43 Times in 43 Posts
Rep Power: 13 strawberry has a spectacular aura aboutstrawberry has a spectacular aura aboutstrawberry has a spectacular aura about
Default

Quote:
Originally Posted by powdarrmonkey View Post
On which line does it overflow?
fairly sure its this one...

diskspace1 = objQuota.DiskSpaceUsed\1000000

it gives a huge number when it does, so i wonder if i need to declare the variable in a different way.
  Reply With Quote
Old 03-09-2008, 09:04 PM   #5
 
powdarrmonkey's Avatar
 
Join Date: Feb 2008
Location: Alcester, Warwickshire
Posts: 2,583
uk
Thanks: 136
Thanked 305 Times in 261 Posts
Rep Power: 66 powdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant future
Default

You probably want a double-precision variable, not a single, but I don't know how to declare one in VB. In C it is just type double.
  Reply With Quote
Old 04-09-2008, 10:31 AM   #6
 
strawberry's Avatar
 
Join Date: Mar 2007
Posts: 807
uk
Thanks: 25
Thanked 43 Times in 43 Posts
Rep Power: 13 strawberry has a spectacular aura aboutstrawberry has a spectacular aura aboutstrawberry has a spectacular aura about
Default

found it, the / should have been \ . so it was returning zero
  Reply With Quote
Reply
Similar Threads
Thread Thread Starter Forum Replies Last Post
VBS in Webpage help DSapseid Scripts 1 04-07-2008 11:53 PM
.vbs .bat error in sysvol alonebfg Windows 7 16-07-2007 07:57 PM
Would like to learn VBS bishopsgarthstockton Web Development 11 12-07-2007 07:44 AM
ResetAccountsAdminSDHolder.vbs meastaugh1 Scripts 1 05-02-2007 11:52 AM
VBS Tutorial Nij.UK Coding 15 25-11-2006 12:01 AM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:31 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright EduGeek.net




website uptime

© 2005 - 2009 EduGeek.net
no new posts