Announcement

Collapse
No announcement yet.

Script to tell which computers are powered on?

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

  • Script to tell which computers are powered on?

    Hi all,

    I have a batch file that I wrote to work with PSSHUTDOWN that powers off all machines via a scheduled task at a certain time. This works fine but I was wondering if there was a batch file I could make (or maybe a script is already out there) that will ping multiple PC's at night so I can look at it the next day to see which have replies etc.

    Thanks

  • #2
    Re: Script to tell which computers are powered on?

    If you want to use ping, you can do this:

    ping PCNAME1 > lastnight.txt
    ping PCNAME2 >> lastnight.txt
    ping PCNAME3 >> lastnight.txt


    Note how the file "lastnight.txt" is created/overwritten by using a single > in the first place, then by using >> after that, the results of the ping are appended to the text file which you can look at the following day.

    It is very unsophisticated indeed but perhaps gives you food for thought!
    Best wishes,
    PaulH.
    MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

    Comment


    • #3
      Re: Script to tell which computers are powered on?

      On what OS is the scheduled job running?

      \Rems

      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


      • #4
        Re: Script to tell which computers are powered on?

        We do something simliar whereby we ping muliple PCs and those that respond positvely will then be shutdown. Here is the ping part:

        for /f %%H in (ListofPCs.txt
        ) do (
        ping %%H -n 2 | find "TTL=" > nul
        if errorlevel 1 (echo %%H >> Off.txt) else (echo %%H >> ON.txt)
        )

        You'll need to create a text file with the list of PCs on separate lines. The results of the ping test gets put into either an On.txt or an Off.txt file.

        Hope this helps.

        Paul's version will also work.

        Comment

        Working...
        X