Modify ↓
#89 closed Bug (Fixed)
RunAs w/ Profile does not grant acess to user environment
| Reported by: | DaveF | Owned by: | Valik |
|---|---|---|---|
| Milestone: | 3.2.11.12 | Component: | AutoIt |
| Version: | 3.2.11.0 | Severity: | Blocking |
| Keywords: | beta, runas, environment, profile | Cc: |
Description
Using beta 3.2.11.0 on XP SP2:
In a child process spawned by the RunAs function with the proper flag to force the as-yet unloaded run-as user's profile to load, the child process's environment is that of the Default User rather than the run-as user's, though the other run-as elements of the run-as user's profile (such as the system registry) can be accessed as desired.
Code to reproduce:
; declare yourself
Dim $ourPID, $ourRead
; Run child task with option to load run-as user's profile
$ourPID = RunAs("is", @ComputerName, "smack", 1, @ComSpec & " /c set", @SystemDir, @SW_HIDE, 2)
; Read the child task's STDOUT output
While 1
$ourRead &= StdoutRead($ourPID)
If @error Then ExitLoop
WEnd
; Display result
MsgBox(0, "Debug", @AutoItVersion & " yields:" & @CRLF & $ourRead)
Attachments (0)
Change History (4)
comment:1 by , 18 years ago
| Milestone: | Future Release |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:2 by , 18 years ago
| Severity: | → Blocking |
|---|
comment:3 by , 18 years ago
| Milestone: | → 3.2.11.11 |
|---|---|
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed in version: 3.2.11.11
Note:
See TracTickets
for help on using tickets.

Ahhh hell, good catch, Dave. I see what the problem is.
Note to self: Document that the profile *must* be loaded in order to get environment variables specified in the profile, otherwise a bare-bones environment will be loaded.