3
我試圖通過DSC配置目標節點。
我用一個虛擬配置創建了一個.ps1文件;你可以在下面看到它;它只是您在DSC網站中找到的第一批例子之一。
現在我想編譯成.mof文件。 我執行了:DSC,將ps1文件編譯成MOF
PS C:\var\DSC\Configurations> . .\localhost.ps1
但它什麼都沒做。 mof文件不會出現,也不會引發錯誤消息。 我錯過了什麼?
Configuration FileResourceDemo
{
Node "localhost"
{
File DirectoryCopy
{
Ensure = "Present" # You can also set Ensure to "Absent"
Type = "Directory" # Default is "File".
Recurse = $true # Ensure presence of subdirectories, too
SourcePath = "C:\Users\Public\Documents\DSCDemo\DemoSource"
DestinationPath = "C:\Users\Public\Documents\DSCDemo\DemoDestination"
}
Log AfterDirectoryCopy
{
# The message below gets written to the Microsoft-Windows-Desired State Configuration/Analytic log
Message = "Finished running the file resource with ID DirectoryCopy"
DependsOn = "[File]DirectoryCopy" # This means run "DirectoryCopy" first.
}
}
}