Powershell DSC - MSFT_RoleResource

Nicolas VACCARO 1 Reputation point
2022-03-30T13:25:52.203+00:00

Hello,

I have a problem related to MSFT_RoleResource, I have recovered a DSC script that you can find below:

Configuration InstallerSNMP {

Import-DscResource –ModuleName PSDesiredStateConfiguration

Node MonServeur {
WindowsFeature SNMPService
{
Name = "SNMP-Service"
Ensure = "Present"
}
}
}

The compilation in .mof works as shown below:

188409-image.png

Once the compilation is finished I want to make an Azure policy, the compilation works as shown below ( it's very strange because when i compile the script i have error who say replace the PSDesiredStateConfiguration By PSDresource):

188318-image.png

I want to test it afterwards but it sends me this error:

188379-image.png

Can you help me?

Thank you so much

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,776 Reputation points
    2022-04-05T16:47:19.823+00:00

    Hi @Nicolas VACCARO

    Like all Windows software, DSC records errors and events in logs that can be viewed from the Event Viewer. Examining these logs can help you understand why a particular operation failed, and how to prevent failure in the future.

    In Event Viewer, DSC events are in: Applications and Services Logs/Microsoft/Windows/Desired State Configuration

    Maybe you can also try using the Get-DscConfigurationStatus cmdlet to get information about configuration status from a target node and see if are some issues there. You can dig into the object to discover details about the configuration run such as:

    -All of the resources that failed
    -Any resource that requested a reboot
    -Meta-Configuration settings at the time of configuration run.

    Troubleshooting DSC
    https://learn.microsoft.com/en-us/powershell/dsc/troubleshooting/troubleshooting?view=dsc-1.1

    Hope this resolves your Query!!

    --------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.