Created
February 10, 2022 23:18
-
-
Save rodmhgl/2d4b036bc4c959db29a29c371af0bada to your computer and use it in GitHub Desktop.
Downloads and installs Terraform. $tfPath will be added to PATH permanently via registry settings - run as Administrator.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pathKey = 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' | |
$tfFilename = 'terraform_1.1.5_windows_amd64.zip' | |
$tfURL = "https://releases.hashicorp.com/terraform/1.1.5/$tfFilename" | |
$tfPath = 'C:\tf' | |
Invoke-WebRequest $tfURL -UseBasicParsing -OutFile $tfFilename | |
Expand-Archive ".\$tfFilename" -DestinationPath $tfPath -Force | |
$oldpath = (Get-ItemProperty -Path $pathKey -Name PATH).path | |
$newpath = "$oldpath;$tfPath;" | |
Set-ItemProperty -Path $pathKey -Name PATH -Value $newpath -whatif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment