Created
February 15, 2017 13:26
-
-
Save billerby/fca5d560476d90d107eaf1c4a8460bb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell script to find processes that got stuck spawned by Alfresco Transformation Server and kill them.# # Get list of processes matching the name and older than x minutes where the cpu load is less than 1.50 (indicates its idle).# WINWORD idle process | |
$orphanProcs = get-process | where {($_.Name -eq "winword") -and ($_.StartTime -lt (get-date).addseconds(20))-and ($_.cpu -lt 1.50)} | |
#Check if list is Null and if not kill them all: | |
If ($orphanProcs) { | |
#display list | |
$orphanProcs | |
#kill list | |
$orphanProcs | foreach { $_.Kill() } | |
} Else { | |
echo "no processes found older than specified" | |
} | |
# WINWORD taking much more time than needed | |
$wordHangingProcess = get-process | where {($_.Name -eq "winword") -and ($_.StartTime -lt (get-date).addseconds(200))} | |
If ($wordHangingProcess) { | |
$wordHangingProcess | foreach { $_.Kill() } | |
} | |
Else { | |
echo "no wordHangingProcess found older than specified" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment