Skip to content

Instantly share code, notes, and snippets.

$cred = Get-Credential
configuration DscSecurity
{
node LAB-WEB01
{
Script UserInfo
{
GetScript = { return $null }
TestScript = {
configuration DscSecurity
{
node LAB-WEB01
{
Script UserInfo
{
GetScript = { return $null }
TestScript = {
Write-Verbose ("ENV username: '{0}'" -f $env:USERNAME)
Write-Verbose ("Windows Identity: '{0}'" -f [System.Security.Principal.WindowsIdentity]::GetCurrent().Name)
configuration DscSecurity
{
node LAB-WEB01
{
ScriptEx UserInfo
{
GetScript = { return $null }
TestScript = {
Write-Verbose ("ENV username: '{0}'" -f $env:USERNAME)
Write-Verbose ("Windows Identity: '{0}'" -f [System.Security.Principal.WindowsIdentity]::GetCurrent().Name)
Script SetTimezone
{
GetScript = { return @{ Timezone = ("{0}" -f (tzutil.exe /g)) } }
TestScript = { return (tzutil.exe /g) -ieq "GMT Standard Time" }
SetScript = { tzutil.exe /s "GMT Standard Time" }
}
configuration SimpleConfig2
{
node LAB-WEB01
{
File MarkerFile
{
DestinationPath = 'C:\deployed.txt'
Contents = ""
Requires = "[Group]FooGroup","[Registry]EnableRdp"
}
@JamesDawson
JamesDawson / SimpleConfig.ps1
Last active December 19, 2015 11:09
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"
}