how to recycle application pool in server in datetime code example

Example 1: how to check iis logs for application pool recycle time

Get-WmiObject Win32_Process -Filter "name = 'w3wp.exe'" | Select-Object Name, @{"name"="ApplicationPool";expression={(($_).CommandLine).split('"')[1] }},@{"name"="Starttime";expression={$_.ConvertToDateTime($_.CreationDate)}}

Example 2: how to check iis logs for application pool recycle time

$pool = Get-IISAppPool -Name <name>

$pool.recycle()

Import-Module -Force IISAdministration

(ps -id (Get-IISAppPool -Name <name>).WorkerProcesses.ProcessId).StartTime