无法加载SystemLocaleDsc模块

时间:2018-09-24 03:32:31

标签: powershell dsc

我刚刚导入了SystemLocaleDsc模块,它报告了如下错误

[PowerShell]找不到模块'SystemLocaleDsc'

注意,我已经导入了PSCDesiredStateConfiguration模块,而当我尝试导入SystemLocaleDsc模块时,遇到了上面提到的错误。

PowerShell脚本中的代码段如下:

configuration EnableIISFeature
{
  Import-DSCResource -ModuleName PsDesiredStateConfiguration
  Import-Dscresource -ModuleName SystemLocale
    node localhost
    {
        WindowsFeature IIS 
        {
            Ensure = "Present"
            Name   = "Web-Server"
        }

        SystemLocale SystemLocaleExample
        {
            IsSingleInstance = 'Yes'
            SystemLocale     = 'en-AU'
        }

    }
}

“ Import-Dscresource -ModuleName SystemLocale”行显示为红色,并显示错误 [PowerShell]找不到模块'SystemLocaleDsc'

请协助

谢谢。

P.S: 不确定要查找什么,但这是Get-DscResource的输出

PS C:\ Windows \ system32> Get-DscResource

ImplementedAs   Name                      ModuleName                     Version    Properties
-------------   ----                      ----------                     -------    ----------
Binary          File                                                                {DestinationPath, Attributes, Checksum, Conten...
Binary          SignatureValidation                                                 {SignedItemType, TrustedStorePath}
PowerShell      PackageManagement         PackageManagement              1.0.0.1    {Name, AdditionalParameters, DependsOn, Ensure...
PowerShell      PackageManagementSource   PackageManagement              1.0.0.1    {Name, ProviderName, SourceUri, DependsOn...}
PowerShell      Archive                   PSDesiredStateConfiguration    1.1        {Destination, Path, Checksum, Credential...}
PowerShell      Environment               PSDesiredStateConfiguration    1.1        {Name, DependsOn, Ensure, Path...}
PowerShell      Group                     PSDesiredStateConfiguration    1.1        {GroupName, Credential, DependsOn, Description...
Composite       GroupSet                  PSDesiredStateConfiguration    1.1        {DependsOn, PsDscRunAsCredential, GroupName, E...
Binary          Log                       PSDesiredStateConfiguration    1.1        {Message, DependsOn, PsDscRunAsCredential}
PowerShell      Package                   PSDesiredStateConfiguration    1.1        {Name, Path, ProductId, Arguments...}
Composite       ProcessSet                PSDesiredStateConfiguration    1.1        {DependsOn, PsDscRunAsCredential, Path, Creden...
PowerShell      Registry                  PSDesiredStateConfiguration    1.1        {Key, ValueName, DependsOn, Ensure...}
PowerShell      Script                    PSDesiredStateConfiguration    1.1        {GetScript, SetScript, TestScript, Credential...}
PowerShell      Service                   PSDesiredStateConfiguration    1.1        {Name, BuiltInAccount, Credential, Dependencie...
Composite       ServiceSet                PSDesiredStateConfiguration    1.1        {DependsOn, PsDscRunAsCredential, Name, Startu...
PowerShell      User                      PSDesiredStateConfiguration    1.1        {UserName, DependsOn, Description, Disabled...}
PowerShell      WaitForAll                PSDesiredStateConfiguration    1.1        {NodeName, ResourceName, DependsOn, PsDscRunAs...
PowerShell      WaitForAny                PSDesiredStateConfiguration    1.1        {NodeName, ResourceName, DependsOn, PsDscRunAs...
PowerShell      WaitForSome               PSDesiredStateConfiguration    1.1        {NodeCount, NodeName, ResourceName, DependsOn...}
PowerShell      WindowsFeature            PSDesiredStateConfiguration    1.1        {Name, Credential, DependsOn, Ensure...}
Composite       WindowsFeatureSet         PSDesiredStateConfiguration    1.1        {DependsOn, PsDscRunAsCredential, Name, Ensure...
PowerShell      WindowsOptionalFeature    PSDesiredStateConfiguration    1.1        {Name, DependsOn, Ensure, LogLevel...}
Composite       WindowsOptionalFeatureSet PSDesiredStateConfiguration    1.1        {DependsOn, PsDscRunAsCredential, Name, Ensure...
PowerShell      WindowsPackageCab         PSDesiredStateConfiguration    1.1        {Ensure, Name, SourcePath, DependsOn...}
PowerShell      WindowsProcess            PSDesiredStateConfiguration    1.1        {Arguments, Path, Credential, DependsOn...}

1 个答案:

答案 0 :(得分:0)

通过在Azure自动化帐户的“模块”空间中导入模块来解决问题。