commands

^

Get-DbaWindowsLog

Author Drew Furgiuele , Friedrich Weinmann (@FredWeinmann)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaWindowsLog on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaWindowsLog.

Synopsis

Gets Windows Application events associated with an instance

Description

Gets Windows Application events associated with an instance

Syntax

Get-DbaWindowsLog
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-Start] <DateTime>]
    [[-End] <DateTime>]
    [[-Credential] <PSCredential>]
    [[-MaxThreads] <Int32>]
    [[-MaxRemoteThreads] <Int32>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> $ErrorLogs = Get-DbaWindowsLog -SqlInstance sql01\sharepoint
PS C:\> $ErrorLogs | Where-Object ErrorNumber -eq 18456

Returns all lines in the errorlogs that have event number 18456 in them
This exists to ignore the Script Analyzer rule for Start-Runspace

Optional Parameters

-SqlInstance

The instance(s) to retrieve the event logs from

Alias
Required False
Pipeline true (ByValue)
Default Value $env:COMPUTERNAME
-Start

Default: 1970
Retrieve all events starting from this timestamp.

Alias
Required False
Pipeline false
Default Value 1/1/1970 00:00:00
-End

Default: Now
Retrieve all events that happened before this timestamp

Alias
Required False
Pipeline false
Default Value (Get-Date)
-Credential

Credential to be used to connect to the Server. Note this is a Windows credential, as this command requires we communicate with the computer and not with the SQL instance.

Alias
Required False
Pipeline false
Default Value
-MaxThreads

Default: Unlimited
The maximum number of parallel threads used on the local computer.
Given that those will mostly be waiting for the remote system, there is usually no need to limit this.

Alias
Required False
Pipeline false
Default Value 0
-MaxRemoteThreads

Default: 2
The maximum number of parallel threads that are executed on the target sql server.
These processes will cause considerable CPU load, so a low limit is advisable in most scenarios.
Any value lower than 1 disables the limit

Alias
Required False
Pipeline false
Default Value 2
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False