Kovitt Posted July 3, 2008 Share Posted July 3, 2008 (edited) Hello, I am writing a script that Scans Network Computers for current Services, Time, Network Connectivity, number of .dat files, and if the FTP to Inbox, and ADR services are functioning. This is what I have so far but it won't display my arrays. Also Is there anything wrong with my StringReg Exp? Thanks expandcollapse popup#Include <Date.au3> #include <String.au3> #Include <File.au3> #Include <Array.au3> FileInstall("C:\Documents and Settings\OvittKe\My Documents\scripts\ADR\Names.txt", @ScriptDir & "\", 0) ; Deletes Previous Records FileDelete("FTPQueryResults.txt") FileDelete("ADRQueryResults.txt") FileDelete("OutputTime.txt") Dim $times Dim $Ntime[500] Dim $CName[500] Dim $FTParray[1000] Dim $ADRarray[1000] Dim $FTP[1000] Dim $ADR[1000] Dim $Ping[1000] Dim $FTPFiles[1000] $count = 0 $a = 0 $PC_File = FileOpen("Names.txt",0) ProgressOn("ADR FTP SCAN", "Percent Complete", "Progress",1,16) $Line_Number = _FileCountLines("Names.txt") While True $CompName = FileReadLine($PC_File) If @error = -1 Then ExitLoop EndIf $CName[$a] = $CompName ;--------------------------------------------------------Comp Time----------------------------------------- RunWait(@ComSpec & " /c w32tm /monitor /computers:" & $CompName & " > OutputTime.txt") $path = FileOpen("OutputTime.txt",0) $Net_time = StringRegExp($path, 'NTP:\s*[\+-](.+?)s', 3) If @error = 0 then $NTime[$a] = $Net_time[0] EndIf If @error <> 0 Then $NTime[$a] = "UnAvailable" EndIf ;----------------------------------------------------------------------------------------------------------- ;************************************Services********************************* Runwait(@ComSpec & " /c sc \\"&$CompName&" query ""FTP to Inbox"" > FTPQueryResults.txt") $pathFTP = FileOpen("FTPQueryResults.txt",0) While True $FTPLine = FileReadline($pathFTP) if @error = -1 Then ExitLoop EndIf $FTPResult = StringRegExp($FTPLine, "(?i)[^STATE : ] .*", 3) If @error = 0 then $FTP[$a] = $FTPResult[0] Else $FTP[$a] = "UnAvailable" EndIf WEnd Runwait(@comspec & " /c sc \\"&$CompName&" query adr > ADRQueryResults.txt") $pathADR = FileOpen("ADRQueryResults.txt",0) While True $ADRLine = FileReadline($pathADR) if @error = -1 Then ExitLoop EndIf $ADRResult = StringRegExp($ADRLine, "(?i)[^STATE : ] .*", 3) If @error = 0 then $ADR[$a] = $ADRResult[0] Else $ADR[$a] = "UnAvailable" EndIf WEnd MsgBox(0,"ADR",$ADR[$a]) ;************************************************************** ;[][][][][][][][]Progress Bar[][][][][][][][][][] $Percent = ($count / $Line_Number) * 100 $count = $count+1 ProgressSet($Percent, "Scanning " & $CompName) ;[][][][][][][][][][][][][][][][][][][][][][][][][][] ;########################## Number of Files in '\c$\adr\data' ########################## $Files = _FileListToArray("\\"&$CompName&"\c$\adr\data") If @error = 1 Then $Files_Re = _FileListToArray("\\"&$CompName&"\c$\adr\data") If @error = 1 Then $PingValue = ping($compName) If $PingValue = 0 Then $Ping[$a] = "Error" Else $Ping[$a] = "Ok" EndIf EndIf Else If @error <> 4 Then $Ping[$a] = "Ok" If $Files[0] >= 10 Then $FTPFiles[$a] = "> 10" Else $FTPFiles[$a] = "Ok" EndIf EndIf EndIf $a = $a + 1 WEnd ;###################################################################### ProgressOff() SoundPlay(@WindowsDir & "\media\tada.wav",0) _ArrayDisplay($FTPFiles[$a]) _ArrayDisplay($Ping[$a]) _ArrayDisplay($ADR[$a]) _ArrayDisplay($FTP[$a]) _ArrayDisplay($NTime[$a]) _ArrayDisplay($CName[$a]) Please Help!! P.S. SOrry the comments are messy.. They don't copy over right.. Edited July 3, 2008 by Kovitt Link to comment Share on other sites More sharing options...
Champak Posted July 3, 2008 Share Posted July 3, 2008 (edited) If the arrays aren't showing, they prob. aren't there. Check IsArray() to make sure the arrays were created. EDIT: Didn't really Go throuGh your code, but Get rid of the [$a] in the arraydisplays. Edited July 3, 2008 by Champak Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now