Announcement

Collapse
No announcement yet.

ping in vbs

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

  • ping in vbs

    whats the ping command in vbs and is it possible to use this poing command to ping a variable in a specific ou?

    f.i.

    i got severel computers in the computer ou.
    i would like too use the inputbox to define which comps i need to ping and which i dont need too

    thanks.
    Last edited by deheugden; 2nd February 2007, 20:42.

  • #2
    Re: ping in vbs

    Amazing what Google:

    http://www.google.com/search?hl=en&q=ping+vbs

    finds:

    http://www.microsoft.com/technet/scr...nc_remote.mspx

    which appears to have several methods to ping by either shelling out ping.exe or using some WMI features.

    Regarding the OU bit, the first hit from Google:

    http://www.google.com/search?hl=en&q=ping+vbs+ou

    yields this:

    http://www.scriptinganswers.com/foru...ts.asp?TID=364

    If that one doesn't work there are many more to try.

    I would probably get on you a little bit for not trying Google first but I enjoyed the read and may play with the scripts tonight so thanks (really) for the diversion.
    Cheers,

    Rick

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

    Comment


    • #3
      Re: ping in vbs

      well,i did try google offcourse.but sometimes i just dont get it working or i just dont get it. when i am getting to that point i post a q on the forum for help.i dont want to bother others with my scripting failures
      i am no good in vbs although i really like it and really try
      Last edited by deheugden; 2nd February 2007, 20:43.

      Comment


      • #4
        Re: ping in vbs

        No apologies. I enjoyed the search. I do want you to commit to coming back and posting your final results.
        Cheers,

        Rick

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

        Comment


        • #5
          Re: ping in vbs

          offcourse

          Comment


          • #6
            Re: ping in vbs

            Do you want the ping to resolve an ipaddress, or just to check if a certain computer is powered-on at that time?

            Originally posted by deheugden
            i got severel computers in the computer ou.
            i would like too use the inputbox to define which comps i need to ping and which i dont need too
            If you want to use an Inputbox() and manualy input one computername, the name of an OU is not relevant. In that case use:
            Code:
            'Inputbox asks for computername or -IPaddress
            '--------------------------------------------------------------------------------------------------
            Dim strComputer
            strComputer = Inputbox(vbCrLf&vbCrLf&"Ping this computer:","Ping","name or ip")
            If strComputer = "" then
             Wscript.Quit
            End If
            
            'now Ping that computer (the next part of the script works only on Win XP / 2003 )
            '--------------------------------------------------------------------------------------------------
              Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
              Set colItems = objWMIService.ExecQuery _
                ("Select * from Win32_PingStatus " & _
                    "Where Address = '" & strComputer & "'")
              For Each objItem in colItems
                If objItem.StatusCode = 0 Then 
                    WScript.Echo "Reply received from " & strComputer 
                else MsgBox "The computer " & strComputer & " is not powered-On"
                End If
              Next
            
            Wscript.Quit
            But if you do want the script to query an OU for computer accounts see this example:
            http://forums.petri.com/showthread.p...3093&page=2#14
            first part: "Enumerate Computer Accounts in Active Directory" (here you could use InputBox to input a specific OU)


            \Rem

            This posting is provided "AS IS" with no warranties, and confers no rights.

            __________________

            ** Remember to give credit where credit's due **
            and leave Reputation Points for meaningful posts

            Comment


            • #7
              Re: ping in vbs

              ok.this looks great.i will test it and give some feedback.thanks for the help.

              i wish you where my neigbor cause i got thousends of questions about vbs and it seems like youre very good at vbs
              Last edited by deheugden; 19th February 2007, 15:14.

              Comment

              Working...
              X