Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Active Directory » DISC SPACE
DISC SPACE [message #157540] Wed, 08 July 2009 20:01 Go to next message
Eldingo  is currently offline Eldingo  United States
Messages: 69
Registered: July 2009
Member
Hello friends:

Is there a way to get a report on disc space usage on all the servers in the
domain. I need to do report on disc space availability on a monthly basis.
Appreciate your help.

-ciao
Re: DISC SPACE [message #157541 is a reply to message #157540] Wed, 08 July 2009 20:06 Go to previous messageGo to next message
KevinJ.SBS  is currently offline KevinJ.SBS  United States
Messages: 653
Registered: July 2009
Senior Member
Eldingo wrote:
> Hello friends:
>
> Is there a way to get a report on disc space usage on all the servers
> in the domain. I need to do report on disc space availability on a
> monthly basis. Appreciate your help.
>
> -ciao

What server OS versions?


--
/kj
Re: DISC SPACE [message #157545 is a reply to message #157540] Wed, 08 July 2009 21:54 Go to previous messageGo to next message
rlmueller-nospam  is currently offline rlmueller-nospam  United States
Messages: 292
Registered: July 2009
Senior Member
"Eldingo" <eldingo@dingo.net> wrote in message
news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
> Hello friends:
>
> Is there a way to get a report on disc space usage on all the servers in
> the domain. I need to do report on disc space availability on a monthly
> basis. Appreciate your help.
>
> -ciao

A VBScript program to retrieve disk space information from computers read
from a text file:
=========
Option Explicit

Dim strServerFile, objFSO, objFile
Dim objShell, strTemp, strTempFile, strComputer
Dim objWMIService, colDisks, objDisk

Const ForReading = 1
Const HARD_DISK = 3

' Specify file of server NetBIOS names.
strServerFile = "c:\rlm\Scripts\Servers.txt"

' Specify temporary file to save ping results.
Set objShell = CreateObject("Wscript.Shell")
strTemp = objShell.ExpandEnvironmentStrings("%TEMP%")
strTempFile = strTemp & "\RunResult.tmp"

' Open the file for reading.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strServerFile, ForReading)

' Read server names from the file.
Do Until objFile.AtEndOfStream
strComputer = Trim(objFile.ReadLine)
' Skip blank lines.
If (strComputer <> "") Then
' Ping computer to see if online.
If (IsConnectible(strComputer, 1, 750) = True) Then
' Connect to server with WMI.
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
&
"{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
& strComputer & "\root\cimv2")
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo strComputer & ": WMI not installed"
Else
On Error GoTo 0
Wscript.Echo strComputer
' Enumerate hard disks.
Set colDisks = objWMIService.ExecQuery _
("SELECT * FROM Win32_LogicalDisk " _
& "WHERE DriveType = " & HARD_DISK & "")
For Each objDisk In colDisks
Wscript.Echo "-- Device ID: " & objDisk.DeviceID
Wscript.Echo "-- File System: " & objDisk.FileSystem
Wscript.Echo "-- Disk Size: " &
FormatNumber(objDisk.Size, 0)
Wscript.Echo "-- Free Disk Space: " &
FormatNumber(objDisk.FreeSpace, 0)
Next
End If
Else
Wscript.Echo strServer & " not available"
End If
End If
Loop

' Clean up.
objFile.Close
If (objFSO.FileExists(strTempfile) = True) Then
objFSO.DeleteFile(strTempFile)
End If

Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
' Returns True if strHost can be pinged.
' Based on a program by Alex Angelopoulos and Torgeir Bakken.
Dim objFile, strResults

If (intPings = "") Then
intPings = 2
End If
If (intTO = "") Then
intTO = 750
End If

Const OpenAsDefault = -2
Const FailIfNotExist = 0
Const ForReading = 1

objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
& " " & strHost & ">" & strTempFile, 0, True

Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
FailIfNotExist, OpenAsDefault)
strResults = objFile.ReadAll
objFile.Close

Select Case InStr(strResults, "TTL=")
Case 0
IsConnectible = False
Case Else
IsConnectible = True
End Select
End Function
=====
This should be run from a command prompt using cscript. The output can be
redirected to a text file. The text file should have the NetBIOS names of
the computers, one per line. Change the name and path of this file to suit
your situation.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Re: DISC SPACE [message #157546 is a reply to message #157541] Wed, 08 July 2009 22:15 Go to previous messageGo to next message
Eldingo  is currently offline Eldingo  United States
Messages: 69
Registered: July 2009
Member
Hi kj, it is window server 2003.

"kj [SBS MVP]" <KevinJ.SBS@SPAMFREE.gmail.com> wrote in message
news:%23%23fNWkCAKHA.5068@TK2MSFTNGP03.phx.gbl...
> Eldingo wrote:
>> Hello friends:
>>
>> Is there a way to get a report on disc space usage on all the servers
>> in the domain. I need to do report on disc space availability on a
>> monthly basis. Appreciate your help.
>>
>> -ciao
>
> What server OS versions?
>
>
> --
> /kj
>
Re: DISC SPACE [message #157547 is a reply to message #157545] Wed, 08 July 2009 22:21 Go to previous messageGo to next message
Eldingo  is currently offline Eldingo  United States
Messages: 69
Registered: July 2009
Member
Richard, thanks much for the script. I'll start using it right away.


"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:u6KP5gDAKHA.4336@TK2MSFTNGP04.phx.gbl...
>
> "Eldingo" <eldingo@dingo.net> wrote in message
> news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
>> Hello friends:
>>
>> Is there a way to get a report on disc space usage on all the servers in
>> the domain. I need to do report on disc space availability on a monthly
>> basis. Appreciate your help.
>>
>> -ciao
>
> A VBScript program to retrieve disk space information from computers read
> from a text file:
> =========
> Option Explicit
>
> Dim strServerFile, objFSO, objFile
> Dim objShell, strTemp, strTempFile, strComputer
> Dim objWMIService, colDisks, objDisk
>
> Const ForReading = 1
> Const HARD_DISK = 3
>
> ' Specify file of server NetBIOS names.
> strServerFile = "c:\rlm\Scripts\Servers.txt"
>
> ' Specify temporary file to save ping results.
> Set objShell = CreateObject("Wscript.Shell")
> strTemp = objShell.ExpandEnvironmentStrings("%TEMP%")
> strTempFile = strTemp & "\RunResult.tmp"
>
> ' Open the file for reading.
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFile = objFSO.OpenTextFile(strServerFile, ForReading)
>
> ' Read server names from the file.
> Do Until objFile.AtEndOfStream
> strComputer = Trim(objFile.ReadLine)
> ' Skip blank lines.
> If (strComputer <> "") Then
> ' Ping computer to see if online.
> If (IsConnectible(strComputer, 1, 750) = True) Then
> ' Connect to server with WMI.
> On Error Resume Next
> Set objWMIService = GetObject("winmgmts:" _
> &
> "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
> & strComputer & "\root\cimv2")
> If (Err.Number <> 0) Then
> On Error GoTo 0
> Wscript.Echo strComputer & ": WMI not installed"
> Else
> On Error GoTo 0
> Wscript.Echo strComputer
> ' Enumerate hard disks.
> Set colDisks = objWMIService.ExecQuery _
> ("SELECT * FROM Win32_LogicalDisk " _
> & "WHERE DriveType = " & HARD_DISK & "")
> For Each objDisk In colDisks
> Wscript.Echo "-- Device ID: " & objDisk.DeviceID
> Wscript.Echo "-- File System: " &
> objDisk.FileSystem
> Wscript.Echo "-- Disk Size: " &
> FormatNumber(objDisk.Size, 0)
> Wscript.Echo "-- Free Disk Space: " &
> FormatNumber(objDisk.FreeSpace, 0)
> Next
> End If
> Else
> Wscript.Echo strServer & " not available"
> End If
> End If
> Loop
>
> ' Clean up.
> objFile.Close
> If (objFSO.FileExists(strTempfile) = True) Then
> objFSO.DeleteFile(strTempFile)
> End If
>
> Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
> ' Returns True if strHost can be pinged.
> ' Based on a program by Alex Angelopoulos and Torgeir Bakken.
> Dim objFile, strResults
>
> If (intPings = "") Then
> intPings = 2
> End If
> If (intTO = "") Then
> intTO = 750
> End If
>
> Const OpenAsDefault = -2
> Const FailIfNotExist = 0
> Const ForReading = 1
>
> objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
> & " " & strHost & ">" & strTempFile, 0, True
>
> Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
> FailIfNotExist, OpenAsDefault)
> strResults = objFile.ReadAll
> objFile.Close
>
> Select Case InStr(strResults, "TTL=")
> Case 0
> IsConnectible = False
> Case Else
> IsConnectible = True
> End Select
> End Function
> =====
> This should be run from a command prompt using cscript. The output can be
> redirected to a text file. The text file should have the NetBIOS names of
> the computers, one per line. Change the name and path of this file to suit
> your situation.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
Re: DISC SPACE [message #157551 is a reply to message #157547] Thu, 09 July 2009 01:45 Go to previous messageGo to next message
dileep.ponna.3v1mnc  is currently offline dileep.ponna.3v1mnc  United States
Messages: 1
Registered: July 2009
Junior Member
Hello Richard,

I am little bit weak in VB script, I used to get an error at

C:\tasks\diskspace in computers listed.vbs(32, 2) Microsoft VBScript
compilation error: Invalid character

where 32 line 2 char at & as I completely copied from your script
shared.

Set objWMIService = GetObject("winmgmts:" _
&
"{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _
& strComputer & "\root\cimv2")


Please suggest


--
dileep.ponna
------------------------------------------------------------ ------------
dileep.ponna's Profile: http://forums.techarena.in/members/88349.htm
View this thread: http://forums.techarena.in/active-directory/1210418.htm

http://forums.techarena.in
Re: DISC SPACE [message #157570 is a reply to message #157540] Thu, 09 July 2009 07:54 Go to previous messageGo to next message
SimeonD  is currently offline SimeonD  Ireland
Messages: 5
Registered: July 2009
Junior Member
I had a similar requirement last month. I had started to script it, but
found that Spiceworks did what I was looking for.
Its free. Will check the disks as often as you require. Then allows you to
write a report on it. There are some built in reports do, will probably do
what you need.
Comes with some fancy charts that you can use, but I prefer just seeing the
values.

SimeonD

"Eldingo" <eldingo@dingo.net> wrote in message
news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
> Hello friends:
>
> Is there a way to get a report on disc space usage on all the servers in
> the domain. I need to do report on disc space availability on a monthly
> basis. Appreciate your help.
>
> -ciao
>
Re: DISC SPACE [message #157571 is a reply to message #157547] Thu, 09 July 2009 08:18 Go to previous messageGo to next message
pbbergs  is currently offline pbbergs  United States
Messages: 1024
Registered: July 2009
Senior Member
We script ours as well, we output to a csv file and it is kept for
historical purposes so we can go back and look at growth and project out on
future disk consumption as well as look at pig users who consume and never
clean up disk space.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4
Microsoft's Thrive IT Pro of the Month - June 2009

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.

"Eldingo" <eldingo@dingo.net> wrote in message
news:eU0bovDAKHA.3612@TK2MSFTNGP04.phx.gbl...
> Richard, thanks much for the script. I'll start using it right away.
>
>
> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
> message news:u6KP5gDAKHA.4336@TK2MSFTNGP04.phx.gbl...
>>
>> "Eldingo" <eldingo@dingo.net> wrote in message
>> news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
>>> Hello friends:
>>>
>>> Is there a way to get a report on disc space usage on all the servers in
>>> the domain. I need to do report on disc space availability on a monthly
>>> basis. Appreciate your help.
>>>
>>> -ciao
>>
>> A VBScript program to retrieve disk space information from computers read
>> from a text file:
>> =========
>> Option Explicit
>>
>> Dim strServerFile, objFSO, objFile
>> Dim objShell, strTemp, strTempFile, strComputer
>> Dim objWMIService, colDisks, objDisk
>>
>> Const ForReading = 1
>> Const HARD_DISK = 3
>>
>> ' Specify file of server NetBIOS names.
>> strServerFile = "c:\rlm\Scripts\Servers.txt"
>>
>> ' Specify temporary file to save ping results.
>> Set objShell = CreateObject("Wscript.Shell")
>> strTemp = objShell.ExpandEnvironmentStrings("%TEMP%")
>> strTempFile = strTemp & "\RunResult.tmp"
>>
>> ' Open the file for reading.
>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>> Set objFile = objFSO.OpenTextFile(strServerFile, ForReading)
>>
>> ' Read server names from the file.
>> Do Until objFile.AtEndOfStream
>> strComputer = Trim(objFile.ReadLine)
>> ' Skip blank lines.
>> If (strComputer <> "") Then
>> ' Ping computer to see if online.
>> If (IsConnectible(strComputer, 1, 750) = True) Then
>> ' Connect to server with WMI.
>> On Error Resume Next
>> Set objWMIService = GetObject("winmgmts:" _
>> &
>> "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
>> & strComputer & "\root\cimv2")
>> If (Err.Number <> 0) Then
>> On Error GoTo 0
>> Wscript.Echo strComputer & ": WMI not installed"
>> Else
>> On Error GoTo 0
>> Wscript.Echo strComputer
>> ' Enumerate hard disks.
>> Set colDisks = objWMIService.ExecQuery _
>> ("SELECT * FROM Win32_LogicalDisk " _
>> & "WHERE DriveType = " & HARD_DISK & "")
>> For Each objDisk In colDisks
>> Wscript.Echo "-- Device ID: " & objDisk.DeviceID
>> Wscript.Echo "-- File System: " &
>> objDisk.FileSystem
>> Wscript.Echo "-- Disk Size: " &
>> FormatNumber(objDisk.Size, 0)
>> Wscript.Echo "-- Free Disk Space: " &
>> FormatNumber(objDisk.FreeSpace, 0)
>> Next
>> End If
>> Else
>> Wscript.Echo strServer & " not available"
>> End If
>> End If
>> Loop
>>
>> ' Clean up.
>> objFile.Close
>> If (objFSO.FileExists(strTempfile) = True) Then
>> objFSO.DeleteFile(strTempFile)
>> End If
>>
>> Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
>> ' Returns True if strHost can be pinged.
>> ' Based on a program by Alex Angelopoulos and Torgeir Bakken.
>> Dim objFile, strResults
>>
>> If (intPings = "") Then
>> intPings = 2
>> End If
>> If (intTO = "") Then
>> intTO = 750
>> End If
>>
>> Const OpenAsDefault = -2
>> Const FailIfNotExist = 0
>> Const ForReading = 1
>>
>> objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
>> & " " & strHost & ">" & strTempFile, 0, True
>>
>> Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
>> FailIfNotExist, OpenAsDefault)
>> strResults = objFile.ReadAll
>> objFile.Close
>>
>> Select Case InStr(strResults, "TTL=")
>> Case 0
>> IsConnectible = False
>> Case Else
>> IsConnectible = True
>> End Select
>> End Function
>> =====
>> This should be run from a command prompt using cscript. The output can be
>> redirected to a text file. The text file should have the NetBIOS names of
>> the computers, one per line. Change the name and path of this file to
>> suit your situation.
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>
>
Re: DISC SPACE [message #157577 is a reply to message #157551] Thu, 09 July 2009 08:50 Go to previous messageGo to next message
rlmueller-nospam  is currently offline rlmueller-nospam  United States
Messages: 292
Registered: July 2009
Senior Member
"dileep.ponna" <dileep.ponna.3v1mnc@DoNotSpam.com> wrote in message
news:dileep.ponna.3v1mnc@DoNotSpam.com...
>
> Hello Richard,
>
> I am little bit weak in VB script, I used to get an error at
>
> C:\tasks\diskspace in computers listed.vbs(32, 2) Microsoft VBScript
> compilation error: Invalid character
>
> where 32 line 2 char at & as I completely copied from your script
> shared.
>
> Set objWMIService = GetObject("winmgmts:" _
> &
> "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\" _
> & strComputer & "\root\cimv2")
>
>
> Please suggest
>

It looks like line wrapping in the message messed up the code I pasted. The
statement takes up 3 lines, the first two of which end with the line
continuation character "_". The statement should be:

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
& strComputer & "\root\cimv2")

I hope this helps.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Re: DISC SPACE [message #157605 is a reply to message #157546] Thu, 09 July 2009 15:59 Go to previous messageGo to next message
jeff archacki  is currently offline jeff archacki  United States
Messages: 11
Registered: July 2009
Junior Member
Hello Eldingo,

> Hi kj, it is window server 2003.
>
> "kj [SBS MVP]" <KevinJ.SBS@SPAMFREE.gmail.com> wrote in message
> news:%23%23fNWkCAKHA.5068@TK2MSFTNGP03.phx.gbl...
>
>> Eldingo wrote:
>>
>>> Hello friends:
>>>
>>> Is there a way to get a report on disc space usage on all the
>>> servers in the domain. I need to do report on disc space
>>> availability on a monthly basis. Appreciate your help.
>>>
>>> -ciao
>>>
>> What server OS versions?
>>
>> -- /kj
>>

As long as they all have SNMP enabled you can use any program that can trap
SNMP info. There's a whole page of them here: http://www.practicallynetworked.com/support/snmp_apps.htm
I just use Cacti on a Linux box.
Re: DISC SPACE [message #157646 is a reply to message #157540] Fri, 10 July 2009 12:12 Go to previous messageGo to next message
markdmac  is currently offline markdmac  United States
Messages: 139
Registered: July 2009
Senior Member
I would just use VBScript and WMI to gather the information.

'=======================================================================
===
'
' NAME: ReportServerDiskUtilization.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: http://www.thespidersparlor.com
' DATE  : 7/9/2009
' COPYRIGHT C 2009, All Rights Reserved
'
' COMMENT: 
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE
SUPPLIERS
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
'=======================================================================
===
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
'Create our log
Set ts = objFSO.CreateTextFile("DiskUtilization.txt",True)

'Enum Servers In Domain
Set oRootDSE = GetObject("LDAP://rootDSE")
strDom = oRootDSE.Get("DefaultNamingContext")

' available categories = computer, user, printqueue, group
qQuery = "<LDAP://" & strDom & ">;" & _
		"(objectCategory=computer)" & _
       ";name,operatingSystem;subtree"

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute

Do until objRecordSet.EOF
	If InStr(objRecordSet.Fields("operatingSystem"),"Server") > 1 Then
		'Verify server is online first
		strComputer = objRecordSet.Fields("name")
		PingCheck = PingStatus(strComputer)
		If PingCheck = "Success" Then
			Report = GetServerDiskInfo(objRecordSet.Fields("name"))
		Else
 			Report = strComputer & " is offline" & vbCrLf &
"******************************************" & vbCrLf
 			
		End If
		PingCheck = ""
		strComputer = ""
		ts.Write Report 
    End If
    objrecordset.MoveNext
loop
objConnection.Close
'Close the report file
ts.Close

WshShell.Run("notepad.exe DiskUtilization.txt")

WScript.Quit


Function PingStatus(strComputer)
    On Error Resume Next
    Set objWMIService = GetObject("winmgmts:" _
      & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
    Set colPings = objWMIService.ExecQuery _
      ("SELECT * FROM Win32_PingStatus WHERE Address = '" & strComputer
& "'")
    For Each objPing in colPings
        Select Case objPing.StatusCode
            Case 0 PingStatus = "Success"
            Case Else PingStatus = "Offline"
        End Select
    Next
End Function


Function GetServerDiskInfo(strComputer)
	'Now Get Disk Information For the Servers
	'Bind to WMI on the target server
	On Error Resume Next
	Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
	If Err.Number = 0 Then
		report = report & strComputer & " Disk Drive Information" & vbCrLf &
"******************************************" & vbCrLf & vbCrLf
		Set colItems = objWMIService.ExecQuery("Select * from
Win32_LogicalDisk where DriveType = '3'",,48)
		For Each objItem in colItems
		    report = report & "Drive: " & objItem.Caption & vbCrLf 
		    report = report & "VolumeSerialNumber: " &
objItem.VolumeSerialNumber& vbCrLf
		    report = report & "Description: " & objItem.Description& vbCrLf 
		    report = report & "Size: " & objItem.Size /1024\1024+1 & "MB
Total Disk Space" & vbCrLf
		    report = report & "Free Space: " & objItem.FreeSpace /1024\1024+1
& "MB Free Disk Space" & vbCrLf & vbCrLf
		Next
	Else
		report = strComputer & " is unreachable via WMI" & vbCrLf &
"******************************************" & vbCrLf
	End If
	On Error Goto 0
	GetServerDiskInfo = report
End Function
	

--
Re: DISC SPACE [message #157686 is a reply to message #157571] Sun, 12 July 2009 12:31 Go to previous messageGo to next message
Eldingo  is currently offline Eldingo  United States
Messages: 69
Registered: July 2009
Member
Hi Paul:
What script did you use? is it similar to one that Richard wrote? Thanks

"Paul Bergson [MVP-DS]" <pbbergs@no_spammsn.com> wrote in message
news:%23sUmi9IAKHA.4004@TK2MSFTNGP05.phx.gbl...
> We script ours as well, we output to a csv file and it is kept for
> historical purposes so we can go back and look at growth and project out
> on future disk consumption as well as look at pig users who consume and
> never clean up disk space.
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
> Microsoft's Thrive IT Pro of the Month - June 2009
>
> http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup This
> posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Eldingo" <eldingo@dingo.net> wrote in message
> news:eU0bovDAKHA.3612@TK2MSFTNGP04.phx.gbl...
>> Richard, thanks much for the script. I'll start using it right away.
>>
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>> message news:u6KP5gDAKHA.4336@TK2MSFTNGP04.phx.gbl...
>>>
>>> "Eldingo" <eldingo@dingo.net> wrote in message
>>> news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
>>>> Hello friends:
>>>>
>>>> Is there a way to get a report on disc space usage on all the servers
>>>> in the domain. I need to do report on disc space availability on a
>>>> monthly basis. Appreciate your help.
>>>>
>>>> -ciao
>>>
>>> A VBScript program to retrieve disk space information from computers
>>> read from a text file:
>>> =========
>>> Option Explicit
>>>
>>> Dim strServerFile, objFSO, objFile
>>> Dim objShell, strTemp, strTempFile, strComputer
>>> Dim objWMIService, colDisks, objDisk
>>>
>>> Const ForReading = 1
>>> Const HARD_DISK = 3
>>>
>>> ' Specify file of server NetBIOS names.
>>> strServerFile = "c:\rlm\Scripts\Servers.txt"
>>>
>>> ' Specify temporary file to save ping results.
>>> Set objShell = CreateObject("Wscript.Shell")
>>> strTemp = objShell.ExpandEnvironmentStrings("%TEMP%")
>>> strTempFile = strTemp & "\RunResult.tmp"
>>>
>>> ' Open the file for reading.
>>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>>> Set objFile = objFSO.OpenTextFile(strServerFile, ForReading)
>>>
>>> ' Read server names from the file.
>>> Do Until objFile.AtEndOfStream
>>> strComputer = Trim(objFile.ReadLine)
>>> ' Skip blank lines.
>>> If (strComputer <> "") Then
>>> ' Ping computer to see if online.
>>> If (IsConnectible(strComputer, 1, 750) = True) Then
>>> ' Connect to server with WMI.
>>> On Error Resume Next
>>> Set objWMIService = GetObject("winmgmts:" _
>>> &
>>> "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
>>> & strComputer & "\root\cimv2")
>>> If (Err.Number <> 0) Then
>>> On Error GoTo 0
>>> Wscript.Echo strComputer & ": WMI not installed"
>>> Else
>>> On Error GoTo 0
>>> Wscript.Echo strComputer
>>> ' Enumerate hard disks.
>>> Set colDisks = objWMIService.ExecQuery _
>>> ("SELECT * FROM Win32_LogicalDisk " _
>>> & "WHERE DriveType = " & HARD_DISK & "")
>>> For Each objDisk In colDisks
>>> Wscript.Echo "-- Device ID: " &
>>> objDisk.DeviceID
>>> Wscript.Echo "-- File System: " &
>>> objDisk.FileSystem
>>> Wscript.Echo "-- Disk Size: " &
>>> FormatNumber(objDisk.Size, 0)
>>> Wscript.Echo "-- Free Disk Space: " &
>>> FormatNumber(objDisk.FreeSpace, 0)
>>> Next
>>> End If
>>> Else
>>> Wscript.Echo strServer & " not available"
>>> End If
>>> End If
>>> Loop
>>>
>>> ' Clean up.
>>> objFile.Close
>>> If (objFSO.FileExists(strTempfile) = True) Then
>>> objFSO.DeleteFile(strTempFile)
>>> End If
>>>
>>> Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
>>> ' Returns True if strHost can be pinged.
>>> ' Based on a program by Alex Angelopoulos and Torgeir Bakken.
>>> Dim objFile, strResults
>>>
>>> If (intPings = "") Then
>>> intPings = 2
>>> End If
>>> If (intTO = "") Then
>>> intTO = 750
>>> End If
>>>
>>> Const OpenAsDefault = -2
>>> Const FailIfNotExist = 0
>>> Const ForReading = 1
>>>
>>> objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
>>> & " " & strHost & ">" & strTempFile, 0, True
>>>
>>> Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
>>> FailIfNotExist, OpenAsDefault)
>>> strResults = objFile.ReadAll
>>> objFile.Close
>>>
>>> Select Case InStr(strResults, "TTL=")
>>> Case 0
>>> IsConnectible = False
>>> Case Else
>>> IsConnectible = True
>>> End Select
>>> End Function
>>> =====
>>> This should be run from a command prompt using cscript. The output can
>>> be redirected to a text file. The text file should have the NetBIOS
>>> names of the computers, one per line. Change the name and path of this
>>> file to suit your situation.
>>>
>>> --
>>> Richard Mueller
>>> MVP Directory Services
>>> Hilltop Lab - http://www.rlmueller.net
>>> --
>>>
>>>
>>
>>
>
>
Re: DISC SPACE [message #157687 is a reply to message #157570] Sun, 12 July 2009 12:32 Go to previous messageGo to next message
Eldingo  is currently offline Eldingo  United States
Messages: 69
Registered: July 2009
Member
Thanks SimeonD, I will check out spiceworks.
"SimeonD" <simeond@nospam.nospam> wrote in message
news:OHNCvvIAKHA.1536@TK2MSFTNGP05.phx.gbl...
>I had a similar requirement last month. I had started to script it, but
>found that Spiceworks did what I was looking for.
> Its free. Will check the disks as often as you require. Then allows you to
> write a report on it. There are some built in reports do, will probably do
> what you need.
> Comes with some fancy charts that you can use, but I prefer just seeing
> the values.
>
> SimeonD
>
> "Eldingo" <eldingo@dingo.net> wrote in message
> news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
>> Hello friends:
>>
>> Is there a way to get a report on disc space usage on all the servers in
>> the domain. I need to do report on disc space availability on a monthly
>> basis. Appreciate your help.
>>
>> -ciao
>>
>
>
Re: DISC SPACE [message #157755 is a reply to message #157686] Tue, 14 July 2009 08:14 Go to previous message
pbbergs  is currently offline pbbergs  United States
Messages: 1024
Registered: July 2009
Senior Member
No it is written in Perl.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4
Microsoft's Thrive IT Pro of the Month - June 2009

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.

"Eldingo" <eldingo@dingo.net> wrote in message
news:u2Jh94wAKHA.4016@TK2MSFTNGP02.phx.gbl...
> Hi Paul:
> What script did you use? is it similar to one that Richard wrote? Thanks
>
> "Paul Bergson [MVP-DS]" <pbbergs@no_spammsn.com> wrote in message
> news:%23sUmi9IAKHA.4004@TK2MSFTNGP05.phx.gbl...
>> We script ours as well, we output to a csv file and it is kept for
>> historical purposes so we can go back and look at growth and project out
>> on future disk consumption as well as look at pig users who consume and
>> never clean up disk space.
>>
>> --
>> Paul Bergson
>> MVP - Directory Services
>> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
>> 2008, 2003, 2000 (Early Achiever), NT4
>> Microsoft's Thrive IT Pro of the Month - June 2009
>>
>> http://www.pbbergs.com
>>
>> Please no e-mails, any questions should be posted in the NewsGroup This
>> posting is provided "AS IS" with no warranties, and confers no rights.
>>
>> "Eldingo" <eldingo@dingo.net> wrote in message
>> news:eU0bovDAKHA.3612@TK2MSFTNGP04.phx.gbl...
>>> Richard, thanks much for the script. I'll start using it right away.
>>>
>>>
>>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>>> message news:u6KP5gDAKHA.4336@TK2MSFTNGP04.phx.gbl...
>>>>
>>>> "Eldingo" <eldingo@dingo.net> wrote in message
>>>> news:%236aumhCAKHA.528@TK2MSFTNGP03.phx.gbl...
>>>>> Hello friends:
>>>>>
>>>>> Is there a way to get a report on disc space usage on all the servers
>>>>> in the domain. I need to do report on disc space availability on a
>>>>> monthly basis. Appreciate your help.
>>>>>
>>>>> -ciao
>>>>
>>>> A VBScript program to retrieve disk space information from computers
>>>> read from a text file:
>>>> =========
>>>> Option Explicit
>>>>
>>>> Dim strServerFile, objFSO, objFile
>>>> Dim objShell, strTemp, strTempFile, strComputer
>>>> Dim objWMIService, colDisks, objDisk
>>>>
>>>> Const ForReading = 1
>>>> Const HARD_DISK = 3
>>>>
>>>> ' Specify file of server NetBIOS names.
>>>> strServerFile = "c:\rlm\Scripts\Servers.txt"
>>>>
>>>> ' Specify temporary file to save ping results.
>>>> Set objShell = CreateObject("Wscript.Shell")
>>>> strTemp = objShell.ExpandEnvironmentStrings("%TEMP%")
>>>> strTempFile = strTemp & "\RunResult.tmp"
>>>>
>>>> ' Open the file for reading.
>>>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>>>> Set objFile = objFSO.OpenTextFile(strServerFile, ForReading)
>>>>
>>>> ' Read server names from the file.
>>>> Do Until objFile.AtEndOfStream
>>>> strComputer = Trim(objFile.ReadLine)
>>>> ' Skip blank lines.
>>>> If (strComputer <> "") Then
>>>> ' Ping computer to see if online.
>>>> If (IsConnectible(strComputer, 1, 750) = True) Then
>>>> ' Connect to server with WMI.
>>>> On Error Resume Next
>>>> Set objWMIService = GetObject("winmgmts:" _
>>>> &
>>>> "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\ " _
>>>> & strComputer & "\root\cimv2")
>>>> If (Err.Number <> 0) Then
>>>> On Error GoTo 0
>>>> Wscript.Echo strComputer & ": WMI not installed"
>>>> Else
>>>> On Error GoTo 0
>>>> Wscript.Echo strComputer
>>>> ' Enumerate hard disks.
>>>> Set colDisks = objWMIService.ExecQuery _
>>>> ("SELECT * FROM Win32_LogicalDisk " _
>>>> & "WHERE DriveType = " & HARD_DISK & "")
>>>> For Each objDisk In colDisks
>>>> Wscript.Echo "-- Device ID: " &
>>>> objDisk.DeviceID
>>>> Wscript.Echo "-- File System: " &
>>>> objDisk.FileSystem
>>>> Wscript.Echo "-- Disk Size: " &
>>>> FormatNumber(objDisk.Size, 0)
>>>> Wscript.Echo "-- Free Disk Space: " &
>>>> FormatNumber(objDisk.FreeSpace, 0)
>>>> Next
>>>> End If
>>>> Else
>>>> Wscript.Echo strServer & " not available"
>>>> End If
>>>> End If
>>>> Loop
>>>>
>>>> ' Clean up.
>>>> objFile.Close
>>>> If (objFSO.FileExists(strTempfile) = True) Then
>>>> objFSO.DeleteFile(strTempFile)
>>>> End If
>>>>
>>>> Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
>>>> ' Returns True if strHost can be pinged.
>>>> ' Based on a program by Alex Angelopoulos and Torgeir Bakken.
>>>> Dim objFile, strResults
>>>>
>>>> If (intPings = "") Then
>>>> intPings = 2
>>>> End If
>>>> If (intTO = "") Then
>>>> intTO = 750
>>>> End If
>>>>
>>>> Const OpenAsDefault = -2
>>>> Const FailIfNotExist = 0
>>>> Const ForReading = 1
>>>>
>>>> objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
>>>> & " " & strHost & ">" & strTempFile, 0, True
>>>>
>>>> Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
>>>> FailIfNotExist, OpenAsDefault)
>>>> strResults = objFile.ReadAll
>>>> objFile.Close
>>>>
>>>> Select Case InStr(strResults, "TTL=")
>>>> Case 0
>>>> IsConnectible = False
>>>> Case Else
>>>> IsConnectible = True
>>>> End Select
>>>> End Function
>>>> =====
>>>> This should be run from a command prompt using cscript. The output can
>>>> be redirected to a text file. The text file should have the NetBIOS
>>>> names of the computers, one per line. Change the name and path of this
>>>> file to suit your situation.
>>>>
>>>> --
>>>> Richard Mueller
>>>> MVP Directory Services
>>>> Hilltop Lab - http://www.rlmueller.net
>>>> --
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:RE: Delegation - Effective Rights
Next Topic:Migration of DHCP Scopes from 1 DHCP Server to another DHCP Server
Goto Forum:
  


Current Time: Fri Oct 20 10:05:48 EDT 2017

Total time taken to generate the page: 0.06606 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software