Reinstalling Policy-Instances

NOTE: Beginning with DSM 2015.2 this task must be carried out differently compared to prior versions. See also Alternatives for different functionality in DSM 2015.2


If you want to reinstall a Software-Package on a client-computer and you are using the DSMC, you right-click the Policy-Instance of the respective Software-Package and choose "Reinstall". In order to accomplish the same task using PowerShell, you either have to call the Policy-Instance's  Reinstall()-method or you increment the ReinstallRequestNumber-property of the Policy-Instance and write the changes back to the database.


Examples:


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


The following example retrieves the Policy-Instance for the assignment of the Software-Package "Adobe Reader 9.0" for the computer "XP99" increments the value of the Policy-Instance's property ReinstallRequestNumber and saves the changes.


$MyComputer = Get-EmdbComputer "XP99"

$MyPolicyInstance = $MyComputer | Get-EmdbPolicyInstance | Where-Object {$_.AssignedObjectName -eq "Adobe Reader 9.0"}

$MyPolicyInstance.ReinstallRequestNumber++

$MyPolicyInstance.Update()


Alternatively the same can be accomplished through calling the Reinstall()-method of the Policy-Instance:


$MyComputer = Get-EmdbComputer "XP99"

$MyPolicyInstance = $MyComputer | Get-EmdbPolicyInstance | Where-Object {$_.AssignedObjectName -eq "Adobe Reader 9.0"}

$MyPolicyInstance.Reinstall()