This message was deleted.
# citrix-vad
s
This message was deleted.
j
Can't you just publish a script using taskkill.exe?
taskkill /IM badapp.exe /F should do it
c
command prompt is blocked although powershell is allowed i did quickly knock something up using pskill but it killed badapp.exe for everyone on the box
j
Surely if launched by a user it should only be able to kill processes that were started by the user?
c
yeah i was a bit surprised it did it tbh
j
You can filter taskkill by user I think
Copy code
taskkill /F /T /IM foo.exe /FI "USERNAME eq target_user"
You can use %USERNAME% as well I think, so you can target the filter to the exact user running the kill script
But I was positive that only local admins could kill other users' processes, unless I'm missing something fundamental
r
we used to publish TaskNanny for this.
c
Was probably me being stupid and running it under my account which has admin rights
r
hahaha, yeah, you don't want to do that. 😄
c
Published a batch file using the taskkill method as my standard user it just sits on this (Testing it with notepad.exe i have notepad open on my citrix session under that user context). Works fine on my admin account
I ended up using this script as i had no joy with the taskkilll command when running it as standard user . I converted the below script into a .exe with PS2exe and published it in citrix and works sweet
Copy code
# Force close the process under the user-context:
$ProcessToClose = "Notepad.exe"
$CurrentUser = $env:UserName

# Load assembly
Add-Type -AssemblyName System.Windows.Forms

Try
{
# Try to kill the process for the specific user:
$ProcessesToClose = Get-WmiObject Win32_Process -Filter "name='$ProcessToClose'" | Where-Object {$_.GetOwner().User -eq "$CurrentUser"} | Select -Expand ProcessID
$ProcessCount = $ProcessesToClose.Count
Stop-Process -Force ($ProcessesToClose)

# Display a message:
$msg = [System.Windows.Forms.Messagebox]::Show("Successfully killed $ProcessCount instance(s) of $ProcessToClose.")
}

Catch
{
# This is what you see if there is an error, or no instances of the process. 
$msg = [System.Windows.Forms.Messagebox]::Show("No instances of $ProcessToClose running.")
}