title | ms.date | keywords | description | ms.topic | author | manager | ms.prod |
---|---|---|---|---|---|---|---|
DSC Log Resource |
2016-05-16 |
powershell,DSC |
article |
eslesar |
dongill |
powershell |
Applies To: Windows PowerShell 4.0, Windows PowerShell 5.0
The Log resource in Windows PowerShell Desired State Configuration (DSC) provides a mechanism to write messages to the Microsoft-Windows-Desired State Configuration/Analytic event log.
Syntax
Log [string] #ResourceName
{
Message = [string]
[ DependsOn = [string[]] ]
}
Property | Description |
---|---|
Message | Indicates the message you want to write to the Microsoft-Windows-Desired State Configuration/Analytic event log. |
DependsOn | Indicates that the configuration of another resource must run before this log message gets written. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is ResourceType, the syntax for using this property is DependsOn = "[ResourceType]ResourceName" . |
The following example shows how to include a message in the Microsoft-Windows-Desired State Configuration/Analytic event log.
Note: if you run Test-DscConfiguration with this resource configured, it will always return $false.
Log LogExample
{
Message = "This message will appear in the Microsoft-Windows-Desired State Configuration/Analytic event log."
}