Testing Variables

Using the Test-EmdbVariable cmdlet, you can achieve three different thing: first you can test for the existence of Variables, second you can test, it a Variable is set anywhere in the ODS (if applicable to a dedicated value) or third you can test, if a Variable has a desired value for a given target. The result is always true, it the test succeeds or false, if it fails.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


The first example tests, if a Variable "Age" exists in a Variable-Group "Userdata" that is valid for User-objects:


Test-EmdbVariable "Age" -Group "Userdata" -RestrictScope "User"


The next test checks, if this Variable is set to a value of 42 anywhere in the ODS. The Assignments-switch can be used for this:


Test-EmdbVariable "Age" -Assignments -Value "42"


Finally we test, if the Variable is set (to any value) for the target-object "Adam Sam"...


Test-EmdbVariable "Age" -Target "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Adam Sam"


...or rather to a well defined value:


$MyUser = Get-EmdbUser "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Adam Sam"

Test-EmdbVariable "Age" -Target $MyUser -Value "42"


Note: Note that Variables are not part of the context rootDSE and therefore they can be referenced without a full qualified path resp. an absolute path.