gpt4 book ai didi

powershell dsc 3.8.0.0版安装

转载 作者:行者123 更新时间:2023-12-02 23:58:35 25 4
gpt4 key购买 nike

我使用以下方法安装了新版本的 ps DSC 3.8.0.0:

Find-Module -Name xpsd* | Install-Module

我敢肯定,在我写这个问题时,我已经至少重新启动了一次电脑。
问题是旧版本 (3.7.0.0) DSC 资源智能感知一直在出现。实际上,就像从未安装过新模块一样。

我尝试使用以下方法删除较旧的 dsc 资源:
Get-DSCResource | Where-Object{$_.Version -eq '3.7.0.0'} | Remove-Item

这导致模块未删除但已损坏,因为它们被列为:
ImplementedAs   Name                      ModuleName                     Version    Properties                                        
------------- ---- ---------- ------- ----------
Binary File {DestinationPath, Attributes, Checksum, Content...

最初他们的 ImplementedAs属性值为 PowerShell ,更改为 BinaryRemove-Item 之后命令。此外,他们的 ModuleNameVersion属性在损坏之前已正确填充。

使用 $env:PSModulePath ,我能够找到 3.7.0.0文件夹,我删除了它。

尽管模块不再显示在“Get-DSCResource”检索到的列表中,但我遇到了两个问题:

1) 如何让 DSC 使用新的 3.8.0.0资源,及其对应的参数?

注意:我试过 Find-Module -Name xpsd* | Install-Module -Force这没有引起任何改善。

最佳答案

xPSDesiredStateConfiguration 是我们在图库中提供的实验模块,而 PSDesiredStateConfiguration 是盒装的。为了使用模块中的资源,您需要使用 Import-DscResource 语句导入

Import-DscResource -ModuleName xPSDesiredStateConfiguration

然后您可以使用以下资源:
xService MyService
{
}

请注意,资源名称也不同 - xPSDesiredStateConfiguration 中的资源名称前面有“x”前缀

关于powershell dsc 3.8.0.0版安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36221846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com