Home Configuration Manager

Slow PowerShell Processing - 5+minutes for Computer association

Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
Looking for recommendations on what one would look at.
We are currently replacing our desktop fleet 20K+ and using a powershell script to make the associations between the old and new computers.
As we progress the script we are running is taking longer and longer to run. 

Specificly on this line of code

New-CMComputerAssociation -SourceComputer $OldSystemName -DestinationComputer $ReplacementSystemName

Suggestions/Recommedations

Thanks

Comments

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Is there any reason you couldn't place this inside of a PowerShell workflow, and then take advantage of the "foreach -parallel" so as to get this happen...well in parallel...instead of what I'll assume is a sequential execution?
  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
    We are running a Powershell workflow and everything is sequential as parallel will not access variables. 
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    I think you may be hitting a common snag with workflow and that's the $Using: variable. In the following example, I created a variable and assigned it the value of your name. To then use that variable in an inline script (where you're probably currently running the New-CMComputerAssociation) I now reference the previously defined variable in the Workflow as $Using:variable1 within the inline script.

    This is how you can reference/pull values from the Workflow into the InlineScript.

    workflow myWorkflow
    {
        $variable1 = "brian_wiest"
    
        inlinescript
        {
            write-output $Using:variable1
        }
    }
  • wally_meadwally_mead Member Advanced IT Monkey ✭✭✭
    Thanks for the thoughts on this Adam. This is out of my real of knowledge (not a PowerShell guy at all).

    Brian, did this help out? If so, please to mark it as answered so others will know the answer if they need it for their own scenarios.
  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
    To follow up Managment opened a case with Microsft. Microsoft support acknowledge a "offset" of the powerschell commend vs the csv import is that when running the commend it will check every entry of the User State Migration table Source computer and again for Destination computer before creating the new record. 
    So when we tested the script everything worked fine 
    But now at 2k of 20K workstation migrations the script is taking longer and longer. 
    As a stop gap we are deleting completed migrations but MS is still reviewing with their team. 
    So most likly if we cannot get the speed up we will move to a manual csv import rather then the workflow
  • wally_meadwally_mead Member Advanced IT Monkey ✭✭✭
    Sounds like it is a Microsoft issue, sorry to hear that. Hopefully they can come up with a solution that works for you.
Sign In or Register to comment.