?
Solved

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

Posted on 2013-06-14
4
Medium Priority
?
724 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 1332 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 1332 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 668 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

764 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