|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/29/2007 3:24:25 AM
Posts: 13,
Visits: 54
|
|
Hi, this is me !
I've a little strange problem using %userprofile% and %appdata% environment variable in a Batch script (.bat). The script is local, and must be executed on a remote computer :
@echo off
echo Userprofile : %userprofile%
echo AppData : %appdata%
This script is necessary to cpy shortcuts (.lnk) in he Starting folder of Windows and in the task bar (led by Internet Explorer, from %appdata%).
The script works well if I execute it on my local computer.
The script works well if I copy it manually on the remote computer (running from my desk to the remote computer wuith a USB disk ), and returns me the following :
Userprofile : C:\Document and Settings\Administrateur
AppData : C:\Document and Settings\Administrateur\Application Data
But if I use smartCode to execute the script on the rmote computer, I get :
Userprofile : C:\Documents and Settings\Default User
AppData :
The user name used to loggin on the remote computer is "Administrateur", of course 
Is it a bug ?
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: Yesterday @ 7:10:09 PM
Posts: 1,163,
Visits: 1,909
|
|
| It's not a bug. The reason why %USERPROFILE% returns such value is because a temporary windows service created by Remote Exec on a target computer runs under LocalSystem account. I don't remember exactly why it was implemented this way, but I'm sure there was a reason. If I recon it correctly one of the reasons was msiexec.exe. Msiexec wouldn't install an application correctly if the host service would be running not under LocalSystem account. Anyway, I think in v4.0 we will make this it as a configurable option; so a user would be able to specify which account type to use for the temporary service. As I workaround...may be you could try to use "runas" command in your script?!
 Kindest Regards, SmartCode Solutions Support
|
|
|
|