C
Coder.com2mo ago
Vlad

PATH getting overwritten on Windows VM

Hello! I am a very new coder user. Recently our corpeng started to a trial of this tool and we can provision Windows machines with it. This is amazing because I don't use windows much but still can test stuff on demand. I wrote myself a script which sets up machine and just copy-paste it. Big problem is that PATH getting wiped every time I do ssh coder.my-machine. I spend too much time browsing terraform files, but there is nothing indicating changin $env:Path. Only thing which isn't clear what's doing is ${coder_agent.main.init_script}. I tried adding items to my profile. I see them executing (echoing) when I ssh in, but path is overwritten after. Please help.
4 Replies
Codercord
Codercord2mo ago
<#1350156673486032966>
Category
Help needed
Product
Coder (v2)
Platform
Windows
Logs
Please post any relevant logs/error messages.
Vlad
VladOP2mo ago
Ooof... I actually resolved my issue lol by adding this to my setup script
Add-Content -Path $Profile.AllUsersAllHosts -Value '$env:Path = (($env:Path + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")) -split ";" | Where-Object { $_.Trim() } | Select-Object -Uniq) -join ";"'
Add-Content -Path $Profile.AllUsersAllHosts -Value '$env:Path = (($env:Path + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")) -split ";" | Where-Object { $_.Trim() } | Select-Object -Uniq) -join ";"'
Phorcys
Phorcys2mo ago
thanks for following up, yeah you have to persist it in some way, this is not specific to Coder because every ssh session is like opening a new terminal
Codercord
Codercord2mo ago
@Phorcys closed the thread.

Did you find this page helpful?