DSC newbie here. The MOF file generation fails
PSDesiredStateConfiguration\Node : The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:13 char:5 + Node localhost + ~~~~ + CategoryInfo : MetadataError: (:) [PSDesiredStateConfiguration\node], ParentContainsErrorRecordException + FullyQualifiedErrorId : ArgumentIsNull,PSDesiredStateConfiguration\node Compilation errors occurred while processing configuration 'SQLConfig'.
Please review the errors reported in error stream and modify your configuration code appropriately. At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5 + throw $ErrorRecord + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (SQLConfig:String) [], InvalidOperationException + FullyQualifiedErrorId : FailToProcessConfiguration
Configuration SQLConfig {
param(
# Parameter help description
[Parameter(Mandatory =$true)][string[]]$serviceConfig,
[Parameter(Mandatory =$true)][string]$DataDrive,
[Parameter(Mandatory =$true)][string]$LogDrive
)
Import-DscResource -ModuleName SqlServerDsc
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node localhost
{
WindowsFeature Net35
{
Name = 'NET-Framework-Core'
Ensure = 'Present'
}
WindowsFeature Net45
{
Name = 'NET-Framework-45-Core'
Ensure = 'Present'
}
WindowsFeature Cluster
{
Name = 'RSAT-Clustering'
Ensure = 'Present'
}
File datadrive
{
Type = 'Directory'
DestinationPath = $DataDrive
Ensure ='Present'
}
File logdrive
{
Type = 'Directory'
DestinationPath = $LogDrive
Ensure ='Present'
}
SqlDatabaseDefaultLocation dataPath
{
InstanceName = 'MSSQLSERVER'
Path = $DataDrive
ServerName = 'localhost'
Type = 'Data'
DependsOn = '[File]datadrive'
}
SqlDatabaseDefaultLocation logPath
{
InstanceName = 'MSSQLSERVER'
Path = $LogDrive
ServerName = 'localhost'
Type = 'Log'
DependsOn = '[File]logdrive'
}
foreach ($service in $serviceConfig) {
ServiceSet $service
{
Name = $service.ServiceName
State = $service.State
StartupType = $service.StartupType
Ensure = $service.Ensure
}
}
}
}
$serviceConfig=(
@{ServiceName='MSSQLSERVER';State='Running';StartupType='Automatic';Ensure='Present'},
@{ServiceName='SQLSERVERAGENT';State='Running';StartupType='Automatic';Ensure='Present'},
@{ServiceName='SQLBrowser';State='Ignore';StartupType='Disabled';Ensure='Present'} ) SQLConfig -serviceConfig $serviceConfig -DataDrive "F:\Data"
-LogDrive "H:\Log" -OutputPath "C:\dump"