Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just got tasked with a particularly nasty project. I come up with what is undoubtedly a horrible way to get it done so I thought I would put the project out there and see if anyone had any insight.

The requirements are such: User-A need to be shown a list of who is running executable-A across two windows 2k3 terminal servers. User-A is not an admin and shouldn't have admin rights nor should that user have any password to an admin account.

Ouch.

So here is what I came up with. Visual Fox Pro 9 is my primary development tool. I automated a combination of PSEXEC, CMD.exe, and Tasklist.exe to get the proper list dumped to a location where I could pick up the data and display it to the user. I don't have to give the user any passwords to get the job done so that's a plus but it just has so many drawbacks its ridiculous.

So, what do you think? D.

share|improve this question
    
It sounds like you're not asking a question ... so much as looking for affirmation. :-) –  Joseph Kern Mar 30 '11 at 19:43
1  
I don't need anyone to tell me the way I'm getting that done is bad. I would like to know if anyone has a better concept though. –  Donovan Mar 30 '11 at 19:56
    
Powershell, It has great a great WMI interface. ;-) –  Joseph Kern Mar 30 '11 at 20:03
add comment

2 Answers

up vote 1 down vote accepted

Why not keep it simple and create a Scheduled Task to run every 5min for tasklist.exe (as an admin svc account) and use pipe ">" to dump it to a text file in a common directory? That way any sysadmin or developer can augment if it needs to change later due to the simplicity.

share|improve this answer
    
Hmm, interesting idea. I would like to be a bit more targeted with the execution plus be able to allow for a shorter refresh time but still. That's definitely an easier way to get the data. –  Donovan Mar 30 '11 at 23:59
    
could this help? LogonSessions by Microsoft Sysinternals? Maybe it doesn't require elevation. technet.microsoft.com/en-us/sysinternals/bb896769 –  Bret Fisher Apr 2 '11 at 20:46
add comment

Is powershell installed in your environment?

Here's an example of the data available:

Get-Process <PROCESS_NAME> | ConvertTo-HTML | Out-File C:\www\Test.html

There you go!

You want to do it on a remote machine? (Powershell v2 only, it's possible in v1 but messy)

Get-Process <PROCESS_NAME> -computername <COMPUTER_NAME> | ConvertTo-HTML | Out-File C:\www\Test.html

(BTW there is nothing wrong with the way you're doing it ...)

share|improve this answer
    
Heh, don't be so sure. To get around the limitation that I can not supply credentials to elevate the local cmd process I am using psexec to a remote server then run cmd, THEN run tasklist with admin rights to the previous server... its a mess. I'm interested in your powershell idea. I'm going to test to see if I can get user info without elevation. –  Donovan Mar 30 '11 at 23:57
    
Powershell is SO much easier for most things. Try combining the scheduled task idea from @Bret and the Powershell script. Might do the trick. –  Joseph Kern Mar 31 '11 at 4:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.