Runascurrentuser issue

(imported topic written by MBARTOSH)

I created a task using the Software Distribution Dashboard. On the task, I checked the box to run as current user. Now when I run the task nothing happens. I am trying to copying Java cache files to the user’s Java cache. I have seen it work, but most of the time it fails.

I am seeing this in the client log file but I don’t know what it means.

Command succeeded (Exit Code=-1) wait “C:\Program Files\BigFix Enterprise\BES Client__BESData\CustomSite_Test_Package__Download\RunAsCurrentUser.exe” run.bat (fixlet 4748)

(imported comment written by MBARTOSH)

The answer is in this thread http://www-01.ibm.com/support/docview.wss?uid=swg21506033.

Briefly, the problem is that current user does not have permission to even access the BES Client directory. I am completely befuddled. Why not read and execute authority.

The suggestion is to move the source to a folder the current user has access to. This sounds very simple, but I have no clue how to do it. Can someone help me out?

(imported comment written by SystemAdmin)

Hi,

Something we have done to work around this issue when deploying the TRC Controller is to copy the file to the user’s home directory and execute the RunAsCurrentUser command with that copy of the file.

Here is the relevant section of the action script that shows how the user’s home directory is saved as a parameter and then used for the command executed as the user, which is just to apply a .reg file to the user’s registry settings. There might be better ways to do it, but hopefully you find it useful.

parameter 
"tmp_dir" = 
"{value of variable "SystemDrive
" of environment & "\
" & (following text of first "\
" of it) of (preceding text of last "%00
" of it) of (value "ProfileImagePath
" of key ("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\
" & (component string of sid of security account (name of current user))) of registry as string)}" delete 
"{parameter "tmp_dir
"}\regTivoliRC.reg" copy regTivoliRC.reg 
"{parameter "tmp_dir
"}\regTivoliRC.reg"   prefetch RunAsCurrentUser.exe sha1:ee47505ebfb2790b9da8a20ed70e67158e9753d0 size:342528 http:
//software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe   utility __Download\RunAsCurrentUser.exe   

if 
{exists file 
"reg.exe" of system folder
} waithidden __Download\RunAsCurrentUser.exe --w --q cmd.exe /c reg.exe IMPORT 
"{parameter "tmp_dir
"}\regTivoliRC.reg" 

else waithidden __Download\RunAsCurrentUser.exe --w --q cmd.exe /c regedit.exe /s 
"{parameter "tmp_dir
"}\regTivoliRC.reg" endif delete 
"{parameter "tmp_dir
"}\regTivoliRC.reg"

(imported comment written by MBARTOSH)

Thanks for the excellent response. Do you know why I can’t just say:

parameter “baseFolder” = variable “temp” of environment

(imported comment written by SystemAdmin)

You might be able to do that, what I don’t know is if you might find the same sort of issues with permissions.

I think you would be getting the value of %TEMP% of the LocalSystem account, unless your BesClient service is running as a specific user. I’m not sure if the the value of this environment variable for LocalSystem is the one that shows under System variables in the System properties > Environment Variables dialog in the Computer properties, which would have a default value of c:\windows\temp. So assuming this folder would get returned consistently and the users wouldn’t have permission issues with it, then it would be a valid alternative.

(imported comment written by MBARTOSH)

Unfortunately the your code return the path: C:\WINDOWS\TEMP\Documents and Settings\username rather than c:\Documents and Settings\username\local settings\temp or for Windows 7 c:\users\usernam\AppData\local\temp.

(imported comment written by SystemAdmin)

That’s interesting, thanks for letting me know. I’ll review it and post an update.

(imported comment written by MBARTOSH)

I was able to get runascurrentuser to work by modifying the generated code from the Software Distribution Dashboard.

I replaced the line where run.bat is executed with the following 3 lines.

dos mkdir “c:\Program Files\BigfixCache”

waithidden cmd.exe /C xcopy “__Download” “c:\program files\bigfixcache” /E/V/I/H/R/Y

wait “c:\Program Files\BigfixCache\RunAsCurrentUser.exe” --w --q cmd.exe /c “c:\Program Files\BigFixCache\precache.bat”