Looking for a PowerShelly way to set multiple values simultaneously on a multivalue ARS virtual attribute

I've eliminated the wrong ways to do this ... now seeking advice on using set-qadcomputer  to apply a row/array of values to an ARS virtual attribute

Tried this:

$strVaValue = "'value1' ; 'value2' ; 'value3'"
$arSession = connect-qadservice -service <host> -proxy

Set-QADComputer -Connection $ARSession -Identity $objComputer.DN -ObjectAttributes @{edsvaVirtualAttributeName=@{Append=@($strVaValue)}}

I ended up with one entry in the multivalue attribute with the value "'value1' ; 'value2' ; 'value3'"
not usefule, and each of the entries should be an element

Parents
  • You are most of the way there...

    $strVaValue = @('value1' , 'value2' , 'value3')


    $arSession = connect-qadservice -service <host> -proxy

    foreach ($strVaValueItem in $strVaValue)

    {

    Set-QADComputer -Connection $ARSession -Identity $objComputer.DN -ObjectAttributes @{edsvaVirtualAttributeName=@{Append=@($strVaValueItem)}}

    } # End of looping through $strVaValue list

  • Thanks for that JohnnyQ … that saved me from a self inflicted wound today ; )

    from your example - the $strVaValue is set as an array - DOH! … it's not a string anymore.

    I totally forgot about that collection of values - being an array inside the va.

    so,  set my string value as an array and used the whole array inside objectAttributes .. and it worked! - in one pass without iteration … saving room in my change history database to boot.

    Remembered - for the next time I fat finger my command line.

    $myArray = @('value1','value2','value3')
    Set-QADComputer -Connection $ARSession -Identity $objComputer.DN -objectAttributes @{edsvaVirtualAttribueName=@{Update=@($($myArray))}}

    I used update here rather than append, because I wanted to erase the junk I had previously sent.

Reply
  • Thanks for that JohnnyQ … that saved me from a self inflicted wound today ; )

    from your example - the $strVaValue is set as an array - DOH! … it's not a string anymore.

    I totally forgot about that collection of values - being an array inside the va.

    so,  set my string value as an array and used the whole array inside objectAttributes .. and it worked! - in one pass without iteration … saving room in my change history database to boot.

    Remembered - for the next time I fat finger my command line.

    $myArray = @('value1','value2','value3')
    Set-QADComputer -Connection $ARSession -Identity $objComputer.DN -objectAttributes @{edsvaVirtualAttribueName=@{Update=@($($myArray))}}

    I used update here rather than append, because I wanted to erase the junk I had previously sent.

Children