Home All Groups Group Topic Archive Search About


Author
1 Mar 2007 9:24 PM
TEA
Hello all,

We are running Windows 2003 Servers and XP Professional Desktops.  We also
have several 2000 Servers.  I have 2003 Administrative Tools running on my
desktop....not that it helps me much.  I've been looking into Perl, but the
customization of how to make it work for this site perplexes me.  I really
need to be led by the hand.....classes are out of the question.  I've read
that WMI may also work.

Is there possibly a program which will go out out and grab this data perhaps?

I'm a scripting virgin and have been asked to create a weekly report that
lists the following:

1 - Server Name
2 - Drive Letter
3 - Total Disc size of each partition (C,D,E,F etc)
4 - Used GB Space
4 - Used %
4 - Free GB Space
4 - Free %


Thanks in anticipation of your help,
TEA

Author
3 Mar 2007 9:40 AM
urkec
arrServers = Array ("server1", "server2", "server3")
localDisk = 3
GB = 1024 * 1024 * 1024

For Each server in arrServers

Set objWMIService = GetObject _
   ("winmgmts:\\" & server & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
   ("Select * from Win32_LogicalDisk where " & _
   "DriveType=" & localDisk,,48)

Wscript.Echo "Server name: " & _
server & vbCrLf

For Each objItem in colItems

size = objItem.Size / GB
free = objItem.FreeSpace / GB
used = size - free
usedPerc = (used * 100) / size
freePerc = 100 - usedPerc

Wscript.Echo "Name:   " & objItem.Name
Wscript.Echo "Size:   " & FormatNumber (size, 2)
Wscript.Echo "Used:   " & FormatNumber (used, 2)
Wscript.Echo "Used %: " & FormatNumber (usedPerc, 2)
Wscript.Echo "Free:   " & FormatNumber (free, 2)
Wscript.Echo "Free %: " & FormatNumber (freePerc, 2)
Wscript.Echo

Next

Next
--
urkec


Show quote
"TEA" wrote:

> Hello all,
>
> We are running Windows 2003 Servers and XP Professional Desktops.  We also
> have several 2000 Servers.  I have 2003 Administrative Tools running on my
> desktop....not that it helps me much.  I've been looking into Perl, but the
> customization of how to make it work for this site perplexes me.  I really
> need to be led by the hand.....classes are out of the question.  I've read
> that WMI may also work.
>
> Is there possibly a program which will go out out and grab this data perhaps?
>
> I'm a scripting virgin and have been asked to create a weekly report that
> lists the following:
>
> 1 - Server Name
> 2 - Drive Letter
> 3 - Total Disc size of each partition (C,D,E,F etc)
> 4 - Used GB Space
> 4 - Used %
> 4 - Free GB Space
> 4 - Free %
>
>
> Thanks in anticipation of your help,
> TEA
>
Author
5 Mar 2007 5:55 PM
TEA
Thanks.  Now what do I do with it? As I stated I'm VERY NEW to Scripting. 
What programs do I need to run this? Sorry to be such a pain.

Show quote
"urkec" wrote:

> arrServers = Array ("server1", "server2", "server3")
> localDisk = 3
> GB = 1024 * 1024 * 1024
>
> For Each server in arrServers
>  
> Set objWMIService = GetObject _
>    ("winmgmts:\\" & server & "\root\cimv2")
>   
> Set colItems = objWMIService.ExecQuery _
>    ("Select * from Win32_LogicalDisk where " & _
>    "DriveType=" & localDisk,,48)
>
> Wscript.Echo "Server name: " & _
> server & vbCrLf
>   
> For Each objItem in colItems
>
> size = objItem.Size / GB
> free = objItem.FreeSpace / GB
> used = size - free
> usedPerc = (used * 100) / size
> freePerc = 100 - usedPerc
>
> Wscript.Echo "Name:   " & objItem.Name
> Wscript.Echo "Size:   " & FormatNumber (size, 2)
> Wscript.Echo "Used:   " & FormatNumber (used, 2)
> Wscript.Echo "Used %: " & FormatNumber (usedPerc, 2)
> Wscript.Echo "Free:   " & FormatNumber (free, 2)
> Wscript.Echo "Free %: " & FormatNumber (freePerc, 2)
> Wscript.Echo
>    
> Next
>
> Next
> --
> urkec
>
>
> "TEA" wrote:
>
> > Hello all,
> >
> > We are running Windows 2003 Servers and XP Professional Desktops.  We also
> > have several 2000 Servers.  I have 2003 Administrative Tools running on my
> > desktop....not that it helps me much.  I've been looking into Perl, but the
> > customization of how to make it work for this site perplexes me.  I really
> > need to be led by the hand.....classes are out of the question.  I've read
> > that WMI may also work.
> >
> > Is there possibly a program which will go out out and grab this data perhaps?
> >
> > I'm a scripting virgin and have been asked to create a weekly report that
> > lists the following:
> >
> > 1 - Server Name
> > 2 - Drive Letter
> > 3 - Total Disc size of each partition (C,D,E,F etc)
> > 4 - Used GB Space
> > 4 - Used %
> > 4 - Free GB Space
> > 4 - Free %
> >
> >
> > Thanks in anticipation of your help,
> > TEA
> >
Author
5 Mar 2007 6:48 PM
urkec
Copy it to notepad
Save it (Save As...) with .vbs  extension (myScript.vbs)
Run it from cmd prompt using cscript (Cscript myscript.vbs)

You can test it on a local computer by changing

arrServers = Array ("server1", "server2", "server3")

to

arrServers = Array (".")

--
urkec


Show quote
"TEA" wrote:

> Thanks.  Now what do I do with it? As I stated I'm VERY NEW to Scripting. 
> What programs do I need to run this? Sorry to be such a pain.
Author
5 Mar 2007 8:22 PM
TEA
The name of servers on the domain are for example <DANUTIL10>.  Am I suppose
to customize the script some kind of way to reflect this? Thanks.  Also, when
I tried to run this from my local machine as you suggested I got a
compilation error message :expected statement

Show quote
"urkec" wrote:

> Copy it to notepad
> Save it (Save As...) with .vbs  extension (myScript.vbs)
> Run it from cmd prompt using cscript (Cscript myscript.vbs)
>
> You can test it on a local computer by changing
>
> arrServers = Array ("server1", "server2", "server3")
>
> to
>
> arrServers = Array (".")
>
> --
> urkec
>
>
> "TEA" wrote:
>
> > Thanks.  Now what do I do with it? As I stated I'm VERY NEW to Scripting. 
> > What programs do I need to run this? Sorry to be such a pain.
Author
6 Mar 2007 3:00 PM
urkec
"TEA" wrote:

> The name of servers on the domain are for example <DANUTIL10>.  Am I suppose
> to customize the script some kind of way to reflect this?

You have to change this line

arrServers = Array ("server1", "server2", "server3")

>Also, when
> I tried to run this from my local machine as you suggested I got a
> compilation error message :expected statement

On which line?
Author
6 Mar 2007 4:03 PM
TEA
When you say I need to change this line, is it suppose to look like this?
arrServers = Array ("DANUTIL10", "DANUTIL11", "DANUTIL12") or
arrServers = Array ("\\DANUTIL10", "\\DANUTIL11", "\\DANUTIL12")
arrServers = Array ("server1", "server2", "server3")

Show quote
"urkec" wrote:

> "TEA" wrote:
>
> > The name of servers on the domain are for example <DANUTIL10>.  Am I suppose
> > to customize the script some kind of way to reflect this?
>
> You have to change this line
>
> arrServers = Array ("server1", "server2", "server3")
>
> >Also, when
> > I tried to run this from my local machine as you suggested I got a
> > compilation error message :expected statement
>
> On which line?
Author
6 Mar 2007 4:13 PM
TEA
EUREKA!!!!!!!! Thanks it ran.  Now how do I extract the information to a text
file, spreadsheet or basically out of the command screen?

Show quote
"urkec" wrote:

> "TEA" wrote:
>
> > The name of servers on the domain are for example <DANUTIL10>.  Am I suppose
> > to customize the script some kind of way to reflect this?
>
> You have to change this line
>
> arrServers = Array ("server1", "server2", "server3")
>
> >Also, when
> > I tried to run this from my local machine as you suggested I got a
> > compilation error message :expected statement
>
> On which line?
Author
6 Mar 2007 5:01 PM
urkec
Set objFSO = CreateObject _
    ("Scripting.FileSystemObject")
Set logFile = objFSO.OpenTextFile _
    ("C:\diskStats.txt", 2, True)

arrServers = Array ("server1", "server2", "server3")
localDisk = 3
GB = 1024 * 1024 * 1024

For Each server in arrServers

Set objWMIService = GetObject _
   ("winmgmts:\\" & server & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
   ("Select * from Win32_LogicalDisk where " & _
   "DriveType=" & localDisk,,48)

logFile.WriteLine "Server name: " & _
server & vbCrLf

For Each objItem in colItems

size = objItem.Size / GB
free = objItem.FreeSpace / GB
used = size - free
usedPerc = (used * 100) / size
freePerc = 100 - usedPerc

logFile.WriteLine "Name:   " & objItem.Name
logFile.WriteLine "Size:   " & FormatNumber (size, 2)
logFile.WriteLine "Used:   " & FormatNumber (used, 2)
logFile.WriteLine "Used %: " & FormatNumber (usedPerc, 2)
logFile.WriteLine "Free:   " & FormatNumber (free, 2)
logFile.WriteLine "Free %: " & FormatNumber (freePerc, 2)
logFile.WriteLine

Next

Next

logFile.Close
WScript.Echo "Done"

--
urkec


Show quote
"TEA" wrote:

> EUREKA!!!!!!!! Thanks it ran.  Now how do I extract the information to a text
> file, spreadsheet or basically out of the command screen?
Author
6 Mar 2007 6:12 PM
TEA
Thank you.  You have been most helpful, and I appreciate it VERY much.

Show quote
"urkec" wrote:

> Set objFSO = CreateObject _
>     ("Scripting.FileSystemObject")
> Set logFile = objFSO.OpenTextFile _
>     ("C:\diskStats.txt", 2, True)
>
> arrServers = Array ("server1", "server2", "server3")
> localDisk = 3
> GB = 1024 * 1024 * 1024
>
> For Each server in arrServers
>  
> Set objWMIService = GetObject _
>    ("winmgmts:\\" & server & "\root\cimv2")
>   
> Set colItems = objWMIService.ExecQuery _
>    ("Select * from Win32_LogicalDisk where " & _
>    "DriveType=" & localDisk,,48)
>
> logFile.WriteLine "Server name: " & _
> server & vbCrLf
>   
> For Each objItem in colItems
>
> size = objItem.Size / GB
> free = objItem.FreeSpace / GB
> used = size - free
> usedPerc = (used * 100) / size
> freePerc = 100 - usedPerc
>
> logFile.WriteLine "Name:   " & objItem.Name
> logFile.WriteLine "Size:   " & FormatNumber (size, 2)
> logFile.WriteLine "Used:   " & FormatNumber (used, 2)
> logFile.WriteLine "Used %: " & FormatNumber (usedPerc, 2)
> logFile.WriteLine "Free:   " & FormatNumber (free, 2)
> logFile.WriteLine "Free %: " & FormatNumber (freePerc, 2)
> logFile.WriteLine
>    
> Next
>
> Next
>
> logFile.Close
> WScript.Echo "Done"
>
> --
> urkec
>
>
> "TEA" wrote:
>
> > EUREKA!!!!!!!! Thanks it ran.  Now how do I extract the information to a text
> > file, spreadsheet or basically out of the command screen?
>
Author
17 Apr 2007 4:57 PM
peri.baptista
What about premissioning across domains? I keep getting accessed
denied.

Any Ideas?

Regards,
Peri.

AddThis Social Bookmark Button