Execute changes
Execute changes
After creating new Policies or after you changed the Rollout-state of some Policy-Instances, these changes are applied during the next polling of the clients concerned. Using your DSMC you have the possibility to speed this up through selecting the task "Execute changes". This is also possible using the PowerShell-interface:
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
Since DSM 2015.1 you have the option of execution changes to a Computer object directly using a dedicated API. To execute all pending changes on computer XP99, the following PowerShell code can be used:
$MyComputer = Get-EmdbComputer "XP99" -recurse Initialize-EmdbFastInstall -Computer $MyComputer -ExecutionContext Auto -IgnoreMaintenanceWindow |
As an alternative, Computer objects have a method ExecuteChanges() that can be executed. When calling this method, you can optionally specify to ignore the maintenance window and which execution context to use:
$MyComputer = Get-EmdbComputer "XP99" -recurse $MyComputer.ExecuteChanges($true, "Auto") |
Also there is the new possibility to address single Policy-Instances and to execute them. In order to achieve this, you have to supply the Computer-object and the target Policy-Instance. The most simple way of specifying the latter is by supplying the Software-package that is assigned through the Policy-Instance. The following code shows an example for the assignment of the Software-package "Adobe Reader XI":
$MyComputer = Get-EmdbComputer "XP99" -recurse $MySoftware = Get-EmdbSoftwarePackage "Adobe Reader XI" -recurse Initialize-EmdbFastInstall -Computer $MyComputer -Software $MySoftware -ExecutionContext Auto -IgnoreMaintenanceWindow |
If you are not yet on DSM 2015.1 in your environment you have to use the steps necessary in older versions:
Note: The process described below is still valid for DSM 2015.1 or higher. |
There are some things needed: first you need the ID of the Computer-object (the system with the name "XP99" in the following example), for which you want to execute the task. Furthermore you specify the execution-context and if you want to ignore a maintenance window, if one exists. Valid entries for the execution-context property are "Auto", "User" and "Service".
$MyComputerID = $(Get-EmdbComputer "XP99" -recurse).ID $MyExecutionContext = "Auto" $IgnoreMaintenanceWindow = $True |
Now the Business Logic Server needs an object of type "FastInstallJob" for the execution of this task. There is no corresponding element in the DSMC's userinterface for this type of object and it must be created directly in the DSM environment's PowerShell drive. Therefore, the first thing you need is an object representing your emdb-drive (also having the name "emdb" in the following example) and create a new FastInstallJob-object subsequently via the NewEmdbItem-method of the drive-object
$MyEmdbDrive = Get-PSDrive "emdb" $MyFastInstallJob = $MyEmdbDrive.NewEmdbItem("FastInstallJob") |
The property-values of this FastInstallJob-object must then be set to the values defined above:
$MyFastInstallJob.BaseObject.SetPropertyValue("ComputerRelatedJob", "ComputerId", $MyComputerID) $MyFastInstallJob.BaseObject.SetPropertyValue("FastInstallJob", "ExecutionContext", $MyExecutionContext) $MyFastInstallJob.BaseObject.SetPropertyValue("FastInstallJob", "IgnoreMaintenanceWindow", $IgnoreMaintenanceWindow) |
Finally, the job must be created in order to be processed by the BLS:
$MyFastInstallJob.Create() |
Note:
- The class EmdbJob now has an additional property CreationState that can be queried – e.g. $MyFastInstallJob.CreationState | Format-List *
- This new property-structure also affects other job-types – e.g. WakeUpOnLanJob, OsdPushJob as well as several Citrix-jobs