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

    #31
    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
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #32
      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

      Comment


        #33
        arrComputers = Array("ADMINISTRATOR")

        arrComputers is not being populated on my machine. Any suggestions?
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #34
          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

          Comment


            #35
            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

            Comment


              #36
              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.

              Comment


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

                - Have you tried looking at it?

                Comment

                Working...
                X