Setting environment variable for service

If it is a local Server 2012 environment variable you seek, you can use PowerShell to create a new system or user environment variable make sure you run PowerShell as Administrator.

Machine variable:
[Environment]::SetEnvironmentVariable('Name','Value','Machine')
User variable:
[Environment]::SetEnvironmentVariable('Name','Value','User')

To check the current environment variables, use the following PowerShell command

Get-Childitem ENV:

Note: you will need to close PowerShell and open a new instance to see the newly created environment variable.