Solved

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

Posted on 2013-06-14
4
717 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
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Sam Simon Nasser earned 333 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now