[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
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…

656 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