Create a gist now

Instantly share code, notes, and snippets.

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