none
how to merge two Get-DPMDatasource arrays? RRS feed

  • Question

  • Hi, I am trying to merge two arrays with Get-DPMDatasource from two differant DPM servers. I must run Disconnect-DPMServer between two differant DPM server, and when I run Disconnect-DPMServer the variable get emty.

    So how to merge two Get-DPMDatasource arrays?


    $DSListDPMA = Get-DPMDatasource -DPMServerName dpmA | Where-Object {($_.ObjectType -match $DPMObjectTypet) -and ($_.Protected -eq $true)}
    Disconnect-DPMServer -DPMServerName "dpmA"

    $DSListDPMB = Get-DPMDatasource -DPMServerName dpmB | Where-Object {($_.ObjectType -match $DPMObjectTypet) -and ($_.Protected -eq $true)}
    Disconnect-DPMServer -DPMServerName "dpmB"

    $DSList = $DSListDPMA + $DSListDPMB


    /SaiTech

    Tuesday, February 5, 2019 3:23 PM

All replies

  • Hello!

    Variables in PowerShell are generally meant to persist only as long as the PowerShell session itself. Have you considered other alternate sources for storing the variable?

    You could for example export the $DSListDPMA to a CSV file and then append the CSV file with the data from $DSListDPMB.

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Proposed as answer by Leon Laude Friday, February 15, 2019 9:04 AM
    Wednesday, February 6, 2019 9:33 AM