当使用Copy-DbaAgentJob dbattools cmd时,需要传递给参数Job
的内容
- 是包含要复制的作业名称的数组吗
- 是来自cmd
Get-DbaAgentJob
的实际作业数组吗?
根据Get-Help Copy-DbaAgentJob
:
Copy-DbaAgentJob
[[-Source] <DbaInstanceParameter>]
[[-SourceSqlCredential] <PSCredential>]
[-Destination] <DbaInstanceParameter[]>
[[-DestinationSqlCredential] <PSCredential>]
[[-Job] <Object[]>]
[[-ExcludeJob] <Object[]>]
[-DisableOnSource]
[-DisableOnDestination]
[-Force]
[[-InputObject] <Job[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
-Job
参数是一个对象数组,但更具体地说,Get-Help Copy-DbaAgentJob -Detailed
表示:
-Job [<System.Object[]>]
The job(s) to process. This list is auto-populated from the server.
If unspecified, all jobs will be processed.
Get-Help Copy-DbaAgentJob -Examples
提供的一个示例还显示,您可以提供来自源服务器的现有作业列表,经过过滤或其他方式:
Get-DbaAgentJob -SqlInstance sqlserver2014a |
Where-Object Category -eq "Report Server" |
Copy-DbaAgentJob -Destination sqlserver2014b