I am trying to create a script which will prepare my web server. VM is Windows Server 2016 clean installation without any adjustments and imported modules and configurations. Inside the script, I have a mix of functions and DSC configuration for installing .NET, create directories, join to the domain. At the beginning of the script, I call:
Install-PackageProvider -Name Nuget...
Install-Module xWebAdmin...
Import-Module ...
Then some functions, and DSC configurations. When I run a script, first go to DSC configuration and displaying error from the image below.
I do not know how and where in my script, first to install all necessary packages and modules and then execute rest of the script and configuration.
As I do not have installed and imported modules xWindowsUpdate, xWebAdministration, this won't execute, even if I put import-module at the beginning of the script.
Install-Module -Name xWebAdministration -Force
Install-Module -Name xWindowsUpdate -Force
Configuration IIS
{
Import-DscResource –ModuleName PSDesiredStateConfiguration, xWindowsUpdate,
xWebAdministration
Node "localhost"
{
{
Ensure = "Present"
Type = "Directory"
DestinationPath = "C:\DSCDeployment"
}
Any hint and advice?