?
Solved

Modify existing script to decrease run time

Posted on 2008-10-21
4
Medium Priority
?
232 Views
Last Modified: 2010-04-21
Hi Experts.  I just worked with an expert to get this script running now I want to tweak it some.  The script essentially runs through a text file containing the 200+ computers in my domain and writes to the log file the user that is logged in.  The problem I have noticed is that the script will wait a few seconds on a pc that isn't online.  So I was hoping I could build in a portion of the script that will ping the machine (or do whatever to verify if it is online or not) and if the pc is on, grab the current user, if not, skip it and go to the next one.  

I have zero idea on how to do this so please be willing to answer noob questions.  Thanks in advance.
for /F %%c in (C:\tools\computers.txt) do (
    set comp=%%c
    call :Check_Names
  )
goto :eof
 
:Check_Names
  C:\tools\psloggedon -l -x \\%comp% >> C:\tools\Logged_On.txt
goto :eof

Open in new window

0
Comment
Question by:samiam41
[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
  • 3
4 Comments
 
LVL 21

Accepted Solution

by:
AmazingTech earned 2000 total points
ID: 22769805
Do a Ping.
for /F %%c in (C:\tools\computers.txt) do (
    set comp=%%c
    call :Check_Names
  )
goto :eof
 
:Check_Names
  ping -n 1 -w 100 %comp%
  If not errorlevel 1 C:\tools\psloggedon -l -x \\%comp% >> C:\tools\Logged_On.txt
goto :eof

Open in new window

0
 
LVL 9

Author Comment

by:samiam41
ID: 22769817
Awesome.  Let me try it out and I will post the results.  Thanks!
0
 
LVL 9

Author Closing Comment

by:samiam41
ID: 31508394
Awesome!!  Thanks for the help.  We had a server room over-heat TWICE and I have been working on that.  Sorry I didn't accept this answer sooner.  Great job!

-Aaron
0
 
LVL 9

Author Comment

by:samiam41
ID: 22812926
If you get a chance, I would appreciate your help on this one:

http://www.experts-exchange.com/Programming/Languages/Scripting/Q_23850483.html
0

Featured Post

Industry Leaders: 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 you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

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