2 Replies Latest reply on Oct 13, 2008 9:12 AM by bkolaske

    Script to update custom attribute

    bkolaske Novice

       

      I am currently trying to create a script that will get the whencreated date from AD and then populate a custom attribute (called BuildDate) with the information.  If I try to run the script below i get "Value is a read only property".  If I look at the values without trying to set them I can see the information.  Any assistance would be appreciated.

       

       

       

       

       

       

       

       

      $vm = Get-VM -Name vmname

       

       

      $cdate = Get-QADComputer -Name $vm

       

       

      foreach ($field in $vm.CustomFields)

       

       

      {

       

       

      if ($field.Key -eq "BuildDate")

       

       

      {$field.Value =  $cdate.whencreated

       

       

      }

       

       

      }