Created
November 13, 2015 22:31
-
-
Save crshnbrn66/33bd287a8f9cf84ea1bb to your computer and use it in GitHub Desktop.
Get the last time app pool was Restarted.
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
function get-webApppoolstatus($pool) | |
{ | |
$poolReturn = @() | |
$poolStatus = gwmi win32_process -filter "Name like '%w3wp%'" | select name, Processid, commandline, creationdate | |
#$poolstatus.converttodatetime($poolStatus.creationdate) | |
foreach($status in $poolStatus) | |
{ | |
if(($status.commandline) -like "*$pool*" -and ($pool -ne $null)) | |
{ | |
$status.creationdate = [System.Management.ManagementDateTimeConverter]::ToDateTime($status.creationdate) | |
$poolReturn = $status | |
} | |
elseif($pool -eq $null) | |
{ | |
$status.creationdate = [System.Management.ManagementDateTimeConverter]::ToDateTime($status.creationdate) | |
$poolReturn += $status | |
} | |
} | |
return $poolReturn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment