Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
configuration Absent_PsDscRunAsCredential
{
Import-DscResource -Modulename GraniResource
Node localhost
{
cCredentialManager Absent
{
InstanceIdentifier = $Node.InstanceIdentifier
Ensure = $Node.Ensure
Target = $Node.Target
PsDscRunAsCredential = $Node.PsDscRunAsCredential
}
}
}
$configurationData = @{
AllNodes = @(
@{
NodeName = "localhost"
PSDscAllowPlainTextPassword = $true
InstanceIdentifier = "JustAnIdentifierToKeepUnique"
Ensure = "Absent"
Target = "DesiredTargetName"
PsDscRunAsCredential = New-Object PSCredential ("administrator", ("SuperExcellntPassword____????1111" | ConvertTo-SecureString -Force -AsPlainText))
}
)
}
Absent_PsDscRunAsCredential -ConfigurationData $configurationData
configuration Present_PsDscRunAsCredential
{
Import-DscResource -Modulename GraniResource
Node localhost
{
cCredentialManager Present
{
InstanceIdentifier = $Node.InstanceIdentifier
Ensure = $Node.Ensure
Target = $Node.Target
Credential = $Node.Credential
PsDscRunAsCredential = $Node.PsDscRunAsCredential
}
}
}
$configurationData = @{
AllNodes = @(
@{
NodeName = "localhost"
PSDscAllowPlainTextPassword = $true
InstanceIdentifier = "JustAnIdentifierToKeepUnique"
Ensure = "Present"
Target = "DesiredTargetName"
Credential = New-Object PSCredential ("PesterTestDummy", ("PesterTestPassword" | ConvertTo-SecureString -Force -AsPlainText))
PsDscRunAsCredential = New-Object PSCredential ("administrator", ("SuperExcellntPassword____????1111" | ConvertTo-SecureString -Force -AsPlainText))
}
)
}
Present_PsDscRunAsCredential -ConfigurationData $configurationData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment