【发布时间】:2018-09-24 03:32:30
【问题描述】:
我刚导入 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”
请帮忙
谢谢。
附注: 不确定要查找什么,但这里是 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...}
【问题讨论】:
-
尝试
Get-DscResource并检查是否有任何错误报告。可能是类导入的问题。
标签: powershell dsc