我正在尝试通过 DSC 安装 SqlServer,但我一直遇到此错误
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'
+ ~~~~~~~~
我的 DSC 配置片段如下所示
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
我非常肯定 SqlServer 已安装在远程服务器中。
- Get-DscResource -Module SqlServerDsc 返回资源列表
- 并且该文件夹存在于 C:\Program Files\WindowsPowerShell\Modules\SqlServerDsc
非常感谢任何反馈/建议。非常感谢您的参与。