Login | |
|
 |
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.
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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.
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
|
|