I have made this very simple DSC script. Which basically creates web application in default website.

Configuration ConfigureWebApp
{
  param ($MachineName)
  Import-DscResource -Module xWebAdministration
  Node $MachineName
  {
    xWebApplication NewWebApplication 
    { 
      Name = "MyApp"
      Website = "Default Web Site" 
      WebAppPool =  "DefaultAppPool" 
      PhysicalPath = "C:\Inetpub\wwwroot\MyApp"
      Ensure = "Present"       
    } 
  }
}

cd "C:\Dsc\scripts"
ConfigureWebApp -MachineName "WIN-KPURIN2B87H"

When I run generated MOF file, it gives me following error.

The PowerShell provider xWebAdministration does not exist at the PowerShell module path nor is it registered as a WMI provider. + CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : ModuleNameNotFound + PSComputerName : WIN-KPURIN2B87H

If I run Get-Module -ListAvailable , xWebAdministration is listed over there. I checked that $env:PSModulePath includes "C:\Program Files\WindowsPowerShell\Modules"

Odd part is, this DSC script is part of larger script which combines bunch of other DSC scripts which installs and setup IIS for this app. And they seem to run through fine.

I am using Windows Server 2012 R2. And it is not PULL or PUSH server. I am generating and running MOF file locally. Does anyone has any suggestion about what I am missing here ? I have a feeling that it has something to do about user context in which these scripts get executed, but just can't pinpoint the cause.

Including output of "tree "C:\Program Files\WindowsPowerShell\Modules\xWebAdministration" /F "

Folder PATH listing
Volume serial number is 80FD-C8E9
C:\PROGRAM FILES\WINDOWSPOWERSHELL\MODULES\XWEBADMINISTRATION
³   TechNetDocumentation-xWebAdministration.docx
³   TechNetDocumentation_xWebAdministration.html
³   xWebAdministration.psd1
³   
ÃÄÄÄDSCResources
³   ÃÄÄÄMSFT_xIisModule
³   ³       MSFT_xIisModule.psm1
³   ³       MSFT_xIisModule.schema.mof
³   ³       xIisModuleDesigner.ps1
³   ³       
³   ÃÄÄÄMSFT_xWebApplication
³   ³       MSFT_xWebApplication.psm1
³   ³       MSFT_xWebApplication.schema.mof
³   ³       
³   ÃÄÄÄMSFT_xWebAppPool
³   ³       MSFT_xWebAppPool.psm1
³   ³       MSFT_xWebAppPool.schema.mof
³   ³       
³   ÃÄÄÄMSFT_xWebConfigKeyValue
³   ³       MSFT_xWebConfigKeyValue.psm1
³   ³       MSFT_xWebConfigKeyValue.schema.mof
³   ³       
³   ÃÄÄÄMSFT_xWebDeploy
³   ³       MSFT_xWebdeploy.psm1
³   ³       MSFT_xWebdeploy.schema.mof
³   ³       
³   ÃÄÄÄMSFT_xWebsite
³   ³       MSFT_xWebsite.psm1
³   ³       MSFT_xWebsite.schema.mof
³   ³       
³   ÀÄÄÄMSFT_xWebVirtualDirectory
³           MSFT_xWebVirtualDirectory.psm1
³           MSFT_xWebVirtualDirectory.schema.mof
³           
ÀÄÄÄExamples
        BakeryWebsite.zip
        README.md
        Sample_xWebsite_ConfigurationData.psd1
        Sample_xWebsite_NewWebsite.ps1
        Sample_xWebsite_NewWebsiteFromConfigurationData.ps1
        Sample_xWebsite_RemoveDefault.ps1
0

There are 0 answers