We help IT Professionals succeed at work.

calling website within a script.

hi,

i want to track from different terminal servers / desktops when users login and out.
for that we have created a website with a database.

now i need a script which opens an url to log the username/userdomain when they login.
is there a way to call a url without opening a browser. cause that url is only to put something in the database...all users are runnng on windows 2003/2008/2008 r2

regards

hans
Comment
Watch Question

Commented:
You can use WGET in the login script for the users...

http://gnuwin32.sourceforge.net/packages/wget.htm

You can find examples on the commandline here:

http://www.editcorp.com/Personal/Lars_Appel/wget/v1/wget_7.html

Please let me know if you have any questions..

Thanks,

Plisken

Author

Commented:
hi, i thought about that aswell, but i would like to not use any third oarty tools...

Commented:
Hrmmm, well, just be inventive then, but you have to think about all the things that take place..

You have startup script...

You call the website with internet explorer, but you need to do it minimized so less likely of a chance for them to close it..

:: open the logging website
start /min iexplore.exe http://path.to.website

:: wait 5 seconds to make sure it hits the site
ping 127.0.0.1 -n 5 -w 1000

:: Terminate the IE session
tskill iexplore

This should accomplish it, but I would really use WGET so that way you do not have to deal will all the IE business, not only that it is logged on the local machine and the IE sessions are not...

Please let me know if this accomplishes what you are looking for or if you have any additional questions...

Thanks,

P1isken
Commented:
Oops... Those will all have visable output in the script... Add the >NUL to the end of them and you can lead the batch script with the classic echo off..

 
@echo off

:: open the logging website
start /min iexplore.exe http://path.to.website  >NUL

:: wait 5 seconds to make sure it hits the site
ping 127.0.0.1 -n 5 -w 1000 >NUL

:: Terminate the IE session
tskill iexplore >NUL

Open in new window

erobbySenior Systems Engineer

Commented:
Don't know if you thought about this, but If you are trying to capture login information all you really need is %username%.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\logger=cmd /c echo %date% %time% - %username% >>c:\logger.txt
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer

Commented:
What is the website doing?  It sounds like it just accepts data?  Is it a Sharepoint site (or website that has WebDav enabled?) you could mount it as CIFS using NET Use if the website is Webdav, and pump a file into it from the command prompt with no worries, but that assumes you can accept a file object.

If you truly need HTTP Get & Post requests then you need to use a 3rd party utility, or write a script to automate telnet, which also requires 3rd party tools.

another option is to have them use oSQL commands if the Mircosoft OSql command line utility is acceptable, but you'll need to create a SQL User that has limited ability to write to the data table only, probably through a stored procedure to add some security to this.

A bit less intensive would be to have all of these users write to a file in their home directory, and then just have a separate process on the file server run through the files, and input all the data into a database, deleting the contents of the files in the process.

However, I would suggest, Downloading, and using The Microsoft SysInternals command "BGInfo", it can put all the info you are looking for and more into the database, though this utility is technically supposed to update the wallpaper, you can have it update with blank information from what I understand, and just log everything into the DB.

(Or if you like you can actually have it post the info on the screen as well, honestly, I can't live without it running on my user's desktops, or on my servers for myself, it makes determining whats what much easier.)

These are most of the options available to you.

-Q

Author

Commented:
thanks, we made a simple script which opens IE for a sec and closes is it again.