Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

server checking script to save time

12 views
Skip to first unread message

Rich

unread,
Jun 11, 2008, 8:58:01 PM6/11/08
to
Hi scripting geniuses. I'm looking for a script that i could just
double-click that would save me a TON of time every day. I have a list of
servers that i need the following info for for each drive letter on each
server: free disk space, % free disk space (free disk space/total disk
space). I also have a flaky Microsoft Server 2003 cluster which i would LOVE
if the script could also tell me which cluster resource groups are on which
node. This would tell me if something went bump in the night and i need to
look into it. any and all help is appreciated, maybe i could even start
leaving work on time if this script saves me time, haha.

Tom Lavedas

unread,
Jun 12, 2008, 9:41:08 AM6/12/08
to

Here is an example for the first part of your question . It is pasted
together from an MS Technet Script Center example and the approach I
often use to read a text file ...

-------------------------8<-----------------------
Const HARD_DISK = 3

bLog = False ' Display - change to True to log to a file
sServersFile = "Servers.txt"
sLogname = "Servers.log"

s = Now() & vbNewLine
with CreateObject("Scripting.FileSystemObject")
with .OpenTextFile(sServerFile, 1)
arrServers = Split(.ReadAll, vbNewline)
end with ' server names

for each strComputer in arrServers
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = " _
& HARD_DISK & "")
s = s & strComputer & vbCRLF
For Each objDisk in colDisks
with objDisk
s = s & "DeviceID:"& vbTab & .DeviceID & vbCRLF
s = s & "Free Space:" & vbTab _
& Round(.FreeSpace / (1024^3), 1) & " GB" & vbCRLF
s = s & "Percent Free:" & vbTab _
& Round(100 * .FreeSpace / .Size, 1) & vbCRLF
end with ' objDisk
s = s & vbCRLF
Next ' objDisk
next ' strComputer
if bLog then
.OpenTextFile(sLogName, 8).write s
else
wsh.echo s
end if
end with ' FSO
-------------------------8<-----------------------

The same Technet sampler has this example for gathering cluster node
information ...

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root
\mscluster")

Set colItems = objWMIService.ExecQuery("Select * from MSCluster_Node")

For Each objItem in colItems
Wscript.Echo "Build number: " & objItem.BuildNumber
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "Characteristics: " & objItem.Characteristics
Wscript.Echo "Dedicated: " & objItem.Dedicated
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Identifying descriptions: " &
objItem.IdentifyingDescriptions
Wscript.Echo "Name: " & objItem.Name
' parameter list abridged
Wscript.Echo "State: " & objItem.State
Wscript.Echo "Status: " & objItem.Status
Wscript.Echo
Next

This example is intended for use at the command prompt under the
cscript.exe host. I don't know which parameters you require to do
your job or if this fulfills all of your needs.

Look up the Script Center's downloadable samples for the rest of the
parameters and other examples ...

TechNet Script Center Sample Scripts (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a

I also referenced the Scriptomatic HTA tool for information to finish
the first example above. It is available here:

Scriptomatic 2.0
http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Dominic Johnson

unread,
Jun 12, 2008, 10:45:47 AM6/12/08
to
There is an example of checking which cluster node the active
resources are running on in this previous thread:

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/browse_thread/thread/fd826a8a9b2b17f0/d1600d25ab90263d?hl=en#d1600d25ab90263d

Dominic

Francisco Mty

unread,
Jun 17, 2008, 1:12:28 PM6/17/08
to
On 12 jun, 08:41, Tom Lavedas <tglba...@cox.net> wrote:
> On Jun 11, 8:58 pm, Rich <R...@discussions.microsoft.com> wrote:
>
> > Hi scripting geniuses.  I'm looking for ascriptthat i could just

> > double-click that would save me a TON of time every day.  I have a list of
> > servers that i need the following info for for each drive letter on each
> > server: free disk space, % free disk space (free disk space/total disk
> > space).  I also have a flaky Microsoft Server 2003 cluster which i would LOVE
> > if thescriptcould also tell me which cluster resource groups are on which

> > node.  This would tell me if something went bump in the night and i need to
> > look into it.  any and all help is appreciated, maybe i could even start
> > leaving work on time if thisscriptsaves me time, haha.

>
> Here is an example for the first part of your question .  It is pasted
> together from an MS TechnetScriptCenter example and the approach I

> often use to read a text file ...
>


when you work with a cluster service you can determine where is the
resources using the property ".isready" of the disc. If the result is
true then you know what node take the resources in determinate
instant. You can send a email when the result not is that you hold.


reggards

0 new messages