/build/static/layout/Breadcrumb_cap_w.png

VB script to check the c$ share status

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

Answers (1)

Posted by: mattski 10 years ago
Second Degree Green Belt
1

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__" 
END IF 
LOOP 
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  
 
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