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)
Please log in to answer
Posted by:
mattski
11 years ago
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