dsc/ext/PsGallery/xPSDesiredStateConfiguration.6.4.0.0/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1

<#
    .SYNOPSIS
        Creates the environment variable 'TestEnvironmentVariable' and sets the value to 'TestValue'
        both on the machine and within the process.
#>

Configuration Sample_xEnvironment_CreateNonPathVariable 
{
    param ()

    Import-DscResource -ModuleName 'xPSDesiredStateConfiguration'

    Node localhost
    {
        xEnvironment CreateEnvironmentVariable
        {
            Name = 'TestEnvironmentVariable'
            Value = 'TestValue'
            Ensure = 'Present'
            Path = $false
            Target = @('Process', 'Machine')
        }
    }
}

Sample_xEnvironment_CreateNonPathVariable