Home Asset Import

Start Manual Import Connector Powershell

Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
Is it possible to start an asset import connector that's set to be run manually with powershell? I've tried get-scsmconnector -displayname "connector name" | start-scsmconnector but this doesn't work, which I'm assuming is because the connector is set to disabled. I've tried to do the following to enable the connector but this doesn't work either:
$connector = get-scsmconnector -displayname "connector name"
$connector.enabled = $True
Update-Scsmconnector -connector $connector

The ultimate aim here is to be able to use file change notifications to monitor for changes to the csv mapped to the connector and start the import process.

Best Answers

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Answer ✓
    Thanks John, works a treat

Answers

  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭
    edited October 2016

    Try this:


    $Connector = Get-SCSMConnector -DisplayName "Connector Name"

    Set-SCSMObject $Connector.ConnectorObject -Property Enabled -Value $true

    Start-SCSMConnector $Connector

    Set-SCSMObject $Connector.ConnectorObject -Property Enabled -Value $false


    You may need to put a wait command between starting and disabling the connector.

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Leigh_Kilday said:

    Try this:


    $Connector = Get-SCSMConnector -DisplayName "Connector Name"

    Set-SCSMObject $Connector.ConnectorObject -Property Enabled -Value $true

    Start-SCSMConnector $Connector

    Set-SCSMObject $Connector.ConnectorObject -Property Enabled -Value $false


    You may need to put a wait command between starting and disabling the connector.

    Looks like the value gets set OK but the connector doesn't update or run. I'm wondering if it needs some form of schedule set within it in order to function correctly.

    If can't get this to work I'll just stick to using Orchestrator/Powershell to create the objects
  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭

    Yes, I have the same results. I've tried enabling a connector using the UI and it seemed to take a few seconds.

    I suspect either there's a follow-on action that we need to trigger, or it just takes a lot longer for the connector to enable.

    I'll test adding a sleep command after enabling the connector and post the results.

  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭

    Results are in. There's an action that doesn't get triggered when using the Set-SCSMObject $Connector.ConnectorObject -Property Enabled -Value $true command, but does when using the GUI.

    More investigation required.

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    I've been able to get things to work with the default MSFT connectors but the Asset Import connector doesn't play ball, I'm guessing due to the custom framework that was written for it
  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Answer ✓
    Thanks John, works a treat
Sign In or Register to comment.