This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I properly check the virtual attribute for an null or not set value

Question:

How can I properly check the virtual attribute for an null or not set value in this script snippet?

**Note: they have this method used multiple times throughout a much larger script (ondeprovision) works when the virtual attribute has a value does NOT work when null or not set.

 

I am attempting to use an virtual attribute to control script operations. virtual attribute is called AA_TermUserComputer

Example:

#        Move user Computers when ARS attribute AA_TermUserComputer is populated E.G> PC1,laptop2
#******************************************************************************************************************
#Read in Virtual Attribute AA_TermUserComputer using $dirobj.GetInfoEx into memory

$DirObj.GetInfoEx(@("AA_TermUserComputer"), 0)
#read from memory
if (!($DirObj.Get("AA_TermUserComputer") -eq "")){
$usercomputer = $DirObj.Get("AA_TermUserComputer")

work to be done

}

 

Error from ARadminsvc  event log when the value is not set.

Exception calling "Get" with "1" argument(s): "The directory property cannot be found in the cache.

CP

 

 

Parents
  • Rather than $DirObj.Get, have you tried using Get-QADUser?

    i.e.

    $MyVAValue = $(Get-QADUser -identity $Request.GUID -proxy -includedproperties AA_TermUserComputer).AA_TermUserComputer

    ...and then check $MyVAValue for "$Null"
Reply
  • Rather than $DirObj.Get, have you tried using Get-QADUser?

    i.e.

    $MyVAValue = $(Get-QADUser -identity $Request.GUID -proxy -includedproperties AA_TermUserComputer).AA_TermUserComputer

    ...and then check $MyVAValue for "$Null"
Children
No Data