Stopping/Starting SCSM Data warehouse Jobs with Orchestrator

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:\PowershellModules\Service Manager\Powershell\System.Center.Service.Manager.psd1”

$SMDWModule
=
“C:\PowershellModules\Service Manager\Microsoft.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:\PowershellModules\Service Manager\Powershell\System.Center.Service.Manager.psd1”

$SMDWModule
=
“C:\PowershellModules\Service Manager\Microsoft.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

}

Advertisements
This entry was posted in Powershell, SCO, SCORCH, SCSM and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s