0

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.

Digital ink
  • 500
  • 1
  • 10
  • 23

2 Answers2

1

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.

Bret Fisher
  • 3,973
  • 2
  • 21
  • 25
  • 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. – Digital ink Mar 30 '11 at 23:59
  • could this help? LogonSessions by Microsoft Sysinternals? Maybe it doesn't require elevation. http://technet.microsoft.com/en-us/sysinternals/bb896769 – Bret Fisher Apr 02 '11 at 20:46
0

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 ...)

Joseph Kern
  • 9,899
  • 4
  • 32
  • 56
  • 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. – Digital ink 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 04:45