Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy Forums > > >

server side vbs script


(!)

valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
19-Sep-2012, 02:11 PM #1
server side vbs script
got a few oddities going on with some information being pulled overnight and not being dumped when it's supposed to be. Short story shorter, I am currently manually checking about 5 directories on the server side daily, and while it doesn't take that long, I reckon this is a great chance to learn more about scripts.

All directories are under a master directory, and all I want to do is check the size of them at 7 am CST, either daily, or m-f, and either have the output mailed to me or dumped into a .csv file.

The kicker is that, if possible, I'd also like all the sub-directories and their size listed as well. That, however, is not critical until I can winnow out main directory (out of the 5 or so) that is chewing up disk space.

Sounds simple, but my .vbs is rusted beyond recovery.

thanks,

v
__________________
Microsoft M.V.P. - Windows IT Professional | M.C.S.A. | M.C.P. - MS Server 2k3 | blog | rate me

"Ask Bill why the string in function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that". - Gary Kildall
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
19-Sep-2012, 09:23 PM #2
Hey Tim. Is there anything else in the master directory except the directories (and sub directories) you want stats on?

I would do a little bat for something like this that writes to a log and saves to a share (adding email adds another break point), schedule the task.

Let me know if you want to write it, or if you want me to write it.

If you really really want to do .vbs we can do that too.

Happy Wednesday.
__________________
Security +
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
20-Sep-2012, 07:47 AM #3
happy thursday back atcha.

Nope, just those directories and sub-directories. Goal is to find out what is writing 10ish gigs every Tuesday night, and it's in one of those 5 directories (actually I've got it narrowed down to 3, but that's beside the point).

How so a .bat file? Would that return the size of all subdirectories as well?
__________________
Microsoft M.V.P. - Windows IT Professional | M.C.S.A. | M.C.P. - MS Server 2k3 | blog | rate me

"Ask Bill why the string in function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that". - Gary Kildall
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
20-Sep-2012, 08:21 AM #4
Quote:
Originally Posted by valis View Post

How so a .bat file? Would that return the size of all subdirectories as well?
It will do exactly what you tell it to. You have to instruct it to go either top level or root down. Tell you what, give me a bit to catch up here and I'll give you a side by side (bat v .vbs).
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 4,876 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
20-Sep-2012, 08:23 AM #5
I'm all for practising scripting at every opportunity, but I'm a bit confused. How don't you know where the extra 10GB of data is? I mean, it's either there or it isn't, and if it's there you can see it.
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
20-Sep-2012, 08:23 AM #6
not a big hurry, Chris.......as I said, I can do it easily by hand, but wanted to learn how to script this stuff better.....next week is also totally okay, as I'm off tomorrow.
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
20-Sep-2012, 08:25 AM #7
Quote:
Originally Posted by Ent View Post
I'm all for practising scripting at every opportunity, but I'm a bit confused. How don't you know where the extra 10GB of data is? I mean, it's either there or it isn't, and if it's there you can see it.
something is writing an extra 10 gigs every tuesday night.......right now, I'm monitoring the main directories manually every morning, trying to find out where it's coming from.

When you are dealing with 20k files, it can get to be a bit difficult getting that granular manually.
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
20-Sep-2012, 08:27 AM #8
Quote:
Originally Posted by valis View Post
not a big hurry, Chris.......as I said, I can do it easily by hand, but wanted to learn how to script this stuff better.....next week is also totally okay, as I'm off tomorrow.
Perfect. I'll mess with it this weekend mon ami.
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
20-Sep-2012, 08:28 AM #9
roger that......thanks, man.
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
22-Sep-2012, 01:32 PM #10
Afternoon Tim. I found this one, didn't write it, but I do like it for your situation. I've tested it on my machine and connecting to a network. Works great. And, you can run it from your machine (no messiness on the server). Plus, because it writes to excel you can keep track of exact stats concerning your weird folder growth (and see trends).

Just put your path in where bold and go to town. For others that may not know, copy the code below into a text doc, save as .vbs. Double click to run.

Incidentally, I also tried it on my sharepoint instance and it worked well.

Code:
Dim oFS, oFolder
Dim objexcel, r, lnameArray, lname, nameLength
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder("\\TimPath\Valis\Here")

Set objExcel = createobject("Excel.application")   
objexcel.Workbooks.add
objexcel.Cells(1, 1).Value = "Folder Name"
objexcel.Cells(1, 2).Value = "Size (MB)"
objexcel.Cells(1, 3).Value = "# Files"
objexcel.Cells(1, 4).Value = "# Sub Folders"
objexcel.Visible = True
Wscript.Sleep 300
r=2


ShowFolderDetails oFolder, r

MsgBox "Done"    
    
Function ShowFolderDetails(oF,r)
    Dim F
    objexcel.Cells(r, 1).Value = oF.Name
    objexcel.Cells(r, 2).Value = oF.Size /1024\1024
    objexcel.Cells(r, 3).Value =  oF.Files.Count
    objexcel.Cells(r, 4).Value =  oF.Subfolders.count
    r = r+1
    for each F in oF.Subfolders
        ShowFolderDetails F, r
    next
End Function
__________________
Security +
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
24-Sep-2012, 08:14 AM #11
coolio....I'll give it a crack and let you know.......thanks, Chris.......

and sorry about Auburn. Had that game.
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
24-Sep-2012, 08:15 AM #12
Quote:
Originally Posted by valis View Post
coolio....I'll give it a crack and let you know.......thanks, Chris.......

and sorry about Auburn. Had that game.
Right on, I was going for 'least obtrusive, biggest gain'.

And yea, they played really well.
valis's Avatar
Computer Specs
Moderator with 57,580 posts.
THREAD STARTER
 
Join Date: Sep 2004
Location: as above
Experience: so below
24-Sep-2012, 08:24 AM #13
played great, and LSU stunk it up.......that would have be awesome.
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,975 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
24-Sep-2012, 08:28 AM #14
Quote:
Originally Posted by valis View Post
played great, and LSU stunk it up.......that would have be awesome.
Actually...LSU played hard. Auburn just played up. The first fumble was all LSU, I'll give you that.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




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


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑