kumar
kumar

Reputation: 9417

Powershell DSC: Error while installing using DSC Script

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

Upvotes: 1

Views: 1276

Answers (2)

cdhawke1
cdhawke1

Reputation: 31

For anybody revisiting this, the solution that worked for us was to install manually using:

.\WebpiCmd-x64.exe /install /products:UrlRewrite2 /AcceptEula

and then running the following in powershell:

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize

which resulted in:

{9BCA2118-F753-4A1E-BCF3-5A820729965C} IIS URL Rewrite Module 2

We then added this productId to the dsc with the corresponding name, etc:

Package URLRewriteInstallation
{
  Ensure = "Present"
  Name = "IIS URL Rewrite Module 2"
  Path = $Node.WebPiCmdPath
  ProductId = '9BCA2118-F753-4A1E-BCF3-5A820729965C'
  Arguments = "/install /products:UrlRewrite2 /AcceptEula"
  DependsOn = @("[Package]WebPlatformInstaller", "[Script]PIProxy")
}

And the urlrewrite was installed successfully

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72191

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

Upvotes: 1

Related Questions