Solved

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

Posted on 2013-06-14
4
722 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

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…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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