-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpre-start.ps1.erb
More file actions
26 lines (19 loc) · 799 Bytes
/
Copy pathpre-start.ps1.erb
File metadata and controls
26 lines (19 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ErrorActionPreference = "Stop";
trap { $host.SetShouldExit(1) }
$SETTINGS_FILE = "C:\var\vcap\bosh\settings.json"
$CONFIG_FILE = "C:\var\vcap\jobs\turbulence_agent_windows\config\config.json"
try {
$vmID = (Get-Content -Raw $SETTINGS_FILE | ConvertFrom-Json).agent_id
$config = (Get-Content -Raw $CONFIG_FILE | ConvertFrom-Json)
$config.AgentID = $vmID
$config | ConvertTo-Json | Set-Content $CONFIG_FILE
} catch {
Write-Error $_.Exception.Message
Exit 1
}
$REG_KEY='Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment'
$oldpath = (Get-ItemProperty -Path $REG_KEY -Name PATH).path
$newpath = "${oldpath};C:\var\vcap\packages\stress-windows"
Set-ItemProperty -Path $REG_KEY -Name PATH -Value $newpath
SETX /M PATH $newpath
Exit 0