-
Notifications
You must be signed in to change notification settings - Fork 134
xWindowsPackageCab
dscbot edited this page Nov 11, 2023
·
1 revision
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name | Key | String | The name of the package to install or uninstall. | |
Ensure | Required | String | Specifies whether the package should be installed or uninstalled. To install the package, set this property to Present. To uninstall the package, set the property to Absent. |
Present , Absent
|
SourcePath | Required | String | The path to the cab file to install or uninstall the package from. | |
LogPath | Write | String | The path to a file to log the operation to. |
Provides a mechanism to install or uninstall a package from a windows cabinet (cab) file on a target node. This resource works on Nano Server.
- Target machine must have access to the DISM PowerShell module.
- [String] Name (Key): The name of the package to install or uninstall.
- [String] Ensure (Required): Specifies whether the package should be installed or uninstalled. To install the package, set this property to Present. To uninstall the package, set the property to Absent. { Present | Absent }.
- [String] SourcePath (Required): The path to the cab file to install or uninstall the package from.
- [String] LogPath (Write): The path to a file to log the operation to. There is no default value, but if not set, the log will appear at %WINDIR%\Logs\Dism\dism.log.
#Requires -Module xPSDesiredStateConfiguration
<#
.DESCRIPTION
Installs a package from the cab file with the specified name from the
specified source path and outputs a log to the specified log path.
.PARAMETER Name
The name of the package to install.
.PARAMETER SourcePath
The path to the cab file to install the package from.
.PARAMETER LogPath
The path to a file to log the install operation to.
.NOTES
The DISM PowerShell module must be available on the target machine.
.EXAMPLE
xWindowsPackageCab_InstallPackage_Config -Name 'MyPackage' -SourcePath 'C:\MyPackage.cab' -LogPath 'C:\Log\MyPackage.log'
Compiles a configuration that installs a package named 'MyPackage' from
the path 'C:\MyPackage.cab', and logs the operation in 'C:\Log\MyPackage.log'.
#>
Configuration xWindowsPackageCab_InstallPackage_Config
{
param
(
[Parameter (Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$Name,
[Parameter (Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$SourcePath,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$LogPath
)
Import-DscResource -ModuleName xPSDesiredStateConfiguration
Node localhost
{
xWindowsPackageCab WindowsPackageCab
{
Name = $Name
Ensure = 'Present'
SourcePath = $SourcePath
LogPath = $LogPath
}
}
}