IN : MachineName
# Return all events about shutdown # # http://gallery.technet.microsoft.com/scriptcenter/496332b0-0e2d-4875-bcae-db8384512812 function Get-ShutdownReason { #Requires -Version 2.0 [CmdletBinding()] Param ( [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$false)] [Array]$Computer, [Int]$Count = 4 )#End Param Begin { Write-Host "`n Checking logs . . . " $i = 0 }#Begin Process { $Computer | % { Get-EventLog -ComputerName $_ -LogName system -Source USER32 -Newest $Count | select TimeWritten, Username, Message # | fl } }#Process End { }#End } Get-ShutdownReason $args[0]
Aucun commentaire:
Enregistrer un commentaire