我正在单个服务器上进行实验室DSC构建。我有一个服务器(vhdx
)的mof文件,我正在复制到c:\windows\system32\configuraiton\pending.mof
。我们的想法是,在启动时,系统将应用mof并将配置系统。
不幸的是,没有复制mof文件。我在xVhdFile
下的其他条目正在被复制(unattended.xml
,DSC resource directories
)但不是mof。谁知道为什么?
以下是xVhdFile
条目:
xVhdFile "CopyUnattendedXml DC01"
{
VhdPath = "F:\VMs\DC01\DC01`.vhdx"
FileDirectory = @(
# Pending.mof
MSFT_xFileDirectory {
SourcePath = 'F:\DSCScripts\Lab01\ForestRoot\Localhost.mof'
DestinationPath = "\Windows\Sytem32\Configuration\Pending.mof"
}
# unattend.xml
MSFT_xFileDirectory {
SourcePath = 'F:\VMs\Sysprep\2016DataCenterEval_2.xml'
DestinationPath = "\Windows\System32\Sysprep\Unattend.xml"
}
# xActiveDirectory
MSFT_xFileDirectory {
SourcePath = 'C:\Program Files\WindowsPowerShell\Modules\xActiveDirectory\'
DestinationPath = "\Program Files\WindowsPowerShell\Modules\"
type = 'Directory'
Recurse = $True
}
# xNetworking
MSFT_xFileDirectory {
SourcePath = 'C:\Program Files\WindowsPowerShell\Modules\xNetworking\'
DestinationPath = "\Program Files\WindowsPowerShell\Modules\"
type = 'Directory'
Recurse = $True
}
)
DependsOn = "[File]CopyBaseImage DC01"
}
由于
详细输出:
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ Start Resource ] [[xVhdFile]CopyUnattendedXml DC01]
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ Start Test ] [[xVhdFile]CopyUnattendedXml DC01]
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Alias
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] C
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Cert
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] D
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] E
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Env
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] F
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Function
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] H
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] HKCU
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] HKLM
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Variable
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] WSMan
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] H:\
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] DestinationPath => \Windows\Sytem32\Configuration\Pending.mof
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Recurse => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Force => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Type => File
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Ensure => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Content =>
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] SourcePath => F:\DSCScripts\Lab01\ForestRoot\Localhost.mof
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Attributes =>
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Testing the file with relative VHD destination
\Windows\Sytem32\Configuration\Pending.mof
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Test returned False
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ End Test ] [[xVhdFile]CopyUnattendedXml DC01] in 2.4530 seconds.
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ Start Set ] [[xVhdFile]CopyUnattendedXml DC01]
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Alias
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] C
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Cert
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] D
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] E
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Env
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] F
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Function
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] H
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] HKCU
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] HKLM
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Variable
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] WSMan
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] DestinationPath => \Windows\Sytem32\Configuration\Pending.mof
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Recurse => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Force => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Type => File
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Ensure => True
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Content =>
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] SourcePath => F:\DSCScripts\Lab01\ForestRoot\Localhost.mof
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Attributes =>
VERBOSE: [WIN-LBCPOR4PDR5]: [[xVhdFile]CopyUnattendedXml DC01] Setting the VHD file Copy
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ End Set ] [[xVhdFile]CopyUnattendedXml DC01] in 1.6880 seconds.
VERBOSE: [WIN-LBCPOR4PDR5]: LCM: [ End Resource ] [[xVhdFile]CopyUnattendedXml DC01]
答案 0 :(得分:0)
你有一个错字。 Sytem32
应为System32
。这一行:
DestinationPath = "\Windows\Sytem32\Configuration\Pending.mof"
变为:
DestinationPath = "\Windows\System32\Configuration\Pending.mof"
正在复制文件而不是预期的位置。
我通过重新创建您的失败并通过Pending.mof(dir F:\pending.mof -Recurse
)的配置搜索VHD更新找到了这一点,并发现该文件夹实际上不是DSC配置文件夹。