?
Solved

Writing logon script to get user, computer, time, and date

Posted on 2007-04-04
6
Medium Priority
?
198 Views
Last Modified: 2010-04-16
I posted this question not too long ago, but closed it because I thought I understood the answer.  I'm still missing something, so I'm re-asking it & have listed below what I've done.

Here's the script called logon.bat
echo %COMPUTERNAME%,%USERNAME%,%DATE%,%TIME% >> \\server\path\folder\\UserLogon.csv

I clicked on it from my desktop & from the server twice & got this csv file
server name                           myname      Tue 04/03/2007      5:31 PM
server name            myname      Tue 04/03/2007      5:32 PM
server name            Administrator      Wed 04/04/2007      10:06 AM
server name            Administrator      Wed 04/04/2007      10:07 AM

My question is getting this to run automatically.  I went to grp policy -> win settings -> scripts.  In the logon script, I added the logon.bat file.  Then I logged off, logged back on, & looked at the csv file.  My thinking is that it would run automatically (not needing to double click) but I didn't see a new line in the csv file.  Can someone help further?  I also need this for all users & it looks like it's only logging per machine???
0
Comment
Question by:TinaSC
[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
  • 3
6 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18850905
Are you in a domain?
You'd need to do this for logon scripts on your domain controller.

Otherwise, use scheduled tasks, if it's a single machine:

Start->Run->CMD /c schtasks /create /ru system /sc onlogon /tn logon /tr "c:\logon.bat" <Enter>

(change the location of logon.bat as needed).
0
 

Author Comment

by:TinaSC
ID: 18850931
I am in a domain.  I realize this may be an overly simplistic question, but bear with me.... Where in the domain controller do I put it?
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 1000 total points
ID: 18850974
Open up ADUC (Active Directory Users and Computers) - right-click the domain name and choose properties.  You can then modify your default domain policy (or create a new one) and modify the same path (user config \windows settings\scripts\logon)
0
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!

 

Author Comment

by:TinaSC
ID: 18851203
Thanks sirbounty... easy enough.  I figure I'm not doing too bad since I had never even seen Windows Server until 6 months ago & didn't know there was such a thing as a logon script until a few weeks ago!!!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18851235
Wow - that's impressive. :^)

Thanx for the grade!
0
 

Author Comment

by:TinaSC
ID: 18854629
I know I closed this question, so I really hope you'll see this sirbounty.  The script worked, but only for my username?  It's in the logon/off scripts in the AD, but it's only showing my activity in the csv file.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

719 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