PowerShell Desired State Configuration - Registry Resource Demo
PowerShell Desired State Configuration - Registry Resource Demo
Summary
In this Wiki let's explore Registry Resource Demo. Requirement is to create a Registry Key in Local host using DSC.
Resource
Get-DscResource -Name Registry -Syntax |
Syntax
Registry [string] #ResourceName { Key = [string] ValueName = [string] [ DependsOn = [string[]] ] [ Ensure = [string] { Absent | Present } ] [ Force = [bool] ] [ Hex = [bool] ] [ ValueData = [string[]] ] [ ValueType = [string] { Binary | Dword | ExpandString | MultiString | Qword | String } ] } |
Code
Configuration MyRegistry { Node $env:ComputerName { Registry MyRegistry { Ensure = 'Present' Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\ChenV' ValueName = 'MyDSC' ValueData = 'Configured Using DSC' ValueType = 'String' } } } MyRegistry Start-DscConfiguration -Path C:\MyRegistry -Wait -Verbose -Force |