我目前正在build立一个实验室环境,以了解DSC可以完成什么以及在哪些限制范围内。 我们需要根据操作系统,AD组成员和包含目标的OU等标准推出一次性configuration到一组节点。 所以我开发了以下示例脚本: # Pulls computer objects from Active Directory Function Get-Nodes { Param($OperatingSystem) Get-AdComputer -Filter 'OperatingSystem -eq ${OperatingSystem}' -SearchBase "OU=SomeThing,DC=contoso,DC=com" } # Defines the configuration to apply Configuration ConfigureHostsPush { Node $Allnodes.NodeName { # This resource is not able to delete a key, only values Registry ConfigureRegistry { Ensure = "Present" Key = "HKEY_LOCAL_MACHINE\SOFTWARE\" […]
我正在使用DSC来configuration30台服务器。 它们被configuration为使用ApplyAndAutoCorrect进行拉取 。 这通常很好,但随机的,服务器将停止所有的DSC活动。 服务器从不尝试再次进行configuration。 我能解决这个问题的唯一方法就是重新configurationLocalConfigurationManager,但是这很枯燥。 有谁知道我可以如何解决这个问题? 更新 Update-DscConfiguration -Wait -Verbose按预期运行。 问题是它不会自动运行。 我正在通过查看操作事件日志来检查这一点。 Get-DscLocalConfigurationManager输出: ActionAfterReboot : ContinueConfiguration AgentId : 9F0D574A-C0F5-11E6-80CA-005056B8643D AllowModuleOverWrite : True CertificateID : ConfigurationDownloadManagers : {} ConfigurationID : 64e35e72-6f65-4f44-9b5f-915bfe9d157a ConfigurationMode : ApplyAndAutoCorrect ConfigurationModeFrequencyMins : 15 Credential : DebugMode : {NONE} DownloadManagerCustomData : {MSFT_KeyValuePair (key = "ServerUrl"), MSFT_KeyValuePair (key = "AllowUnsecureConnection")} DownloadManagerName : WebDownloadManager […]
我知道我可以通过使用以下脚本块来确保特定registry值的presens: Registry ConfigureRegistry { Ensure = "Present" Key = "HKEY_LOCAL_MACHINE\SOFTWARE\SomeKey\" ValueName = "MachineType" ValueData = "Hyper-V" } 但是我怎样才能删除registry项SomeKey ? 如果我只更改关键字Ensure = "Present"以Ensure = "Absent"它将离开键SomeKey …
我有一套Azure资源pipe理器和DSC脚本,用于将新虚拟机部署到Azure,然后使其成为新域的域控制器,这些工作很好,但现在它已经失败了DSC部分。 我相信这个问题是分配给虚拟机networking接口的别名。 我的DSC脚本具有以下部分来更改虚拟机指向它自己的DNS: xDnsServerAddress DnsServerAddress { Address = '127.0.0.1' InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } 这个问题似乎是因为虚拟机networking接口实际上是用“以太网2”或“以太网3”的别名创build的,而别名需要匹配。 虚拟机中没有其他网卡,我没有添加任何网卡。 更奇怪的是,如果我尝试将此networking接口重命名为“以太网”,则告诉我已经有一个具有该名称的networking接口,尽pipe我找不到这个名称。 因此,为了使这项工作能够正常工作,我需要找出界面不仅仅是被命名为“以太网”的原因,还是编写DSC脚本的方法,以便它可以为机器上唯一的networking接口设置DNS。 有任何想法吗。 编辑: 这似乎与设备pipe理器将NIC标记为networking适配器#2有关,但是没有适配器#1,我也不能看到在部署过程中为什么会添加任何原因。 这似乎发生在此部署中的所有虚拟机(但它只打破了DC)。 我已经包括了我用来创build下面这个的ARM脚本,从MS Github模板中直接获取它。 { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/networkInterfaces", "name": "dc-nif", "location": "[resourceGroup().location]", "dependsOn": [ "Microsoft.Network/virtualNetworks/vnet" ], "properties": { "ipConfigurations": [ { "name": "ipconfig", "properties": { "privateIPAllocationMethod": "Static", "privateIPAddress": "[variables('dnsServerPrivateIp')]", "subnet": { "id": […]
我有一个PowerShell DSC自定义资源,embedded在模块中。 完整的代码可以在这里find,如果你想看到它,但可能没有必要; 我的问题不是(我认为)在我写的代码中,而是在如何访问它。 就我而言,我正在使用DSC推送模式。 有一个正常的Powershell脚本我用来安装所需的模块,编译configuration,并启动它。 在该脚本中,我将模块的位置添加到$env:PSModulePath 。 做完之后,我可以看到模块并将其导入到我的交互式shell中,如下所示: PS> Get-Module -ListAvailable | Where-Object -Property Name -eq cWinTrialLab | Import-Module PS> Get-DscResource -Module cWinTrialLab ImplementedAs Name ModuleName Version Properties ————- —- ———- ——- ———- PowerShell cWtlShortcut cWinTrialLab 0.0.1 {Ensure, ShortcutPath, TargetPath, DependsOn…} 所以我创build一个testingconfiguration文件: Configuration TestConfig { Import-DscResource -ModuleName PSDesiredStateConfiguration Import-DscResource -ModuleName cWinTrialLab Node localhost { […]
这些文章都讨论了分期,包装和一堆基础设施方面的问题。 是否可以在本地运行脚本,或者(对于远程服务器而言)(更可取!)? 例如,基础设施免费,就像我现在可以运行ssh命令?
我目前正在评估Microsoft PowerShell所需的状态configurationfunction。 不幸的是,我的公司仍然运行着超过5000多个Vista客户端(和W2003服务器),这似乎是WMF 4.0中的一大亮点。 我想知道是否有任何解决方法 – 一些技巧,黑客,黑魔法 – 任何得到DSC在Vista上运行?
我有一个PowerShell DSC我正在使用configuration一个Web服务器。 我的服务器将需要URL重写模块,所以我从Github的主要代码中find了这个代码: https://gist.github.com/sheastrickland/646c42789ce2df35d5c8 我的问题是,当DSC进入我的区块时: Package UrlRewrite { #Install URL Rewrite module for IIS DependsOn = "[cNtfsPermissionEntry]AppPoolPermissionsSet" Ensure = "Present" Name = "IIS URL Rewrite Module 2" Path = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi" Arguments = "/quiet" ProductId = "EB675D0A-2C95-405B-BEE8-B42A65D23E11" } 它会抛出一个错误: PowerShell DSC resource MSFT_PackageResource failed to execute Set- TargetResource functionality with error message: Could not get the […]
如果我像这样在一个文件中嵌套DSCconfiguration,它工作正常: Configuration Secondary { Param ($SomeParameter) Environment Test { Name = $SomeParameter Value = "12345" } } Configuration MyConfiguration { Node localhost { Secondary TheSecondary { SomeParameter = "TestEnvVar" } } } MyConfiguration Start-DscConfiguration .\MyConfiguration -Wait -Verbose 我想将我的configuration分成两个单独的文件。 一个将点对点来包含configuration。 Secondary.ps1: Configuration Secondary { Param ($SomeParameter) Environment Test { Name = $SomeParameter Value = "12345" } […]
来自MSDN RebootNodeIfNeeded :目标节点上的某些configuration更改可能需要重新启动才能应用更改。 如果值为“true”,则此属性将立即重新启动节点,而不会发出警告。 如果“false”,则configuration将完成,但必须手动重新启动节点才能使更改生效。 所以我的理解是即使需要重新启动,DSC也应该运行所有的configuration 但在我的情况是这样的,安装一个软件包后,有时DSC被标记为重新启动,DSC不运行其余的configuration 我必须再次手动执行该命令才能运行其余的configuration Start-DscConfiguration -Wait -Force -Path .\SomePath 我想迫使DSC运行所有configuration,然后通知我是否需要重新启动服务器 我如何configuration软件包的例子 LocalConfigurationManager { RebootNodeIfNeeded = $false } Package MVC3 { Name = "Microsoft ASP.NET MVC 3" Ensure = "Present" Path = "$Env:SystemDrive\AspNetMVC3ToolsUpdateSetup.exe" ProductId = "DCDEC776-BADD-48B9-8F9A-DFF513C3D7FA" Arguments = "/q" DependsOn = "[WindowsFeature]IIS" Credential = $Credential } Package MVC4 { Name = "Microsoft […]