Assistance at your fingertips...

Gpupdate Latency Errors Lookup Script

'Check-FRSLatency-MultipleEventIDs.ps1'
'Check for DBOutofSpace errors - 13511, staging directory is full errors -13522,RPC Errors -13508, GPupdate Success, 1503 and failure, 1058'
$DCList = Get-Content -Path "d:\powershell\input\DCList.txt"
$OutputFile = "d:\powershell\reports\$day-MultipleEventIDs-GPUpdateIssueResults.csv"
#Set Credentials
. .\Set-PSCredential.ps1
# Delete the output file if it exists
if (Test-Path $OutputFile) {
    Remove-Item $OutputFile
}
#$DCList = "MyTestServer01"
foreach ($DC in $DCList) {
    # Query the event log
    $events = Get-WinEvent -Credential $PSCredential -ComputerName $DC -ErrorAction SilentlyContinue -Force -Oldest:$False -FilterHashtable @{LogName='System'; ID=1058,1503,13508,13511,13522} -MaxEvents 1 
    foreach ($event in $events) {
        $properties = @{
            TimeCreated = $event.TimeCreated
            Message     = $event.Message
            Computer    = $DC
        }

        # Create a new object with the properties and export it to the CSV file
        New-Object PSObject -Property $properties | Export-Csv -Path $OutputFile -Append -NoTypeInformation
    }
}

I cannot TELL you how hard this was to write. Holy smokes the help on this is terrible.


Posted

in

,

by