Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Freespace on NT servers on NT domain

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1390
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Freespace on NT servers on NT domain
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Freespace on NT servers on NT domain - 9/23/2004 3:55:57 AM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
ANY HELP HELP WOULD BE APPRECATED
I have a requirement to find the free space on severs in an Nt domain
Where as it seems reasonable simple to get this info off mapped drives.
It seems to be impossible to get the info by trying to point to the domain controller
I have been at this for weeks and where my scripting has improved by leaps and bounds I am no closer to my original goal;
And having tried to log a call with Microsoft. But they suggest buying on of the books on how to script. so much for global corporate licences.
Firewall restrictions prevent MS Groups support
Compaq insight manager is also a no go as current versions 7.10 are web based and will not see the older servers and older 4& 5 will not see newer severs and Blades
I appreciate that for developers this might be a simple task. But as a non developer. its any thing but.
SO ANY HELP WOULD BE APPRECATED

Script so far





On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.Shell")

strLF = Chr(13)
Set oFileSys = CreateObject("Scripting.FileSystemObject")
For each drvLoop in oFileSys.Drives

msgText = msgText & drvLoop.DriveLetter & ":\ " & strLF _
& " Total size: " & FormatNumber(drvLoop.TotalSize / (1024 ^ 2),2) & " Mb" & strLF _
& " Free space: " & FormatNumber(drvLoop.FreeSpace / (1024 ^ 2),2) & " Mb" & strLF _
& " Volume Label: " & drvLoop.VolumeName & strLF

Next 'drvLoop
WshShell.popup msgText, ,"Drive Properties...",64
 
 
Post #: 1
 
 Re: Freespace on NT servers on NT domain - 9/23/2004 4:26:16 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Is WMI installed on the servers? Also, if you can reach google groups you can see the Microsoft newsgroups.

(in reply to christopher02)
 
 
Post #: 2
 
 Re: Freespace on NT servers on NT domain - 9/23/2004 8:54:45 PM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
yes wmi is installed on all nt 4 servers and yes i can see ms news groups but cannot regester on any of them.yahoo,googgle,ms any thing with an email service are all blocked.

(in reply to christopher02)
 
 
Post #: 3
 
 Re: Freespace on NT servers on NT domain - 9/23/2004 10:03:46 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Heh, kinda funny, check out this script that I posted to a thread started by Christopher01 called freespace on nt servers over an nt domain posted 9/16/2004

(in reply to christopher02)
 
 
Post #: 4
 
 Re: Freespace on NT servers on NT domain - 9/24/2004 2:36:36 AM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
lots of christophers around Hu

(in reply to christopher02)
 
 
Post #: 5
 
 Re: Freespace on NT servers on NT domain - 9/24/2004 2:49:46 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
That there are, named my youngest kid Christopher, should have named him Hurrican Christopher though.

(in reply to christopher02)
 
 
Post #: 6
 
 Re: Freespace on NT servers on NT domain - 9/24/2004 3:32:47 AM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
Thank you, for your input. I have checked out Christopher 01 string
Both 1& 2 achieve the same thing, my problem has not been getting free drive space from standalone, but from multiple servers in an Nt domain, as you see from my earlier attempts I can get this info from mapped drives .but the environment we have is in excess of 30 Nt servers. Maybe I am missing the point or something else
Seeking this info off 0s2, 2000, 20003 & Citrix servers across a domain is not a problem.
Its NT that seems to be a problem for me. So if you or anybody , can point me in the right direction it would be a great help. I am sure it just a ÓHomerÔ moment on my part and its been staring me in the face. but I just cannot get it.
Thank you again

(in reply to christopher02)
 
 
Post #: 7
 
 Re: Freespace on NT servers on NT domain - 9/24/2004 7:18:07 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
In the script in that thread you can change strComputer = "." to strComputer = "RemotePCName" and it would get the info from the remote PC, as log as it has WMI on it. Here is a script that I put together from other scripts that does just that. It will read computer names from a text file, must be in the same folder as the script, and give you an echo of the findings. start small as the msgbox would be large with a lot of PC's being scanned. You would probably want to write the results to a text file.

quote:
Const HARD_DISK = 3
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim WshNetwork : Set WshNetwork = CreateObject("Wscript.Network")
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")


Dim strFileName : strFileName = "computer.txt"
If Not Fso.FileExists(strFileName) then
strRet = Msgbox("The file, " & strFileName & " is not available" & vbCr _
& "The file must be located in the same folder as the script." & vbCR _
& "Please check for the file <<" & strFileName & ">> in the folder" & vbCR _
& "<<" & Fso.GetParentFolderName(Wscript.ScriptFullName) & ">>")
Wscript.Quit
End if

Set oFile = Fso.OpenTextFile(strFileName, 1)

Do Until oFile.AtEndOfStream
Redim Preserve strComputer(i)
strComputer(i) = oFile.ReadLine
On error Resume Next
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer(i) & "\root\cimv2")

If err.number <> 0 then
msg = msg & "Computer Name: " & strComputer(i) & vbcr & err.description & vbcr
Else
msg = msg & "Computer Name: " & strComputer(i) & vbcr
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
For each objDisk in colDisks
msg = msg & "DeviceID: " & vbTab & objDisk.DeviceID & vbcr
msg = msg & "Size: " & vbTab & vbTab & FormatNumber(objDisk.Size / (1024 ^ 2),2) & " Mb" & vbcr
msg = msg & "FreeSpace: " & vbTab & FormatNumber(objDisk.FreeSpace / (1024 ^ 2),2) & " Mb" & vbcr & vbcr


Next
End If
Loop

wscript.echo msg

(in reply to christopher02)
 
 
Post #: 8
 
 Re: Freespace on NT servers on NT domain - 9/24/2004 6:30:06 PM   
  efb

 

Posts: 1
Score: 0
Joined: 9/24/2004
From:
Status: offline
This is a really nice space script which pulls in a text files of pc's or server. Even color coded as your space nears zero.





'~~Author~~. Rob Dunn
'
'~~Version~~. 1.5 - January 8th, 2004
'
'~~Email_Address~~. qc_metal@hotmail.com
'
'~~Script_Type~~. vbscript
'
'~~Sub_Type~~. System Administration
'
'~~Keywords~~. vbscript, disk space, windows 2000, xp, NT, HTM
' email via SMTP, regwrite, regread
'
'~~Comment~~.
'
' DriveSpace to HTM and email results VBS script (drivespace.vbs)
'
'This script will pull a listing of servers from (in this example,
''c:\temp\servers.txt,' query each server for locally attached hard drives, and
'then find the total, used, and free space percentage and write it to an HTM file
'in your temp directory. A 'warning.htm' file is created with only those drives
'that have triggered the thresholds you set below - background colors are set to
'differentiate between critical/warning/errors.
'
'Additionally, in the summary and warning htm, each server has been linked to the
'drive's administrative share string (c$, d$, etc.) so you can quickly click on
'each drive and do a little cleaning - I believe that this works with I.E. only -
'you may need to modify it so the links are file://|, etc. for Netscape.
'
'If you do not have a sourcefile to pull data from, the script will prompt you
'with an inputbox to query one machine.
'
'If specified via variables in the script, it will email you (thanks to Nathan
'Strimling's email via SMTP script) the warning.htm file at the end of the
'execution. If there are no warnings, the file will not be emailed. There are
'other options you can set to attach both the warning and summary htm files in
'the email prior to sending.
'
'The script is set up by default to email once per day on the day that it is run.
'By altering the sMailOnceDaily var, you can turn this on or off (we have ours
'set to run every 5 minutes, so emailing would be a little annoying!) so, you
'could send it every time it runs.
'
' The format of the servers.txt file is:
'server1
'server2
'server3
'
'// Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing", _
cdoSendUsingPort = 2, _
cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const HARD_DISK = 3
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim strComputer, Silent, strGBFree, strDiskFreeSpace, strDrvString
Dim strDiskDrive, strPercFree, strDiskUsed, CurTime, OutputDir
Dim cbgcolor, wbgcolor, strbgcolor, varlastemail, vartoday, fstyle
Dim sMailSched, strMailTo, strMailFrom, strSubject, StrMessage, strSMTPServer
Dim Command, Count, sPCCount, varSendMail
Dim f, r, w, ws, WshSysEnv, WshShell
On Error Resume Next

'------------------------------------------------------------------------
' Set variables here:
'------------------------------------------------------------------------
strCompany = "CCMC" 'this is the name that will be inserted into the
' registry (HKLM\Software\%strCompany%\IS\DriveSpace)
Silent = 0 ' 0/1
' '0' opens HTM summary after script runs
' '1' does not open HTM summary
strCrit = 10 'if free space % is below this threshold, make critical
strWarn = 20 'if free space % is below this threshold but not below sCrit,
' then don't make critical, make warning instead
cbgcolor = "#FF6600" 'set critical background color
wbgcolor = "blanchedalmond" 'set warning background color
ebgcolor = "darkgray" 'set error background color
nbgcolor = "white" 'set normal background color
SourceFile = "c:\clients.txt" 'set where to pull server names from
'SourceFile = ".\servers.txt" 'set where to pull server names from
OutputDir = "" 'set root directory that you will save HTMs in
' if blank, it will default to your temp folder
' - format must not have a trailing backslash!
' i.e. "c:\temp"
fstyle = "Arial" 'set default font for table
Email = 1 ' 0/1
' '0' does not send email
' '1' sends email after execution
sMailSched = "1,2,3,4,5,6,7" 'set the days of week that you want to email on
' '1' is sunday
' '2' is monday, etc.
' separate numbers by commas
strMailto = "you@domain.com" 'who are you mailing to
strMailFrom = "replyto@domain.com" 'reply address
strSubject = "Low Drive Space Report" 'mail subject
strMsgBody = "See attachment(s)" & ""_
& ", low drive space report" 'message body for emails with attachments
strSMTPServer = "x.x.x.x" 'set SMTP email server address here

sMailOnceDaily = 1 ' 0/1 - send when?
' '0' sends only on days of week specified
' in strMailSched
' '1' sends email every time script is run

sSendAs = 2 ' 0/1/2/3 - send email type as
' *only* if there are warnings...
' '0' sends warning as body of email

(in reply to christopher02)
 
 
Post #: 9
 
 Re: Freespace on NT servers on NT domain - 9/27/2004 2:24:32 AM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
Thank you . i will give both a try and let you both Know of the results thank you again

(in reply to christopher02)
 
 
Post #: 10
 
 Re: Freespace on NT servers on NT domain - 9/30/2004 3:15:56 AM   
  christopher02

 

Posts: 6
Score: 0
Joined: 9/23/2004
From:
Status: offline
Thank for the scripts the first one from Mbouchard did not work on my system the processing bit did. but the reporting bit, seemed to have zapped an excel link but lots of 2003 errors But thank you any way.
The second one from EFB worked a treat. Even picked up the sun boxes. Although the reporting bit needed a bit of tweaking. ( my siteÒs fault really outlook via Citrix ) still no update to Excel but other wise it is champion
Thank you again both scripts have put me in the right direction and cleared up a lot of what are probably fairly basic problems I was having understanding the script language
Thank you both again

(in reply to christopher02)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Freespace on NT servers on NT domain Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts