|
|
|
|
Group: Forum Members
Last Login: Friday, June 29, 2007
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 ?
|
|
|
|
|
Group: Administrators
Last Login: Yesterday @ 7:44 PM
Posts: 1,582,
Visits: 2,954
|
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?!
 We are looking for investors and business partners. Please contact us for more details
Kindest Regards, SmartCode Solutions Support
|