Solved

bat script to check if a network PC is turned on?

Posted on 2013-06-14
4
723 Views
Last Modified: 2013-06-14
Is there a bat script that will check whether a pc on a network is turned on, or logged in, and perform other bat operations if it is on?
0
Comment
Question by:machine_run
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Sam Simon Nasser earned 333 total points
ID: 39248981
I'll give you a hint:
in the bat file, run ping command; if it return results, then the PC is on, otherwise it's off.
to check if is logged in, check the script in this page and modify it to your needs
http://community.spiceworks.com/scripts/show/1328-who-logged-in-to-what-computer-on-my-network-and-when-answered
0
 
LVL 10

Assisted Solution

by:Sam Simon Nasser
Sam Simon Nasser earned 333 total points
ID: 39248986
also this is .vbs script to check logged users, if may help
http://www.intelliadmin.com/index.php/2012/06/find-out-who-logged-on-to-a-computer/
0
 
LVL 7

Assisted Solution

by:dec0mpile
dec0mpile earned 167 total points
ID: 39248989
That would look like this (replace the IP in this example 192.168.1.1 with machine you want to check):

@echo off

rem Check to see if machine is on.
echo 192.168.1.1
ping -n 2 192.168.1.1 >NUL 2>NUL

if errorlevel 1 goto down

rem ##########################
rem Insert the code for doing work when the machine is on between this line and 'goto end" line
 
goto end


:down
  rem The machine down
  echo It's not on

:end

Open in new window

0
 
LVL 1

Author Closing Comment

by:machine_run
ID: 39249001
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question