Ask running Whoami /UPN with RunAsCurrentUser.exe failed

Hi All,

i had problem to get user email using run Whoami /UPN using RunAsCurrentUser.exe
please correct me where i am wrong.

this my script
first tried
waithidden “__Download\RunAsCurrentUser.exe” --w cmd.exe /C echo Whoami /UPN >> d:\default_emailuser.txt

result: file contain text “Whoami /UPN”

2nd Tried
waithidden “__Download\RunAsCurrentUser.exe” --w cmd.exe /C Whoami /UPN >> d:\default_emailuser.txt

result: file blank.

3rd tried
waithidden “__Download\RunAsCurrentUser.exe” --w cmd.exe /C “Whoami /UPN” >> d:\default_emailuser.txt

result: file blank

4th tried
waithidden “Download\RunAsCurrentUser.exe” --w cmd.exe /C “Download\default_email.bat” >> d:\default_emailuser.txt

where default_email.bat contain script “Whoami /UPN” >> c:\default_emailuser.txt"

result: file blank

please help how using RunAsCurrentUser.exe to get email user using batch script.

thanks
Lirus

Your 4th try looks to be the closest. You’ll need the double-underscore in front of download so it should be this:

waithidden "__Download\RunAsCurrentUser.exe" --w cmd.exe /C "__Download\default_email.bat" >> d:\default_emailuser.txt

This is also only if your “default_email.bat” file is already there and the “RunAsCurrentUser.exe” is downloaded with the fixlet as well.

Conversely, you could try to package your Whoami executable with it and run your command directly against it since, given this ActionScript, you would need to do it with the “RunAsCurrentUser.exe” anyway if it’s not already on the machine. Here is a link to the page on RunAsCurrentUser.exe use which I’m sure you’ve already looked at.

You would need the SHA1, the full path to where it would sit on your BES Server, and the prefetch statement. All of which is actually pretty easy with the SHA1 Tool.