Skip to content

Instantly share code, notes, and snippets.

@JamesDawson
Last active December 19, 2015 11:09
Show Gist options
  • Select an option

  • Save JamesDawson/5945275 to your computer and use it in GitHub Desktop.

Select an option

Save JamesDawson/5945275 to your computer and use it in GitHub Desktop.
A simple PowerShell Desired State Configuration script (accompanies this blog post: )
configuration SimpleConfig
{
node LAB-WEB01
{
File MarkerFile
{
DestinationPath = 'C:\deployed.txt'
Contents = ""
Requires = "[Group]FooGroup","[Registry]EnableRdp"
}
Group FooGroup
{
Ensure = "Present"
Name = "Foo"
Members = @("foobar")
Requires = "[User]FooBarUser"
}
User FooBarUser
{
Ensure = "Present"
UserName = "foobar"
Description = "an important service account"
FullName = "FooBar Service Account"
Disabled = $False
Password = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "P4ssw0rd1" -AsPlainText -Force))
PasswordNeverExpires = $True
}
Registry EnableRdp
{
Key = "HKLM:SYSTEM\CurrentControlSet\Control\Terminal Server";
ValueName = "fDenyTSConnections";
ValueData = "0";
ValueType = "DWord";
}
}
}
SimpleConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment