Sign in to follow this  
Followers 0
Remnant

Who is running the exe?

14 posts in this topic

Heya,

Possibly going about this backwards, but I have a compiled script on a network drive, and I wish to know which PC's/Users/whatever are currently running the executable. tried searching the forums, and the helpfile, but didn't have a lot of luck, any advice?

Share this post


Link to post
Share on other sites



I do not know if there is a solution from "inside" Autoit, but if you are interested in "dirty" system calls, you may have a look to

PSFile

http://technet.microsoft.com/de-de/sysinternals/bb897552.aspx

BTW:

runn it either with:

"/accepteula"

or create/check

HKCU/Software/Sysinternals/Pskill

RegDWord EulaAccepted=1

To skip the initial EULA (if it comes to distribution, this is maybe critical also the include)

Share this post


Link to post
Share on other sites

I do not know if there is a solution from "inside" Autoit, but if you are interested in "dirty" system calls, you may have a look to

PSFile

http://technet.microsoft.com/de-de/sysinternals/bb897552.aspx

BTW:

runn it either with:

"/accepteula"

or create/check

HKCU/Software/Sysinternals/Pskill

RegDWord EulaAccepted=1

To skip the initial EULA (if it comes to distribution, this is maybe critical also the include)

ta, but I don't think this is what I'm looking for. The executable is on a network drive, and I can't access the PC that the network drive is "local" on, if that makes sense?

I have a setup where there are 6 "public" Pc's and 1 staff PC. I have designed an executable that controls access to the public PC's, and I wanted to be able to check from the staff PC that the executable was running on all 6 public PC's The only location that all 7 PC's can access is a network drive hosted on a server that I have no physical access to.

Sounds suspiciously like this is not a possibility? which sounds suspiciously like my followup question on remotely querying the running instances of the application for current user information is not likely to be workable either ;)

Might have to back up some and re-look at my design.

Share this post


Link to post
Share on other sites

Ah, now I understand your purpose.

Your public PCs should sent some sort of PING/ALIVE message to the staff PC, correct?

So on the STAFF you are able to see that the .EXE on the public PC is running.

If you know server/Client messages that could be one way.

But it should be also possible to do this with files.

I will explain:

PC = Public Computer

SC = Staff Computer

PC1 : the EXE creates on the NETWORK Drive a file called: ALIVE_PC1.INI

PC2 : the EXE creates on the NETWORK Drive a file called: ALIVE_PC2.INI

The .EXE updates the INI every x seconds/minutes with a time stamp like

20100922_133444

ON the SC a second .EXE (called WATCHDOG or something like that) checks the NETWORKDRIVE/FOLDER for the files with the wildcard ALIVE_*.INI

Every x seconds (preferable the idle time of the remote pc doubled to get at least one change) the SC reads all INIs and compares the read value against the last turn. If the File is updated, .EXE on PC is running. If not .EXE is down or maybe a retry is needed. Followup actions like a ping to the PCx could follow (maybe network is down....)

This is just a suggestion.

Share this post


Link to post
Share on other sites

Heya,

Possibly going about this backwards, but I have a compiled script on a network drive, and I wish to know which PC's/Users/whatever are currently running the executable. tried searching the forums, and the helpfile, but didn't have a lot of luck, any advice?

Just a thought, but I've used a log file to track usage, assuming all users have access to a common folder. Have the script write the login ID to the log file when they start the app, and add a second entry when they exit.

Share this post


Link to post
Share on other sites

@VelvetElvis

More or less like my suggestion but the time update also catches the "killed" state, when there was no proper .EXE exit (All this criminal user minds may have heard about killing programs, evil stuff ...muhaha..)

I just choose a single file for each PC because so I limit the ACCESS ERROR issue because more than one writing app will need more code. And he wrote that network is the only common thing (no DB or such things).

But more or less, we both head in the same direction...

Share this post


Link to post
Share on other sites

@PsaltyDS

But does this not only trigger/set an event/log entry on the "server"/networkpc offering the share? How to query?

I'm not used to Auditing.

Does Audit allow multiple writings to a file?

Of course it may be not happen that two or more write at the same time, but possible.

Or I get it completely wrong.....(maybe if you would be so kind to explain or give links?)

Share this post


Link to post
Share on other sites

Thanks all,

@PSaltyDS: no access, no rights, no authorisation, no.... anything helpful really ;) I have a folder, and I can put sh*t in it. that's really the limit of my access to the network in general.

@Others,

yeah, I thinks files is probably the way to go. had a bit of a play today and now the exe creates (or updates) a txt file with the PC name (so each PC is using it's own, avoiding access errors) with login information. This is working..... okay, but not ideal. Currently "users" must enter an id and select a session time from a dropdown box. On login, the file updates with the id, the chosen time and a timestamp, and re-updates on logout, so one can assume that if there is no "logout time" they are still logged in (and easily work out how long they have left). Also allows me to easily query the files for utilisation statistics. Not thrilled with the idea of re-updating the file every x seconds, but need to to ensure the app hasn't been "killed" (I've made it pretty hard to do this).

@Tankbuster

"server/client messages"? this sounds like a MUCH better approach, but no, have no experience or knowledge, helpful link?

My next step(s) involve allowing the "Staff" PC to adjust the time remaining or "talk" to the public PC's by messagebox. I can see this being possible by more files, but it really doesn't seem..... tidy.

off topic: Is there a particular benefit to using ini files as opposed to text files?

Share this post


Link to post
Share on other sites

@PSaltyDS: no access, no rights, no authorisation, no.... anything helpful really

If you're not an admin, or don't at least have the cooperation of the admins, why should you be collecting data from other machines? If I caught you doing this on my network, I'd have you escorted to HR and then out of the building.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If you're not an admin, or don't at least have the cooperation of the admins,...

A little of topic, but if your admin sits somewhere in the US and you are ROW (Rest of World), and "you" have to get some things running and locally controlled, yes you are right there are processes and structures that control everything from HQ, but "we" need sometimes things running and not discussed without any understanding of need...trust me I know the attitude....

So in other words, I think it is not our "job" to control others ideas. Don't take it to personal, but freedom keeps things running - even if we talk here about control software - strange I'm caught in a Möbius strip - must control....no....I'm sorry, Dave. I'm afraid....? ;)

@Remnant

INI vs Any Other File - No , just flipping a coin....

On the Server/client, search the forum. I remember some with examples (basic) about that stuff.

Share this post


Link to post
Share on other sites

Hmmmm, I can sort of see your point here, but:

Some background:

I work for a library in New Zealand. The library is owned, operated and controlled by the local council. Most of our PC labs are operated by a system called Pharos, it manages PC access, printing, booking, statistics etc. One of our sites doesn't have access to this system because of its physical location (apparently the telecommunications network to this area is not "broad" enough to support the system integrating with the other sites. Therefore it is running alone. Previously access and stats have been managed by the staff at the centre running around with various pieces of paper, identifying you was on each PC and "asking" them to leave after a certain amount of time. Very time intensive, not terribly accurate, and brought the staff into frequent conflict with the customers. The system I'm talking about has already helped immensely but I am now attempting to add features to make it "feel" more like the Pharos system that we have working at the other sites. unfortunatley while library management (i.e. MY management) is very supportive and appeciative, the council IM department is not being helpful at all, and they control the network access. I have permission to put anything I like onto the PC's and the public network folders, but they will not give me access to anything that the staff at the centre do not already have. The reason they allow me to add anything to the PC's is that they have been "deep frozen" and the system automatically resets on log off. However by loading my app onto the network space and getting staff to open it once from each PC in the morning, I can get around this restriction.

One of the problems with large organisations (and a council is one of the largest) is that there are EPIC amounts of red tape to get through to get anything done. It took me 6 months to get the use of AutoIt approved for my own use. On of the main reasons to do this (aside from helping out the staff in this area, and proving I can) is to help get the general use of AutoIT applications approved. Have thousands (well, hundreds anyway) of uses for this for general staff, but am unable to action them. If I can demonstarte a clear benefit provided WITHOUT COST TO THE ORGANISATION it will make future uses much easier to push through.

will go away and search on server client.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I didn't read everything in the thread but here's what I can see so far:

  • You want to be able to tell which computers are on.
  • You want to do this from a central location.
  • You don't have a central location accessible to everyone.

To me, that seems like a near impossible challenge. Get a central location that everyone can access, like a cheap web host (with php/asp.net support preferably), or a ftp site accessible from the internet. Then we can continue.

Edit: After reading last post:

The problem you're trying to solve has no relation with the capabilities of the AutoIt language and as such the problem is an unfit example of the goal you're trying to reach.

Edited by Manadar

Share this post


Link to post
Share on other sites

I didn't read everything in the thread but here's what I can see so far:

  • You want to be able to tell which computers are on.
  • You want to do this from a central location.
  • You don't have a central location accessible to everyone.

To me, that seems like a near impossible challenge. Get a central location that everyone can access, like a cheap web host (with php/asp.net support preferably), or a ftp site accessible from the internet. Then we can continue.

Edit: After reading last post:

The problem you're trying to solve has no relation with the capabilities of the AutoIt language and as such the problem is an unfit example of the goal you're trying to reach.

Hmmm, Not sure that I understand completely. Firstly I wanted to determine if the PC's were running a specific exe (not whether they were turned on), secondly there is a location that all PC's can access (shared network drive). I have things working, but I'm doing everything through files, currently there are 18 text files, 3 per PC. One for stats, that records login and logout details for later repoting, one that just "updates" every 5 seconds to determine that the app is still running, and one that the Staff PC can update with messages to "send" to the public PC's. The app running on the public PC's updates the "stats" file (for it's PC name) every login and logout, it updates the "alive" file (for its PC name) every 5 seconds with a timestamp, and it checks the "msg" file every 5 seconds to see if the Staff PC is attempting to communicate with it, if there is a new entry, the public PC displays the new message in a msgbox. The app on the staff PC queries the "stats" files on request (usually once a month) to generate utilisation statistics, queries the "alive" files every 10 seconds and notifies the user of the Staff PC if the app is no longer active on a public PC, and updates the "msg" files when the staff member wants to send a message to a public PC.

Can now modify this fairly easily so the that "msg" files can be used to get the app on the public Pc's to change session time, "logout" etc, as well as just displaying messages.

So I now have a working application, but I'm convinced that there must be a better way. Going to go with what works at the moment, but I'm sure there must be a way to send messages without the troublesome files.

Thanks all for the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0