Skip to content

Instantly share code, notes, and snippets.

@gpduck
Created September 4, 2013 13:32
Show Gist options
  • Save gpduck/6437000 to your computer and use it in GitHub Desktop.
Save gpduck/6437000 to your computer and use it in GitHub Desktop.
This allows plain text passwords to be supplied in DSC configurations. Be aware it puts the password in plain text in c:\windows\system32\configuration\current.mof (and possibly other places)
$CfgData =@{
AllNodes =@(
@{
NodeName = $Env:Computername;
PSDscAllowPlainTextPassword = $true;
}
)
}
configuration TestFile {
param ($Cred)
node $env:computername {
File Test {
SourcePath = "\\server\share\test.txt"
DestinationPath = "c:\dest\test.txt"
Credential = $cred
}
}
}
TestFile -cred (get-credential) -configurationData $CfgData
Start-DSCConfiguration -path .\TestFile -ComputerName $Env:Computername | wait-job | receive-job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment