xPSDesiredStateConfiguration
xPSDesiredStateConfiguration copied to clipboard
DSC resource MSFT_PackageResource failed to execute Set-TargetResource functionality with error Package from was installed, but the specified ProductId and/or Name does not match package details
DSC resource MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: Package from************************* was installed, but the specified ProductId and/or Name does not match package details
Is there a way to make ProductID not required as even after the install the DSC config status remains as failed, when we leave the product ID blank.
ProductId is a required parameter, so that must be set in the configuration for the resource configuration to be unique. Can you explain your scenario and what you are trying to install? Can you submit a configuration (obfuscate any sensitive data) and the verbose log?
@cnilak This is where the InstalledCheckRegKey, InstalledCheckRegValueName, InstalledCheckRegValueData properties are used. You will still need to provide a ProductId but this is ignored when InstalledCheckRegKey is specified; instead of checking the ProductId it checks to see whether the specified registry key is present, instead. Here is an example we use for Adobe Reader:
xPackage 'AdobeReader' {
Name = 'Adobe Acrobat Reader DC';
ProductId = '';
Path = $Path;
Arguments = '/sAll /msi /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES ENABLE_CACHE_FILES=NO ENABLE_OPTIMIZATION=NO';
ReturnCode = 0;
InstalledCheckRegKey = 'Software\Wow6432Node\Adobe\Acrobat Reader\DC\Installer';
InstalledCheckRegValueName = 'Path';
InstalledCheckRegValueData = 'C:\Program Files (x86)\Adobe\Reader DC\';
}
@iainbrighton Big thanks for commenting on this one! Appreciate it! @cnilak Did that work for you?
I labeled this as documentation and help wanted, so this is added as an example.
@johlju is there a DSC resource for Power BI reporting server? thanks!
No, not yet, see issue https://github.com/PowerShell/SqlServerDsc/issues/1309.
But if 'CreateCheckRegValue' is undefined, it wont check it and assume that resource in undesired state
Invoke-DscResource -Name xPackage -Method Test -ModuleName xPSDesiredStateConfiguration -Property $ndp -Verbose
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ResourceTest,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer RC1C-MBX1 with user sid S-1-5-21-2265690086-3410878707-11333501-1001.
VERBOSE: [RC1C-MBX1]: LCM: [ Start Test ] [[xPackage]DirectResourceAccess]
VERBOSE: [RC1C-MBX1]: [[xPackage]DirectResourceAccess] The path extension was .exe
VERBOSE: [RC1C-MBX1]: [[xPackage]DirectResourceAccess] Ensure is Present
VERBOSE: [RC1C-MBX1]: [[xPackage]DirectResourceAccess] Product installation cannot be determined
VERBOSE: [RC1C-MBX1]: [[xPackage]DirectResourceAccess] product as boolean is False
VERBOSE: [RC1C-MBX1]: [[xPackage]DirectResourceAccess] The package NDP471 is not installed
VERBOSE: [RC1C-MBX1]: LCM: [ End Test ] [[xPackage]DirectResourceAccess] False in 0.1400 seconds.
VERBOSE: [RC1C-MBX1]: LCM: [ End Set ] in 0.5470 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
InDesiredState
--------------
False
VERBOSE: Time taken for configuration job to complete is 0.702 seconds
PS C:\Windows\system32> $ndp
Name Value
---- -----
Path C:\bins\NDP471-KB4033342-x86-x64-AllOS-ENU.exe
InstalledCheckRegValueName Release
InstalledCheckRegHive LocalMachine
Ensure Present
InstalledCheckRegValueData 461310
ProductId
Name NDP471
Arguments /quiet /norestart
InstalledCheckRegKey SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
IgnoreReboot True
I have the same issue. Any news about this?