Scheduling and disabling the SCSM Active Directory connector via powershell


One of my customers noticed a console performance decrease every hour when the AD connector/s ran. So we had to come up with a plan on how to schedule the AD connector to only run during the nigth. When setting up the AD connector via the SCSM Console, there are no options on scheduling when to run.

With the SCSM Powershell commandlets comes two cmdlets that are usefull for this scenario:

  • Get-SCSMConnector
  • Set-SCSMConnector

So in the order to create a scheduled task to enable and disable the connector during the nigth, we came up with the rather simple script:

Get-SCSMConnector ^AD |Set-SCSMConnector -state:Disabled

This command disables the connector, you migth think……but unfortunately it doesn’t do it completely. So even though the connector in the UI, or via GET-SCSMConnector, has a status of disabled, it still manages to kick off every hour. We could see in the SCSM Console that the start and end time was outside the nigthly schedule

Even the Get-SCSMConnector showed the connectors to have an Enabled status of False

It turns out that the Set-SCSMConnectors doesn’t disables all the triggers in the SCSM Database and therefore the connector seems to have its own life. But after talking to Micrsoft support, they discovered that running the SET-SCSMConnectors twice, actually disables the connector completely – for sure.

So now the script to disable the AD connector will look like this:

Get-SCSMConnector ^AD |Set-SCSMConnector -state:disabled

Start-Sleep -m 10000

Get-SCSMConnector ^AD |Set-SCSMConnector -state:disabled

And the script to enable the AD Connector wiil look like this:

Get-SCSMConnector ^AD |Set-SCSMConnector -state:enabled

We then created a schedule tasks to Enable the AD Connector at 0:00 and a schedule taks to disable the AD Connector at 02:00.

If a need to run the ADconnectors occured during the day, the customer could enable the connector via the UI and start the Synchronisation manually. Alternatively run a powershell script that enables the connectors, wait at least 1 hour for the connector to run automatically, then disable the connectors via a script again.

Comments (5)

  1. Anonymous says:

    Yes, the Schedule for AD connectors are for SCSM2012 R2 set to 4AM and not the hourly Schedule as before.

    /Thomas

  2. Anonymous says:

    In Service Manager 2012R2 the Set-SCSMConnector is missing. And it seems the connector is no langer starting every hour.

  3. Anonymous says:

    Hi JJ,

    I've corrected my wrong syntax

    Thanks for the info.

    /Thomas

  4. JJ says:

    Should be Get-SCSMConnector – ALL Powershell commands are singular by design

  5. showbox dl says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.