diff --git a/source/health-check/stored-procedures/dbo.usp_hcCollectErrorlogMessages.sql b/source/health-check/stored-procedures/dbo.usp_hcCollectErrorlogMessages.sql index b764a55..a4a52d3 100644 --- a/source/health-check/stored-procedures/dbo.usp_hcCollectErrorlogMessages.sql +++ b/source/health-check/stored-procedures/dbo.usp_hcCollectErrorlogMessages.sql @@ -130,6 +130,8 @@ WHILE @@FETCH_STATUS=0 FROM [health-check].[statsErrorlogDetails] eld WHERE eld.[project_id] = @projectID AND eld.[instance_id] = @instanceID + + SET @lastCollectedEventTime = ISNULL(@lastCollectedEventTime, '2021-01-01') ------------------------------------------------------------------------------------------------------------------------- /* get local time to UTC offset */ diff --git a/source/health-check/stored-procedures/dbo.usp_hcCollectOSEventLogs.sql b/source/health-check/stored-procedures/dbo.usp_hcCollectOSEventLogs.sql index 30b591f..b3a7903 100644 --- a/source/health-check/stored-procedures/dbo.usp_hcCollectOSEventLogs.sql +++ b/source/health-check/stored-procedures/dbo.usp_hcCollectOSEventLogs.sql @@ -339,8 +339,7 @@ WHILE @@FETCH_STATUS=0 #-- Create date : 20.11.2014 #-- Module : Database Analysis & Performance health-check #-- Description : read OS event logs: Application, System, Setup - #-- ============================================================================ - + #-- ============================================================================ $timeoutSeconds = ' + CAST(@configEventsTimeOutSeconds AS [nvarchar]) + N' $code = { $ErrorActionPreference = "SilentlyContinue" @@ -393,7 +392,7 @@ WHILE @@FETCH_STATUS=0 SET @strMessage=N'running powershell script - get OS events...' EXEC [dbo].[usp_logPrintMessage] @customMessage = @strMessage, @raiseErrorAsPrint = 1, @messagRootLevel = 0, @messageTreelevel = 4, @stopExecution=0 - SET @queryToRun='master.dbo.xp_cmdshell N''@PowerShell -File "' + [dbo].[ufn_getObjectQuoteName](@psFileLocation + @psFileName, 'sql') + '"''' + SET @queryToRun='master.dbo.xp_cmdshell N''@PowerShell -ExecutionPolicy Bypass -File "' + [dbo].[ufn_getObjectQuoteName](@psFileLocation + @psFileName, 'sql') + '"''' IF @debugMode=1 EXEC [dbo].[usp_logPrintMessage] @customMessage = @queryToRun, @raiseErrorAsPrint = 0, @messagRootLevel = 0, @messageTreelevel = 4, @stopExecution=0 DELETE FROM #psOutput