Announcement

Collapse
No announcement yet.

How can I tell if another network PC is turned on?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fireball
    Guest replied
    "How can I tell if another network PC is turned on?"

    - Have you tried looking at it?

    Leave a comment:


  • AlbuquTurkey
    Guest replied
    Change to DataBase

    My system was getting slower and slower. I tracked it down to the fact that I've been putting more historical data into the database for later analysis. Well the bigger the database the longer to access it and get back to the automation system. I will be changing it from a recurring event (every minute in the case of HVAC monitoring) to a state change event and create the sub routines to calculate the time. Just giving you that are using this routine a heads up that it will slow your system down.

    Leave a comment:


  • Al213
    Guest replied
    See: http://msdn.microsoft.com/library/en...e_computer.asp

    for connecting remote computers

    Also, you could use: (on XP machines only)
    strMachines = "192.168.1.xx;192.168.1.x1" 'etc
    ClientMachine = split(strMachines, ";")

    For Each machine in ClientMachine
    Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
    ExecQuery("select * from Win32_PingStatus where address = '"_
    & machine & "'")
    For Each objStatus in objPing
    If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
    WScript.Echo( ClientMachine & " is off!")
    End If
    Next
    Next

    Leave a comment:


  • Al213
    Guest replied
    Replace ADMINISTRATOR with "YOURCOMPUTERNAME"

    arrComputers = Array("YOURCOMPUTERNAME")

    Wscript.exe version 5.6.0.8825 - in winsys directory
    You are the Administrator executing the script and have all rights to admin lan
    Save this snip as test.vbs dbl click, you should get a message box that reads all computers on LAN in collection along with their On state. If any computer isn't on - it won't report it in the message box.
    You could tweak it to report on all states and run it within an ASP page or VB

    Leave a comment:


  • Rupp
    replied
    arrComputers = Array("ADMINISTRATOR")

    arrComputers is not being populated on my machine. Any suggestions?

    Leave a comment:


  • Al213
    Guest replied
    Try:

    On Error Resume Next

    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20

    arrComputers = Array("ADMINISTRATOR")
    For Each strComputer In arrComputers

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkClient", "WQL", _
    wbemFlagReturnImmediately + wbemFlagForwardOnly)

    For Each objItem In colItems
    If objItem.Status = "OK" Then WScript.Echo strComputer & " " & objItem.Caption & ": is On "
    WScript.Echo
    Next
    Next

    Leave a comment:


  • Rupp
    replied
    Originally posted by dhanford
    I am using your script... Which is great!

    Is there an easy way for it to write the machine name with "Is Offline" to a device code like v1? And comma seperate them if there is more then one?

    Thanks
    Try this script and see if it does what you want. Just change the device code for the sOffLineDevCode.
    Attached Files

    Leave a comment:


  • fungun
    replied
    AlbuquTurkey,
    Thanx much
    Tim

    Leave a comment:


  • dhanford
    replied
    Rupp

    I am using your script... Which is great!

    Is there an easy way for it to write the machine name with "Is Offline" to a device code like v1? And comma seperate them if there is more then one?

    Thanks

    Leave a comment:


  • AlbuquTurkey
    Guest replied
    IP Status Monitoring

    XBox OnLine Monitoring

    PHP Code:
    ' database adopted from hvac_logging.txt
    Chuck Preecs 5/18/2003

    ' ping adopted from Rupp's posting 
    ' Homeseer Board 5/19/2005


    Const debugFlag = 0
    Const scriptName = "IP_Monitor.txt"

    Sub Main()
      
      if debugFlag = 1 then hs.writelog scriptName, "============START (" & Now & ")============" end if

     '
    IP address virtual device code ...
    XBox "192.168.1.45" "|" "Z5"


    Call GoPing (Xbox)

    if (
    hs.DeviceString("Z5")="<font color='lime'>OnLine</font>"then 
        
    if debugFlag 1 Then hs.writelog scriptName"Xbox is on" end If
        
    Call LogData ("XBox",1)
      else 
        if 
    debugFlag 1 Then hs.writelog scriptName"Xbox is off" end If
        
    Call LogData ("XBox",0)
    end if

      
      if 
    debugFlag 1 then hs.writelog scriptName"============END (" Now ")============" end if
      
    End Sub 'main

    sub LogData(unit,status)
    '
    *****************************************************************************
    ' Log to a database
    '
    *****************************************************************************

    '* Declare and set objects/variables

    name of Access database file
    Const strDatabaseName "OnLine.mdb"
    Dim objConn
    Dim strConnectionString
    strDatabasestrSQL
    strDatabase 
    hs.GetAppPath "/" strDatabaseName
    strConnectionString 
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" strDatabase

    ' Open database connection
    Set objConn = CreateObject("ADODB.Connection")
    objConn.Open(strConnectionString)

    Insert row
    strSQL 
    "INSERT INTO tblIpStatus (DTS, Unit, Status) VALUES ('"Now "', '" unit "', " status ")"
    if debugFlag 1 Then hs.writelog scriptNamestrSQL End If
    objConn.Execute strSQL

    ' Close database
    objConn.Close
    Set objConn = Nothing

    end sub '
    *** end LogTemp()



    Private 
    Sub GoPing(strData)
        
    dim splValsstrVar

        splVals 
    Split(strData"|")
      
        
    strVar hs.ping(cstr(splVals(0)) , 2)
        If 
    strVar 0 Then
            Status 
    "<font color='lime'>OnLine</font>"
        
    Else
            
    Status "<font color='red'>OffLine</font>"
    '   keeping for future use  5/19/05 ea
    '        
    if splVals(0) = "192.168.1.40" then
    '    hs.SendEmail "eric.albright@dalsemi.com","lalbright34@sprintpcs.com","Phone System Down","Phone System Down"
    '        
    end if
        
    End If
        
    hs.SetDeviceString splVals(1), StatusTrue
    End Sub  
    'end GoPing() 
    There are a couple of ways to figure the time with this.
    1) the actual times are posted in the database
    2) know the interval that you are running the event and sum the status column for the time range your looking for then multiply by the interval giving you the number of minutes that the item was on.

    I cut out the monitoring of the phone system and other computers which use the same event hopefully I didn't cut anything that was needed. If it doesn't work let me know and I will help figure out what is missing.

    I noticed in that my notes on this that it works only while online since the xbox does activate the lan unless it is using it. In my case my son is either online with it or not using it, so it works for me right now.

    Leave a comment:


  • swc69
    Guest replied
    Great!

    I'd be very interested in that also.

    Steve C.

    Leave a comment:


  • AlbuquTurkey
    Guest replied
    Tracking XBox usage

    I just looked at the code and it is a mess - hard for me to follow and I've been modifiing it from work after Rupp's Ping posting - since that looked really neat. Let me clean it up tonight and give credit where credit is due and I'll post it. Look back in about 4 hours.

    Leave a comment:


  • fungun
    replied
    AlbuquTurkey, I would love to see how this is done. Could you share your methods/scripts?
    Thanx
    Tim

    Leave a comment:


  • AlbuquTurkey
    Guest replied
    Monitoring Game Time

    I use the XBox Online/Offline ping to determine amount of time my kids are playing games. I ping it every 5 minutes. I give them 3 hours on Wed., Friday and 6 hours on Saturday. They owe me $$ if they go over their allowed time. They have not figured out how I'm tracking their time, yet.

    BTW: I don't count in the time the first 5 minutes or last 5 minutes that I see the unit on, so they are actually getting upto 10 free minutes. And it is saved in a database so if and when the argue I have proof.

    Leave a comment:


  • JeffCharger
    replied
    Thanks Barry, I found the listing in the DHCP listing on the router (an SMC Barricade) and then muddled my way through my son's XBOX to find an IP screen which verified it. Thanks

    Leave a comment:

Working...
X