tAKTelapis Posted December 17, 2006 Posted December 17, 2006 Hey guys, Can anyone think of a way other than a ping test to see if a remote computer is actually on, that is nice and quick? i could just use the example from the help file, and integrate the ping check to my script, but before i do that i wouldnt mind knowing: How big are the packets sent? How many packets does it check with? (the standard 4? if so, can i change this?) Im working on a program for managing certain aspects of a computer remotely (internet control namely) and it relies on being able to remotely access a computer, if that computer isnt on, it tends to hang for a good 30 seconds before continuing, this essentially slows up the entire process. I just need it to check that the computer ($LabNameStart&$x&$LabNameEnd) is actually on (name is formated like this as we have naming convetions for rooms, IE: XXX-Room1-01# I realise there is a lot of code missing, but all i really need to do is check that the machine is on as quick as possible, and save its name to an array, to be displayed during the final message box so that the user knows which machines were missed (most likely as there were not switched on) Case $msg = $InternetOn $z = 0 _GetRoom() ProgressOn("Internet On", "Turning Internet on in "&GUICtrlRead($room), "0 Percent", (@DesktopWidth / 2)-150, (@DesktopHeight / 2), 18) For $x = 1 to $LabNumMachines ProgressSet( $z, $z & " percent") $z = $z + $ProgressIncrement If StringLen($x) = 1 Then $x = String("0"&$x) $command = String('c:\windows\system32\ipseccmd.exe ')&String('\\'&$LabNameStart&$x&$LabNameEnd)&String(' import ')&String('"c:\program files\NetControl\ei\WWWcontrol.ipsec"')&String(' >>c:\Logs\ErrorLog_ON_net.txt') _RunDOS($command) ; MsgBox(0, "Test", $command) Next RegWrite("\\"&$LabNameStart&"01"&$LabNameEnd&"\HKLM\Software\NetControl\", "RoomStatus", "REG_SZ", "0") ProgressSet(100 , "Done", "Complete") ProgressOff() MsgBOx(0, "Internet On", "Internet should now be on in "&GUICtrlRead($room))
_Kurt Posted December 17, 2006 Posted December 17, 2006 Perhaps try this UDF (created by WhiteTiger I believe) func checkinet() $f_con = DllCall("wininet.dll","Dword","InternetAttemptConnect") if $f_con <> 0 then DllCall("wininet.dll","dword","InternetAttemptConnect") $f_con = DllCall("wininet.dll","Dword","InternetAttemptConnect") if $f_con <> 0 then Return -1 EndIf EndIf $f_open = DllCall("wininet.dll","dword","InternetOpen","Dword","dwAccesType") if not $f_open = 0 then Return $f_open EndFunc Hope that helps! Kurt Awaiting Diablo III..
martin Posted December 17, 2006 Posted December 17, 2006 (edited) If you know the name of the computer then what I do is I simply say If FileExists('\\' & $Name & '\C\.') Then $on = true Edited December 17, 2006 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
tAKTelapis Posted December 17, 2006 Author Posted December 17, 2006 Cheers, looks like an interesting UDF, i will have to have a look into it, though the IPSec policies are working wonders at the moment, i was just hoping i could cut down network traffic a little by not having to ping every computer in the room.
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