Retrieving Policy-Instances

Policy Instances of an existing Policy can be retrieved using the method GetPolicyInstances() of a Policy object. The result of this method is a collection of Policy Instances including their compliance state.


Examples:


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


Retrieve the Policy-Instances of the Policy created in the section Creating Policies:


$MyPolicy = Get-EmdbPolicy "emdb:\rootDSE\Managed Users & Computers\solys.local\Adobe Reader 9.0 systems" | Where-Object {$_.AssignedObjectName -eq "Adobe Reader 9.0"}

$MyPolicy.GetPolicyInstances()


In the next example the Get-EmdbPolicyInstance cmdlet is used to retrieve all policy instances of the computer XP01:


$MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01"

$MyComputer | Get-EmdbPolicyInstance


Starting with PSX 3.1, Policy-Instances can also be retrieved using their ID. The following example retrieves the Policy-Instance Object with ID 43511. The context is not relevant in this case:


Get-EmdbPolicyInstance -ID 43511