我有一个第三方颁发的证书,我需要确保它在给定域中的所有目标上运行。有没有办法确保通过 DSC 安装此证书?
我有许多使用环境资源设置路径值的部分 DSC 脚本。我有两个执行此操作的脚本,从 WMF5.0 升级到 WMF5.1 后,启动 DscConfigurations 时出现以下错误。
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ApplyConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer MYCOMPUTER with user sid S-1-5-21-1064954374-356710528-937385128-34335.
VERBOSE: [DESTCOMPUTER]: [] Starting consistency engine.
The resources ('[Environment]SetInstantClientPath' and '[Environment]SqlCmdPath') have conflicting values of the following properties: 'Value'. Ensure that their values match. Merging of partial configurations failed. LCM
failed to start desired state configuration manually.
+ CategoryInfo : ResourceExists: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 11
+ PSComputerName : DESTCOMPUTER
一个脚本执行此操作:
Environment SqlCmdPath {
Name = "Path"
DependsOn = "[Package]InstallSQLServer2012CmdLineUtils_64bit"
Ensure = "Present"
Path = $true
Value = "$env:ProgramFiles\Microsoft SQL Server\110\Tools\Binn"
}
另一个脚本执行此操作:
Environment SetInstantClientPath {
Name = "Path"
DependsOn = "[Archive]InstallInstantClientBasic","[Archive]InstallInstantClientSqlplus"
Ensure = "Present"
Path = $true
Value = "$env:SystemDrive\instantclient_11_2"
}
这曾经从 WMF5.0 愉快地运行
自 WMF5.1 以来有什么变化吗?
我一直在尝试使用模块xHyper-V从我的 Windows 10 工作站在我的 Hyper-V 2016 主机上创建一个虚拟机,但并没有太多乐趣。
我的 Hyper-V 主机名为 Lithium,我的 DSC 脚本如下。
Configuration EndToEndXHyperV_RunningVM
{
param
(
[string[]]$NodeName = 'lithium',
[Parameter(Mandatory)]
[string]$VMName,
[Parameter(Mandatory)]
[string]$StartupMemory,
[Parameter(Mandatory)]
[string]$MinimumMemory,
[Parameter(Mandatory)]
[string]$MaximumMemory,
[Parameter(Mandatory)]
[String]$SwitchName,
[Parameter(Mandatory)]
[Uint32]$ProcessorCount,
[ValidateSet('Off','Paused','Running')]
[String]$State = 'Off',
[Switch]$WaitForIP
)
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
Import-DscResource -module xHyper-V
Node $NodeName
{
$NewSystemVHDPath = "\\lithium\VHDs-SSD\$($VMName)-System.vhdx"
# Copy VHD File - hard coded to Windows 2016 Core Eval for now
File SystemDisk {
SourcePath = "\\lithium\Templates\Windows 2016 Core Template\System.vhdx"
DestinationPath = $NewSystemVHDPath
Type = "File"
Ensure = "Present"
}
# create the generation 2 testVM out of the vhd.
xVMHyperV NewVM
{
Ensure = 'Present'
Name = $VMName
VhdPath = $NewSystemVHDPath
SwitchName = $SwitchName
State = $State
Path = $Path
Generation = 2
StartupMemory = $StartupMemory
MinimumMemory = $MinimumMemory
MaximumMemory = $MaximumMemory
ProcessorCount = $ProcessorCount
RestartIfNeeded = $true
WaitForIP = $WaitForIP
DependsOn = "[File]SystemDisk"
}
}
}
我已授予机器帐户对共享的访问权限,并且文件副本工作正常,但添加虚拟硬盘时出现错误。有任何想法吗?
PS C:\Repos\Infrastructure\DSC> Start-DscConfiguration -Path .\EndToEndXHyperV_RunningVM -Wait -Verbose -Force
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namesp
aceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COWSLIP with user sid S-1-5-21-1075642099-280362434-2919291742-1105.
VERBOSE: [LITHIUM]: LCM: [ Start Set ]
VERBOSE: [LITHIUM]: LCM: [ Start Resource ] [[File]SystemDisk]
VERBOSE: [LITHIUM]: LCM: [ Start Test ] [[File]SystemDisk]
VERBOSE: [LITHIUM]: [[File]SystemDisk] The system cannot find the file specified.
VERBOSE: [LITHIUM]: [[File]SystemDisk] The related file/directory is: \\lithium\VHDs-SSD\test-System.vhdx.
VERBOSE: [LITHIUM]: [[File]SystemDisk] Building file list from cache.
VERBOSE: [LITHIUM]: LCM: [ End Test ] [[File]SystemDisk] in 0.0510 seconds.
VERBOSE: [LITHIUM]: LCM: [ Start Set ] [[File]SystemDisk]
VERBOSE: [LITHIUM]: [[File]SystemDisk] The system cannot find the file specified.
VERBOSE: [LITHIUM]: [[File]SystemDisk] The related file/directory is: \\lithium\VHDs-SSD\test-System.vhdx.
VERBOSE: [LITHIUM]: [[File]SystemDisk] Building file list from cache.
VERBOSE: [LITHIUM]: [[File]SystemDisk] Copying file \\lithium\Templates\Windows 2016 Core Template\System.vhdx to \\lithium\VHDs-SSD\test-Sy
stem.vhdx.
VERBOSE: [LITHIUM]: LCM: [ End Set ] [[File]SystemDisk] in 17.2540 seconds.
VERBOSE: [LITHIUM]: LCM: [ End Resource ] [[File]SystemDisk]
VERBOSE: [LITHIUM]: LCM: [ Start Resource ] [[xVMHyperV]NewVM]
VERBOSE: [LITHIUM]: LCM: [ Start Test ] [[xVMHyperV]NewVM]
VERBOSE: [LITHIUM]: LCM: [ End Test ] [[xVMHyperV]NewVM] in 1.0200 seconds.
VERBOSE: [LITHIUM]: LCM: [ Start Set ] [[xVMHyperV]NewVM]
VERBOSE: [LITHIUM]: [[xVMHyperV]NewVM] Checking if VM 'test' exists ...
VERBOSE: [LITHIUM]: [[xVMHyperV]NewVM] VM 'test' does not exist.
VERBOSE: [LITHIUM]: [[xVMHyperV]NewVM] Creating VM 'test' ...
Failed to add device 'Virtual Hard Disk'.
The Machine Account 'DUCK\LITHIUM$' or the user initiating the VM management operation or both do not have the required access to the file share
'\\lithium\VHDs-SSD\test-System.vhdx'. Please ensure that the computer machine account and the user initiating the VM management operation have full access to the
file share as well as the file system folder backing the file share. Error: 'General access denied error'
'test' failed to add device 'Virtual Hard Disk'. (Virtual machine ID 4DE01C38-E027-4366-B56A-85B527BB34CB)
'test': The Machine Account 'DUCK\LITHIUM$' or the user initiating the VM management operation or both do not have the required access to the file share
'\\lithium\VHDs-SSD\test-System.vhdx'. Please ensure that the computer machine account and the user initiating the VM management operation have full access to the
file share as well as the file system folder backing the file share. Error: 'General access denied error' (0x80070005). (Virtual machine ID
4DE01C38-E027-4366-B56A-85B527BB34CB)
+ CategoryInfo : PermissionDenied: (:) [], CimException
+ FullyQualifiedErrorId : AccessDenied,Microsoft.HyperV.PowerShell.Commands.NewVM
+ PSComputerName : lithium
我正在使用 Powershell Desired State Configuration 来设置服务器。服务器需要安装 SQL 客户端 msi。作为登录用户,我可以单击 msi,然后毫无问题地安装它。但是,当我尝试通过 PowerShelll 安装它时
C:\Windows\system32\msiexec.exe /i "C:\Users\Djad\Desktop\sqlncli.msi" /quiet /log C:\Users\Djad\Desktop\sqllog.txt
我收到以下错误。
MSI (s) (A4:4C) [22:43:59:356]: Product: Microsoft SQL Server 2012 Native Client -- Installation failed.
MSI (s) (A4:4C) [22:43:59:372]: Windows Installer installed the product. Product Name: Microsoft SQL Server 2012 Native Client. Product Version: 11.0.2100.60. Product Language: 1033. Manufacturer: Microsoft Corporation. Installation success or error status: 1625.
Info 1625. This installation is forbidden by system policy. Contact your system administrator.
C:\Users\Djad\Desktop\sqlncli.msi
我不确定为什么策略会阻止 powershell 运行,但仍然允许我单击它来运行它。有谁知道挂断可能是什么?任何帮助是极大的赞赏。
我有一个用于配置 Web 服务器的 Powershell DSC。我的服务器将需要 URL Rewrite 模块,所以我从 Github gist 中获得了该代码:
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 http
stream for file http://download.microsoft.com/download/6/7/D/67D80164-7DD0-
48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi
起初我以为我的服务器可能有错误的代理设置,所以我检查了是否可以使用以下语句下载文件:
wget http://download.microsoft.com/download/6/7/D/
67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi
-OutFile "C:\Users\Dald\Desktop\Mizzy.msi"
瞧,该文件出现在桌面上,按预期显示为 6,12 MB。
所以我很茫然,为什么我的 DSC 无法获取 http 流?我以管理员身份运行它,所以所有功能都应该可用,但也许我忘了设置一些东西。
任何帮助是极大的赞赏。
我的 DSC 配置中有以下内容:
xWebApplication StaffDirectoryApp {
Website = "MySite"
Name = "MyApp"
WebAppPool = "MyPool"
PhysicalPath = $Destination
Ensure = "Present"
PreloadEnabled = $true
}
这似乎工作正常,但我也想使用 AuthenticationInfo 属性(尽管文档似乎说它应该是 AuthenticationInformation,但不是)。
我能找到的唯一示例是在 GitHub 上的一个单元测试中,它们的用法是这样的:
AuthenticationInfo = New-CimInstance -ClassName MSFT_xWebApplicationAuthenticationInformation `
-ClientOnly `
-Property @{ Anonymous = $false; Basic = $false; Digest = $false; Windows = $true }
但是,这会产生以下结果:
Convert property 'AuthenticationInfo' value from type 'STRING' to type 'INSTANCE' failed
我应该如何设置这个属性?
我正在使用 powerShell Desired State Configuration 在服务器机器上测试/设置 Windows 功能。我拥有的是 78 个 WindowsFeature 资源,如果需要,可以检查和安装。我观察到的是在 LCM(本地配置管理器)执行和检查配置时 CPU 使用率很高。我进行了一些调查,发现 WMI 提供程序“deploymentprovider”是负责 WindowsFeature 资源的 ServerManager.DeploymentProvider.dll 的一部分。所以问题是,有没有人经历过这个问题并以某种方式解决了它?
提前致谢。
以下命令可用于确定系统上是否存在配置偏差:
Test-DscConfiguration –CimSession $session
该命令仅返回 true 或 false。有没有办法检索这些差异的列表?
有没有办法从当前系统构建 PowerShell 所需状态配置 (DSC) 配置文件?反对从头开始构建整个文件?