Powershell 如何删除拉式服务器/客户端实验室的配置?
我已将Windows Server 2012 R2虚拟机配置为拉式服务器,将Windows 10虚拟机配置为拉式客户端。服务器(也是一个域控制器)已成功设置为拉式服务器,而机器(与客户端位于同一网络下)最初与之连接,没有任何问题 我对拉式服务器有以下配置:Powershell 如何删除拉式服务器/客户端实验室的配置?,powershell,windows-10,client-server,windows-server-2012-r2,dsc,Powershell,Windows 10,Client Server,Windows Server 2012 R2,Dsc,我已将Windows Server 2012 R2虚拟机配置为拉式服务器,将Windows 10虚拟机配置为拉式客户端。服务器(也是一个域控制器)已成功设置为拉式服务器,而机器(与客户端位于同一网络下)最初与之连接,没有任何问题 我对拉式服务器有以下配置: param( [Parameter(Mandatory=$false)] [string] $NodeName = 'localhost', [Parameter(Mandatory)] [String] $Key ) Configura
param(
[Parameter(Mandatory=$false)]
[string] $NodeName = 'localhost',
[Parameter(Mandatory)]
[String] $Key
)
Configuration PullServerConfiguration
{
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $NodeName
{
LocalConfigurationManager
{
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Push'
RebootNodeifNeeded = $true
}
WindowsFeature DSCServiceFeature
{
Ensure = 'Present';
Name = 'DSC-Service'
}
xDscWebService PullServer
{
Ensure = 'Present';
EndpointName = 'PullServer';
Port = 80;
PhysicalPath = "$env:SystemDrive\inetpub\PullServer";
CertificateThumbPrint = 'AllowUnencryptedTraffic';
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules";
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration";
State = 'Started'
DependsOn = '[WindowsFeature]DSCServiceFeature'
UseSecurityBestPractices = $false
DisableSecurityBestPractices = 'SecureTLSProtocols'
}
File RegistrationKeyFile
{
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $Node.RegistrationKey
}
}
}
PullServerConfiguration
$ConfigParameters = @{
AllNodes = @(
@{
NodeName = 'localhost'
Port = 80
RegistrationKey = $Key
RebootNodeifNeeded = $true
}
)
}
以及客户端的此配置:
param
(
[Parameter(Mandatory)]
[string] $ConfigurationServerUrl,
[Parameter(Mandatory)]
[string] $ConfigurationServerKey
)
[DSCLocalConfigurationManager()]
configuration PullClientConfiguration
{
Node $NodeName
{
Settings
{
AllowModuleOverwrite = $True;
ConfigurationMode = 'ApplyAndAutoCorrect';
ConfigurationModeFrequencyMins = 60;
RefreshMode = 'Pull';
RefreshFrequencyMins = 30 ;
RebootNodeIfNeeded = $true;
}
#specifies an HTTP pull server for configurations
ConfigurationRepositoryWeb DSCConfigurationServer
{
ServerURL = $Node.ConfigServer;
RegistrationKey = $Node.ConfigServerKey;
AllowUnsecureConnection = $true;
ConfigurationNames = @("DemoConfig", "ChocoConfig")
}
#specifies an HTTP pull server for sending reports
ReportServerWeb DSCReportServer
{
ServerURL = $Node.ConfigServer;
RegistrationKey = $Node.ConfigServerKey;
AllowUnsecureConnection = $true;
}
PartialConfiguration DemoConfig
{
Description = "DemoConfig"
ConfigurationSource = @("[ConfigurationRepositoryWeb]DSCConfigurationServer")
}
PartialConfiguration ChocoConfig
{
Description = "ChocoConfig"
ConfigurationSource = @("[ConfigurationRepositoryWeb]DSCConfigurationServer")
DependsOn = "[PartialConfiguration]DemoConfig"
}
}
}
$configParams = @{
AllNodes = @(
@{
NodeName = 'localhost'
ConfigServer = $ConfigurationServerUrl
ConfigServerKey = $ConfigurationServerKey
}
)
}
PullClientConfiguration -ConfigurationData $configParams
这是一张图像,它类似于
配置已应用于客户端,但我无法再从服务器执行拉取。这是一个很难解释的问题,因为网络上类似主题的信息量非常有限。此外,这不是WMF 5.0/WMF 5.1兼容性问题,因为我在域控制器上安装了5.1.14409版,在客户端上安装了5.1.19041版。最后,我还相应地配置了IIS8.5