﻿id	summary	reporter	owner	description	type	status	component	version	resolution	keywords	cc	guest	host
14717	guestcontrol run / start don't setup user environment in windows guests	rahoe		"guestcontrol run / guestcontrol start don't setup the right user environment in the Windows guest when starting an application.

Starting an application with VirtualBox 4 ""guestcontrol execute"" leads to a windows environment like that:
{{{
APPDATA=C:\Users\rahoe\AppData\Roaming
LOCALAPPDATA=C:\Users\rahoe\AppData\Local
TEMP=C:\Users\rahoe\AppData\Local\Temp
TMP=C:\Users\rahoe\AppData\Local\Temp
USERPROFILE=C:\Users\rahoe
...
}}}

Starting in VB 5 per ""guestcontrol run"":
{{{
APPDATA=C:\Windows\system32\config\systemprofile\AppData\Roaming
LOCALAPPDATA=C:\Windows\system32\config\systemprofile\AppData\Local
TEMP=C:\Windows\TEMP
TMP=C:\Windows\TEMP
USERPROFILE=C:\Windows\system32\config\systemprofile
}}}

So many applications can't work properly because they have no write permissions to profile data or temp directory.

Hints for reproducing the problem:
* Create a windows command script ""c:\testit.cmd"":
{{{
start c:\windows\system32\cmd.exe
}}}

* Run it using the following command in VirtualBox 5.0.6:
{{{
VBoxManage guestcontrol {vm-name} start --username rahoe --passwordfile password.dat -- 'c:\testit.cmd'
}}}
* or
{{{
VBoxManage guestcontrol {vm-name} start --username rahoe --passwordfile password.dat --exe 'c:\testit.cmd'
}}}
* using ""run"" instead of ""start"" don't make any difference

* Execute ""set|sort"" in the opened windows command shell window.

* Compare with VirtualBox 4.3.30:
{{{
VBoxManage guestcontrol {vm-name} execute --username rahoe --passwordfile password.dat --image 'c:\testit.cmd' 
}}}

Tested with following environments:
* Host: Ubuntu Linux 14.04 x86_64
* Guest: Windows 7
* Guest: Windows 8.1

See also ticket #14506

Note: as a workaround I set the five environment variables listed above using the ""--putenv""-Option of VBoxManage; then all tested applications works as with VirtualBox 4.3, e. g. MS Office 2010, VMWare VSphere 5.5, CorelDraw 11"	defect	closed	guest control	VirtualBox 5.0.6	fixed	guestcontrol run start execute		Windows	Linux
