< Back

Get-DbaWindowsLog

Mon Jan 13, 2020 11:50 am

NAME Get-DbaWindowsLog



SYNOPSIS

Gets Windows Application events associated with an instance





SYNTAX

Get-DbaWindowsLog [[-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>] [[-Start]

<Datetime>] [[-End] <Datetime>] [[-Credential] <Pscredential>] [[-MaxThreads] <Int>] [[-MaxRemoteThreads] <Int>]

[-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Gets Windows Application events associated with an instance





PARAMETERS

-Credential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-End [<Datetime>]

Default: Now

Retrieve all events that happened before this timestamp



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-MaxRemoteThreads [<Int>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-MaxThreads [<Int>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

The instance(s) to retrieve the event logs from



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Start [<Datetime>]

Default: 1970

Retrieve all events starting from this timestamp.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: Logging

Author: Drew Furgiuele | Friedrich Weinmann (@FredWeinmann)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- 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



RELATED LINKS

https://dbatools.io/Get-DbaWindowsLog