Hi,
I am trying to build a web server with several users placed in some local groups.
I am using the User function in DSC. Here is the error I get.
ConvertTo-MOFInstance : System.InvalidOperationException error processing property ‘Password’ OF TYPE ‘User’:
Converting and storing an encrypted password as plaintext is allowed only if PSDscAllowPlainTextPassword is set to
true.
At D:\Scripts\WebRole.ps1:572 char:5
I am setting the Credentials early on in the script lile this:
$SecurePassword = ConvertTo-SecureString “xyz**************”’ -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential(“`$theusername”,$SecurePassword)
I then try to set up the user like this:
Create Local User Accounts
User Theusername {
UserName = '$theusername'
Description = 'Service Account'
Disabled = $False
Ensure = 'Present'
FullName = '$theusername'
Password = $Credentials
PasswordChangeNotAllowed = $True
PasswordChangeRequired = $False
PasswordNeverExpires = $True
}
I found one example that says I have to set PSDscAllowPlainTextPassword=$true
But it is unclear where I would put this in my code.
Any help would be great.
TIA