Scripting Question

VB script to check the c$ share status

08/21/2013 1368 views

Hi All,

I need the script to check the C$ share status and if not have to mapped for the HP CAE installation. Can anyone help me out.

0 Comments   [ + ] Show comments


All Answers


Try this and tweak as necessary:

SET objFSO = CreateObject("Scripting.FileSystemObject") 
SET objInputfile = objFSO.OpenTextFile("serverhealthcheckserverlist.txt") 
Set objShell = WScript.CreateObject( "WScript.Shell" ) 
resultsStr = "" 
DO WHILE NOT objInputfile.AtEndOfStream strComputer = objInputfile.readline 
SET objExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer) 
strPingResults = LCase(objExec.StdOut.ReadAll) 
IF InStr(strPingResults, "ttl") THEN 
On Error Resume Next 
err.number = 0 
set null = objFSO.GetFolder("\\" & strComputer & "\c$") 
set null = nothing 
If err.number = 0 
then resultsStr = resultsStr & strComputer & "_OK__" 
Else resultsStr = resultsStr & strComputer & "_FAIL_Drive_Ping_OK_" 
End If err.number = 0 on error goto 0 
ELSE resultsStr = resultsStr & strComputer & "_FAIL__" 
objShell.Run("bmail -s grj-exch01 -t ITalert@greatrail.com -f alert@greatrail.com -h -a ServerHealth -b " & resultsStr) 'msgbox(resultsStr) 
Set objShell = Nothing 
Set resultsStr = Nothing  
Answered 08/21/2013 by: mattski
Second Degree Green Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ