Re: Terminating processes owned by other users on a Terminal Serve
- From: "Alex K. Angelopoulos" <aka(at)mvps.org>
- Date: Fri, 16 May 2008 20:54:07 -0400
Well, there's not much of an issue with using the commandline per se; if it works, it works, and the ts* utilities were specifically designed to work well on a Terminal Server. However, I do find it kind of curious that this doesn't work. The TS guys will probably be able to explain why, but here's my _guess_ about it based on what I see.
I suspect it has something to do with how Terminal Services itself separates user environments securely on the same machine. WMI scripts always behave slightly differently when you're running them locally - you can't authenticate local WMI scripts using distinct credentials - so I suspect that the script simply doesn't get some privileges that it normally would. When connecting remotely to WMI it's a different ballgame.
It's possible that the script you had will work if you explicitly specify the Debug privilege for security when you call ConnectServer. I didn't even try it because I knew tskill would work and I frankly couldn't remember how to jump through all the privilege setup hoops to test it. : s
"Aaron" <Aaron@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:7B669B46-0F20-4141-B931-C2BBF1B0B48E@xxxxxxxxxxxxxxxx
Alex,
Thank you, that worked. I am still curious how I could do this without
resorting to a command line.
--Aaron
"Alex K. Angelopoulos" wrote:
Aaron,
I'm not certain why this happens - I don't recall trying to test this on a
TS in the past - but I think it may be due to some selective
compartmentalization done by the server to prevent ugly applications from
inadvertently doing such a global shutdown.
The simplest workaround, which should work fine, is to use the commandline
tskill utility instead. After your wait for them to respond, instead of
querying WMI again, simply use your WScript.Shell instance to perform a
global kill with the /A parameter, like this:
result = objShell.Run("tskill msaccess /A", 0, 1)
Important bits here:
+ result will contain the exit code from running tskill, but I'm not certain
it gives you anything useful; it's always been 1 for me.
+ Note that you use the BASE name of the application, akin to UNIX kill
commands - DO NOT use the .exe extension, because tskill implicitly adds it.
It won't find msaccess.exe
+ The /A parameter forces the app to die in all sessions.
+ the 0 parameter tells the script to spawn tskill in a hidden window; you
can change this to 1, 3, or 6 to display/maximize/minimize the window. It's
probably not important for you, I'm simply including it because I need to
for the 3rd parameter.
+ The 3rd parameter, with value 1 , tells the script to wait until tskill
finishes before returning. This ensures that the msaccess instances have
been already killed before you do anything else.
.
- References:
- Prev by Date: Re: Can't connect to remote computer.
- Next by Date: Re: Can't connect to remote computer.
- Previous by thread: Re: Terminating processes owned by other users on a Terminal Serve
- Index(es):
Relevant Pages
|