Retrieving Software Packages

Retrieves the specified Software Package object(s).


Examples:


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


Retrieve the Software Package named "Adobe Reader 9.0" from the directory "Global Software Library\Application Library\Adobe\Adobe Reader":


Get-EmdbSoftwarePackage "emdb:\rootDSE\Global Software Library\Application Library\Adobe\Adobe Reader\Adobe Reader 9.0"


Retrieve all Software Packages from the directory "Global Software Library\Application Library\Adobe\Adobe Reader":


Get-EmdbSoftwarePackage "emdb:\rootDSE\Global Software Library\Application Library\Adobe\Adobe Reader\*"


Retrieve all Software Package from the "Global Software Library" that are of type "MSI Package":


Get-EmdbSoftwarePackage "emdb:\rootDSE\Global Software Library\*" -SchemaTag "MsiPackage" -Recurse


Retrieve the Software Package named "Adobe Reader 9.0" from the current context:


Cd "emdb:\rootDSE\Global Software Library\Application Library\Adobe\Adobe Reader"

Get-EmdbSoftwarePackage "Adobe Reader 9.0"


Retrieve the Software Package "Paint.NET 4.0.5" in the current context through its Item-ID (this ID will vary in different DSM environments):


Get-EmdbSoftwarePackage -ItemID 1983 -Recurse


Tip: the alias ID can be used instead of ItemID.


Retrieve the Software Package named "Adobe Reader 9.0" from the current context using the cmdlet Get-Item:


Cd "emdb:\rootDSE\Global Software Library\Application Library\Adobe\Adobe Reader"

Get-Item "Adobe Reader 9.0"


Retrieve all Plug-and-Play Device Driver Packages from the directory "Global Software Library\Driver Library" and subordinate directories using the cmdlet Get-Childitem:


Get-ChildItem "emdb:\rootDSE\Global Software Library\Driver Library" -Filter "(SchemaTag=PnPPackage)" -Recurse


Starting with PSX 3.1 there was a new option implemented when retrieving Software Package objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is contained in the result. If the retrieval returns more than one object, an error is raised that can be caught and handled in scripts.