Hi friends i have the following problem
The job syspolicy_purge_history of my database engine failed, specifically on the third step called "Erase Phantom System Health Records" that executes a powershell. This is the sentence that executes (All job syspolicy_purge_history on any SQL 2012 has the same code):
if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = '\DEFAULT'} ELSE {$a = ''};
(Get-Item SQLSERVER:\SQLPolicy\$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()
. When i see the job history i get the following:
Message
Executed as user: NT Service\SQLSERVERAGENT. The job script encountered the following errors. These errors did not stop the script: A job step received an error at line 1 in a PowerShell script. The corresponding line is 'import-module SQLPS -DisableNameChecking'.
Correct the script and reschedule the job. The error information returned by PowerShell is: 'The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory. ' A job step received an error at line 2 in
a PowerShell script. The corresponding line is '(Get-Item SQLSERVER:\SQLPolicy\SRV01236$a).EraseSystemHealthPhantomRecords()'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot find drive. A drive with the
name 'SQLSERVER' does not exist. ' A job step received an error at line 2 in a PowerShell script. The corresponding line is '(Get-Item SQLSERVER:\SQLPolicy\SRV01236$a).EraseSystemHealthPhantomRecords()'. Correct the script and reschedule the job.
The error information returned by PowerShell is: 'You cannot call a method on a null-valued expression. '. Process Exit Code -1. The step failed.
Aditionally i tested putting the policies in powershell like unrestricted (like i see on a blog). but it didn't work.
My SQL version is 2012 Standard SP1 X64
Please help me with this
Thanks for your help
Greetings
Aleds
- Edited by Aleds 19 hours 47 minutes ago