Share via

Configuration Manager (Current Branch) – Powershell "Start-Job"

Barleyologist 116 Reputation points
2020-08-30T23:40:18.497+00:00

I would like to start PS Job using a CM cmdlet but I am unable to get it to work. I am trying to remove drivers from a driver package and start-job would work great but it never processes the command and not sure why. I am using the [Remove-CMDriverFromDriverPackage] command and feeding in the drivers like this;

Start-Job -InputObject $Drivers -ScriptBlock {Remove-CMDriverFromDriverPackage -DriverId $Input.CI_ID -DriverPackageName "ABC Driver Package" -Force}

Unfortunately it completes without error and the driver is not removed... The command by itself works fine so i know that is not the problem. I have tried added a working directory as maybe it's not starting in the ConfigMgr Directory?

Start-Job -InputObject $Drivers -ScriptBlock {Remove-CMDriverFromDriverPackage -DriverId $Input.CI_ID -DriverPackageName "ABC Driver Package" -Force} -WorkingDirectory "ABC:\"

... and nothing. Start-Job works great for all other commands just not ConfigMgr commands. I figure I am missing something so any help is appreciated.

PS: As a side note the "technet.microsoft.com" forums are being moved over here and I cannot locate the ConfigMgr section nor does the tags allow me to choose ConfigMgr or a powershell the is logical.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author

Anonymous
2020-08-31T08:46:55.907+00:00

Hi
You could try verifying if PowerShell works with the current Configuration Manager using Get-CMSite cmdlet. This cmdlet returns information about the Configuration Manager site you're currently connected to and any child sites.
If it comes back with errors, try Import the Configuration Manager PowerShell module

Reference: Get started with Configuration Manager cmdlets

I hope this information above can help you.

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Barleyologist 116 Reputation points
    2020-09-23T20:46:25.097+00:00

    I am looking at the possible solution that DaleKudusi-MSFT posted, I have not gotten it to work yet but I believe it on the right track, just need to figure out the syntax.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.