I’m preparing to upgrade my SCSM environment to SP1 one of the Prerequisites is to stop the SCSM DW jobs. I decided that since this is a requirement to do every six months or so and I don’t want to relearn how to use them cmdlets every time. I always forget to use the –computer parameter and the powershell cmdlet fails. This also allows me to just export the two runbooks I created out of my lab environment and into production. The scripts below will figure out what your Extract jobs are called you just need to update the server name.
Create a new runbook for stopping the DW jobs and paste the following code into a Run .net Script
$SMModule
=
“C:PowershellModulesService ManagerPowershellSystem.Center.Service.Manager.psd1”
$SMDWModule
=
“C:PowershellModulesService ManagerMicrosoft.EnterpriseManagement.Warehouse.Cmdlets.psd1”
Import-Module
-force
$SMModule
Import-Module
-force
$SMDWModule
$SCDWJobs
= @(“Transform.Common”,“Load.common”)
$SCDWMGJobs
=
Get-SCDWJob
-computer
SCSMDW01
|
where {$_.Name -match
‘Extract*’}
foreach ($SCDWMGJob
in
$SCDWMGJobs){
Disable-Scdwjobschedule
-JobName
$SCDWMGJob.Name -ComputerName
SCSMDW01
}
foreach ($SCDWJob
in
$SCDWJobs){
Disable-Scdwjobschedule
-JobName
$SCDWJob
-ComputerName
SCSMDW01
}
The Start runbook is the same concept just need to use the Enable-SCDWJobSchedule
$SMModule
=
“C:PowershellModulesService ManagerPowershellSystem.Center.Service.Manager.psd1”
$SMDWModule
=
“C:PowershellModulesService ManagerMicrosoft.EnterpriseManagement.Warehouse.Cmdlets.psd1”
Import-Module
-force
$SMModule
Import-Module
-force
$SMDWModule
$SCDWJobs
= @(“Transform.Common”,“Load.common”)
$SCDWMGJobs
=
Get-SCDWJob
-computer
SCSMDW01
|
where {$_.Name -match
‘Extract*’}
foreach ($SCDWMGJob
in
$SCDWMGJobs){
Enable-Scdwjobschedule
-JobName
$SCDWMGJob.Name -ComputerName
SCSMDW01
}
foreach ($SCDWJob
in
$SCDWJobs){
Enable-Scdwjobschedule
-JobName
$SCDWJob
-ComputerName
SCSMDW01
}