Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Cannot use WindowsPackageCab without specifying a LogPath #109

@p0w3rsh3ll

Description

@p0w3rsh3ll

Steps to reproduce

I'm trying to install/uninstall a package and did not specify a logpath

Configuration Disable-NetFx3 {
Param(
    [string]$NodeName = 'localhost'
)
    Import-DscResource -ModuleName 'PSDscResources'
    Node $NodeName
    {
        WindowsPackageCab 'NetFx3'
        {
            Name = 'Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~~10.0.16299.15'
            Ensure = 'Absent'
            SourcePath = 'c:\mount\sources\sxs\microsoft-windows-netfx3-ondemand-package.cab'
            # LogPath = 'C:\dism.log'
        }
    }
}

if (-not(test-path -Path  C:\DSC -PathType Container)) {
    $null = mkdir  C:\DSC
}
Disable-NetFx3 -OutputPath  C:\DSC -Verbose
Start-DscConfiguration -Path  C:\DSC -ComputerName localhost -Verbose -Force -Wait

Configuration Enable-NetFx3 {
Param(
    [string]$NodeName = 'localhost'
)
    Import-DscResource -ModuleName 'PSDscResources'
    Node $NodeName
    {
        WindowsPackageCab 'NetFx3'
        {
            Name = 'Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~~10.0.16299.15'
            Ensure = 'Present'
            SourcePath = 'c:\mount\sources\sxs\microsoft-windows-netfx3-ondemand-package.cab'
            # LogPath = 'C:\dism.log'

        }
    }
}
Enable-NetFx3 -OutputPath  C:\DSC -Verbose
Start-DscConfiguration -Path  C:\DSC -ComputerName localhost -Verbose -Force -Wait

The above configurations work if I uncomment the logpath and use the one specified (c:\dism.log).

Expected behavior

I should be able to install/uninstall without specifying a logpath.
It's not a mandatory parameter and its help descriptions says:

There is no default value, but if not set, the log will appear at %WINDIR%\Logs\Dism\dism.log.

Actual behavior

If the Set-TargetResource is invoked, it throws:

VERBOSE: [mycomputer]: LCM:  [ End    Set      ]  [[WindowsPackageCab]NetFx3]  in 0.0630 seconds.
PowerShell DSC resource MSFT_WindowsPackageCab  failed to execute Set-TargetResource functionality with error message: DismInitialize failed. Error code = 0x80070057 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost

Environment data

> $PSVersionTable
Name                           Value                                                                                                                                     
----                           -----                                                                                                                                     
PSVersion                      5.1.16299.492                                                                                                                             
PSEdition                      Desktop                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                   
BuildVersion                   10.0.16299.492                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                           
WSManStackVersion              3.0                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                       
SerializationVersion           1.1.0.1   

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue is an enhancement request.in progressThe issue is being actively worked on by someone.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions