July 24, 2019 at 8:00 am
Hello everyone ,
I would like to transfer job sql lists through dbatools through the Copy-DbaAgentJob command
only I want to exclude a list of jobs
the lists is a long
thank you for your help
$Source = 'production\REF '
$Destination = 'localhost'
$SharedPath = '\\production\migration'
Copy-DbaDatabase -Source $Source -Destination $Destination -Database exploit -BackupRestore -SharedPath $SharedPath -force
Copy-DbaLinkedServer -Source FRSADV005\COMPTOIR -Destination localhost -Force
Copy-DbaLogin -Source FRSADV005\COMPTOIR -Destination localhost -Force
Copy-DbaDbMail -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentOperator -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentAlert -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentJob -Source FRSADV005\COMPTOIR -Destination localhost -ExcludeJob 'ExtranetDossierEntite_Delete' , 'ExtranetDossierEntite_Delete' ,
'update_stats' , 'transfert_job_sql' , 'alerte_test_operation', 'test_transfert_operation '
July 25, 2019 at 8:10 am
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
July 25, 2019 at 8:39 am
What's the problem? Does Copy-DbaAgentJob error out on your list?
July 25, 2019 at 10:35 am
I would like to put all jobs in a list and make a call to a single variable
$Source = 'frsadv007\referentiel'
$Destination = 'localhost'
$SharedPath = '\\FRSADV005\migration'
$job = @{
'BASELINE_CaptureConfigData',
'ExtranetDossierEntite_Delete'
'update_stats' ,
'transfert_job_sql' ,
'alerte_test_operation'
'test_transfert_operation'
}
Copy-DbaDatabase -Source $Source -Destination $Destination -Database exploit -BackupRestore -SharedPath $SharedPath -force
Copy-DbaLinkedServer -Source FRSADV005\COMPTOIR -Destination localhost -Force
Copy-DbaLogin -Source FRSADV005\COMPTOIR -Destination localhost -Force
Copy-DbaDbMail -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentOperator -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentAlert -Source FRSADV005\COMPTOIR -Destination localhost
Copy-DbaAgentJob -Source FRSADV005\COMPTOIR -Destination localhost -ExcludeJob $job
July 25, 2019 at 1:23 pm
write to the people that created DBATools and ask them. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
July 25, 2019 at 4:28 pm
You are not defining the array of jobs properly. You need to replace the curly braces with parenthesis.
$job = @(
'BASELINE_CaptureConfigData',
'ExtranetDossierEntite_Delete'
'update_stats' ,
'transfert_job_sql' ,
'alerte_test_operation'
'test_transfert_operation'
)
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply