小编Dam*_*anB的帖子

配置DSC资源以重新启动

我有一个DSC资源,安装dotnet功能,然后安装更新到dotnet.

在我设置的本地配置管理器RebootNodeIfNeeded$true.

安装dotnet后,它不会请求重启(甚至使用xPendingReboot模块来确认).

Configuration WebServer
{
WindowsFeature NetFramework45Core
{
    Name = "Net-Framework-45-Core"
    Ensure = "Present"
}

xPendingReboot Reboot
{
    Name = "Prior to upgrading Dotnet4.5.2"
}

cChocoPackageInstaller InstallDotNet452
{
    name = "dotnet4.5.2"
}

}
Run Code Online (Sandbox Code Playgroud)

这是一个问题,因为dotnet无法正常使用我们的应用程序,除非服务器已重新启动,我们正在尝试使这些重新启动自动发生,无需用户输入.

是否有任何方法可以将资源推送到localdscmanager(LCM),以便在安装某些内容时需要重新启动?

我找到了以下命令

 $global:DSCMachineStatus = 1 
Run Code Online (Sandbox Code Playgroud)

哪个设置重启.但我不确定如何在安装4.5模块后立即重启它.

powershell dsc powershell-5.0

6
推荐指数
2
解决办法
7907
查看次数

标签 统计

dsc ×1

powershell ×1

powershell-5.0 ×1