I am trying to install SqlServer via DSC, but I keep hitting this error
Exception calling "NewScriptBlock" with "1" argument(s): "At line:10 char:5
+ Import-DscResource -ModuleName 'SqlServerDsc'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could not find the module 'SqlServerDsc'.
At line:438 char:9
+ SqlSetup 'InstallDefaultInstance'
+ ~~~~~~~~
My DSC configuration snippet looks like this
Configuration InstallSoftware
{
param
(
$ComputerNames
)
Import-DSCResource -ModuleName PSDesiredStateConfiguration
Import-DSCResource -Module SqlServerDsc
Node $ComputerNames
{
WindowsFeature 'NetFramework45'
{
Name = 'NET-Framework-45-Core'
Ensure = 'Present'
}
SqlSetup 'SqlInstall'
{
InstanceName = 'localhost\mssql2019'
Features = 'SQLENGINE'
Action = 'Install';
SourcePath = 'C:\SQL2019'
SQLSysAdminAccounts = @('Administrators')
DependsOn = '[WindowsFeature]NetFramework45'
}
}
InstallSoftware
I am quite positive that the SqlServer has been installed in the remote server.
- Get-DscResource -Module SqlServerDsc returned the list of resources
- And the folder exists in C:\Program Files\WindowsPowerShell\Modules\SqlServerDsc
Any feedback/advice is highly appreciated. Thank you so much for your time.
Looks like this was already answered, and I'm not sure I'm following everything, but I'll typically create a wrapper function for copying resources around. Something like below with flags for specifying path, server, credential, then helper stuff like changing max envelop size (if you haven't hit this, you will) and copying out my cert. Below isn't the whole thing, but it'd at least make sure your module would copy.