I have a fresh new Win 2K12 R2, with Feb 2015 preview installed and downloaded “DSC Resourc Kit Wave 10 182015.zip”, AllResources directory put under C:\Program Files\WindowsPowerShell\Modules
I copied the example configuration provided to set up a new IIS website. 1st of all, I get a quiugly broken redline on xWebsite, indicating "Undefined DSC resource ‘xWebsite’. Use Import-DSCResource to import the resource.
“Import-DscResource -Module xWebAdministration” is declared in the begining of the script, when I run the script I get
“The term 'Import-DscResource is not recognized as the name of a cmdlet…”
I searched this site, followed, what I was able to understand that fix KB2883200 is is “InstalledOn = 3/24/2015”, yesterday.
Issuing Get-Dsecresource, I can see clearly 2 modules, “xWebApplication and xWebVirtualDirectory”.
Also, I discovered that Import-DscResource is not recognized neither on the commandline nor in the help in ISE
Import-DscResource is actually a dynamic keyword which is only available inside a configuration function. That makes it not terribly discoverable, unfortunately, but it’s what we’ve got. If you write an empty configuration and then type Import-DscResource, though, you’ll get intellisense / tab completion for its parameters (-ModuleName and -Name)
Out of curiosity, have you tried doing this with WMF4.0? WMF5.0 is very very very beta, and it’d be nice to know if you have the same problems with the current production-level code.
Yes, Dave, I get the intellisense in ISE, but still have the red broken squigly line on the lines where there is xWebsite and when running the script it errors right away as follows £
}
At line:44 char:9
xWebsite DefaultSite
~~~~~~~~
Undefined DSC resource ‘xWebsite’. Use Import-DSCResource to import the resource.
At line:65 char:9
xWebsite NewWebsite
~~~~~~~~
Undefined DSC resource ‘xWebsite’. Use Import-DSCResource to import the resource.
+ CategoryInfo : ParserError: ( , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ResourceNotDefined
No Don, As I said, it is a lab that I created yesterday with 3 fresh VMs all win2k12R2 abd went with the Feb 2015 version
Are you suggesting desinstalling the WMF 5 preview, install the version 4?
With that setup, as long as your xWebAdministration module is somewhere on the machine PSModulePath (typically in C:\Program Files\WindowsPowerShell\Modules), you should be all set.
Nevermind. This is their TechNet gallery publishing problem again. The last few revisions of the DSC resource kit have been missing resources from the zip file for some reason, and I guess they haven’t got it sorted out yet. Just delete the whole xWebAdministration module from your computer.
If you’re running the PowerShell 5.0 preview, you can run this command instead to get the module (which has all of the intended DSC resources). You’ll need to be running PowerShell with the “Run As Administrator” option for this command to work:
So many thanks Dave, appreicate your help, it is working like a charm now., one thing to correct for anybody who lands here, we need to add the -Name switch for the command
Install-Module -Name xWebAdministration -Force
Otherwise it does not work.
Tell me, should I do this process for all the other resources?
Couldn’t hurt. I’d be very surprised if this is the only module in that zip file that is missing resources, and if you intend to use them, you may as well make sure you have all of the bits.