Testing Software Installation Parameters

The cmdlet Test-EmdbInstallationParameter tests both, if the Installation Parameter supplied exists or if it has the given value. Returns true, if the test succeeds or false in case of failure.


Examples:


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


The first simple example tests, if the Software Package "Foxit Reader 8.2" has any Installation Parameter defined:


$MyPackage = Get-EmdbSoftwarePackage "emdb:\rootDSE\Global Software Library\Application Library\Foxit Corporation\Foxit Reader\Foxit Reader 8.2"

Test-EmdbInstallationParameter -EmdbItem $MyPackage


The following example checks, if the OS Configuration Package "Windows 10 v1607 Enterprise" has an Installation Parameter with the name "Edition" defined:


Test-EmdbInstallationParameter -EmdbItem "emdb:\rootDSE\Global Software Library\OS Library\OS Configuration Packages\Windows 10 v1607 Enterprise" -ParameterName "Edition"


Now we check, if this Package has an Installation Parameter named "Edition" with a default value of "Enterprise":


Test-EmdbInstallationParameter -EmdbItem "emdb:\rootDSE\Global Software Library\OS Library\OS Configuration Packages\Windows 10 v1607 Enterprise" -ParameterName "Edition" -Value "Enterprise"


Finally we want to test, if the value of this Installation Parameter was changed to "Professional" at the Policy-Instance for Computer "WIN10-01". In order to achieve this, we first retrieve the Package, the Computer object of interest and the corresponding Policy-Instance and then test the current value:


$MyPackage = Get-EmdbSoftwarePackage "emdb:\rootDSE\Global Software Library\OS Library\OS Configuration Packages\Windows 10 v1607 Enterprise"

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

$MyPolicyInstance = Get-EmdbPolicyInstance -Item $MyComputer | Where-Object {$_.AssignedObjectID -eq $MyPackage.ID}

Test-EmdbInstallationParameter -EmdbItem $MyPolicyInstance -ParameterName "Edition" -Value "Professional"