I have to do these 2 actions from PSADT- version using 3.8.4.
Set System Environment variable:
Currently I am using this method to set the variables however logging is not happening since I’m using the native PS method. Is there PSADT method I can use so that that can be logged or give me a log out put which says the action is completed successfully or Not?
[System.Environment]::SetEnvironmentVariable('TEST_LICENSE_FILE', 'test@abc.com;test.xyz.com', 'machine')
Update the PATH variable:
Currently I am using this below method, might be a better way from PSADT?
## Update Path Envirnment Variable
# Separate multiple paths with semi-colon ;
$NewPathsToAdd = "C:\Program Files (x86)\test vendor\test app 2021\;C:\Program Files (x86)\test vendor\test app 2020\"
# Save this to a text file in case you need it later, for now we'll output it to the console
$CurrentPaths = $env:path
Write-Host "`r`n `$CurrentPaths variable contains the following paths: $($currentPaths)" -ForegroundColor Cyan
# Combine the old path and new path(s) into one string, you can swap these variables around if you want the new paths at the bottom
$PathUpdate = $CurrentPaths + ";" + $NewPathsToAdd
Write-Host "`r`n `$PathUpdate variable will load the following paths: $($PathUpdate)" -ForegroundColor Cyan
# The last parameter ("Machine"),should be either User or Machine, depending on where you want the variable stored
[Environment]::SetEnvironmentVariable("PATH","$PathUpdate","Machine")
Appreciate your help, thank you