When I run the below script it does install Web Platform Installer and does install URLReWrite. But it end it terminates with error.
configuration SetupVm
{
node ("localhost")
{
Package WebPi_Installation
{
Ensure = "Present"
Name = "Microsoft Web Platform Installer 5.0"
Path = Join-Path $PSScriptRoot WebPlatformInstaller_amd64_en-US.msi
ProductId = '4D84C195-86F0-4B34-8FDE-4A17EB41306A'
Arguments = ''
DependsOn = @("[WindowsFeature]IISMgmtConsole")
}
Package UrlRewrite
{
Ensure = "Present"
Name = "URL Rewrite 2.0"
Path = "C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe"
ProductId = ''
Arguments = "/install /products:UrlRewrite2 /AcceptEula"
DependsOn = @("[Package]WebPi_Installation")
}
}
}
SetupVm
Start-DscConfiguration -Path .\SetupVm -Wait -Verbose -Force
Validate-StandardArguments, Path was C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] The path extension was .exe VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] Ensure is Present VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] product is VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] product as boolean is False VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] The package URL Rewrite 2.0 is not installed VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] Validate-StandardArguments, Path was C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] The path extension was .exe VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] Package configuration starting VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] The binary is an EXE
VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] Starting C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe with /install /products:UrlRewrite2 /AcceptEula
VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] Starting process C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe with arguments /install /products:UrlRewrite2 /AcceptEula
VERBOSE: [tktestdsc4]: [[Package]UrlRewrite] The machine requires a reboot VERBOSE: [tktestdsc4]: LCM: [ End Set ] [[Package]UrlRewrite] in 55.5920 seconds.
PowerShell DSC resource MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: Package from
C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd-x64.exe was installed, but the specified ProductId and/or Name does not
match package details
CategoryInfo : InvalidOperation: (:) [], CimException
FullyQualifiedErrorId : ProviderOperationExecutionFailure
PSComputerName : localhost
The SendConfigurationApply function did not succeed.
CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
FullyQualifiedErrorId : MI RESULT 1
PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 70.57 seconds
you didn't specify the productId, so it tries to verify the package is installed using the productId and fails (obviously).
If the product doesn't have the productId you can install it using script extension, if it has, add productId to the URL Rewrite
resource