Skip to content
This repository has been archived by the owner on Feb 24, 2019. It is now read-only.

Install fails to create Agent Jobs & Job Category #88

Open
lowlydba opened this issue Sep 29, 2017 · 1 comment
Open

Install fails to create Agent Jobs & Job Category #88

lowlydba opened this issue Sep 29, 2017 · 1 comment

Comments

@lowlydba
Copy link
Contributor

Do you want to request a feature or report a bug?
bug

What is the current behavior?
On installation, agent job creation fails with the message:

WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
WARNING: FAILED : To Create Agent Job Category dbareports collection jobs - Aborting - Exception setting "Parent": "Cannot convert the "[<HOSTNAME>]" value of type
"Microsoft.SqlServer.Management.Smo.Agent.JobServer" to type "Microsoft.SqlServer.Management.Smo.Agent.JobServer"."
Creating/updating alias for localhost for 32-bit
Creating/updating alias for localhost for 64-bit
You should now be able to connect to localhost as dbareports
Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\dbareports\0.9.0\functions\Get-DbrConfig.ps1:62 char:2
+     $proxy = $samplejob.JobSteps[0].ProxyName
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net

Install-DBAReports -SqlServer localhost

What is the expected behavior?
Agent jobs are created.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)
Windows 10 Enterprise 2016 LTSB 6.3 (Build 14393: ) (Hypervisor)

@lowlydba
Copy link
Contributor Author

lowlydba commented Sep 29, 2017

Some digging seems to indicate the problem is more precisely below.

The script just couldn't today.
At C:\Program Files\WindowsPowerShell\Modules\dbareports\0.9.0\functions\Add-DbrAgentJob.ps1:154 char:4
+             throw "The script just couldn't today."
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The script just couldn't today.:String) [], RuntimeException
    + FullyQualifiedErrorId : The script just couldn't today.

which is logged with

C:\Program Files\WindowsPowerShell\Modules\dbareports\0.9.0\functions\Add-DbrAgentJob.ps1
At C:\Program Files\WindowsPowerShell\Modules\dbareports\0.9.0\functions\Add-DbrAgentJob.ps1:144 char:4
+             $jobstep.Parent = $job
+             ~~~~~~~~~~~~~~~~~~~~~~
System.Management.Automation.SetValueInvocationException: Exception setting "Parent": "Cannot convert the "dbareports - Windows Server Information" value of type "Microsoft.SqlServer.Management.Smo.Agent.Job" to type "Microsoft.SqlServer.Management.Smo.Agent.Job"." ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "dbareports - Windows Server Information" value of type "Microsoft.SqlServer.Management.Smo.Agent.Job" to type "Microsoft.SqlServer.Management.Smo.Agent.Job".
   at System.Management.Automation.LanguagePrimitives.ThrowInvalidCastException(Object valueToConvert, Type resultType)
   at System.Management.Automation.LanguagePrimitives.ConvertNoConversion(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
   at CallSite.Target(Closure , CallSite , Object , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant