【发布时间】:2017-08-17 00:00:04
【问题描述】:
我有两台不同的 Windows Server 2012 R2 机器(建于不同时间),我想在我的 PS 脚本中检查 LCM 状态。
一个服务器从Get-DscLocalConfigurationManager 返回LCMState,另一个不返回 LCMState 或任何其他 LCM 成员。
这是由于 WMF 的旧版本造成的吗?
我查看了https://serverfault.com/questions/627386/what-version-of-windows-management-framework-is-installed,但两台服务器报告的 PSVersion 相同。
在新的工作服务器上:
PS C:\> Get-DscLocalConfigurationManager
ActionAfterReboot : ContinueConfiguration
AllowModuleOverwrite : False
CertificateID :
ConfigurationID :
ConfigurationMode : ApplyAndMonitor
ConfigurationModeFrequencyMins : 15
Credential :
DebugMode : {NONE}
DownloadManagerCustomData :
DownloadManagerName :
LCMCompatibleVersions : {1.0}
LCMState : Idle
LCMVersion : 1.0
RebootNodeIfNeeded : False
RefreshFrequencyMins : 30
RefreshMode : PUSH
PSComputerName :
PS C:\> (get-module PSDesiredStateConfiguration).Version
Major Minor Build Revision
----- ----- ----- --------
1 0 -1 -1
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.18728
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
在较旧的服务器上,LCM 成员不存在:
PS C:\> Get-DscLocalConfigurationManager
AllowModuleOverwrite : False
CertificateID :
ConfigurationID :
ConfigurationMode : ApplyAndMonitor
ConfigurationModeFrequencyMins : 30
Credential :
DownloadManagerCustomData :
DownloadManagerName :
RebootNodeIfNeeded : False
RefreshFrequencyMins : 15
RefreshMode : PUSH
PSComputerName :
PS C:\> (Get-Module PSDesiredStateConfiguration).Version
Major Minor Build Revision
----- ----- ----- --------
1 0 -1 -1
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34003
BuildVersion 6.3.9600.16394
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
如何获取旧服务器上的 LCM 状态?
【问题讨论】:
标签: powershell dsc