Link to home
Start Free TrialLog in
Avatar of Jason Paradis
Jason ParadisFlag for United States of America

asked on

Using PsExec with a batch file that asks for %USERPROFILE% or %USERNAME% in it's commands

When I use PsExec with a batch file residing on a remote computer that asks for the %USERPROFILE% or %USERNAME% of the remote session it always returns my username or user profile path.

How do I run this same command so that it returns the currently logged in user's %USERPROFILE% or %USERNAME% without modifying the commands in the bat file or having the user profile credentials from the currently logged in remote user.

These are on Windows 7 64-bit machines that reside within a domain.
SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason Paradis

ASKER

Unfortunately, I should have explained a bit more. My apologies.

I don't need to find out which user is logged on. I need the script to run using the currently logged on user's userprofile and username when it calls for them. Currently, when it runs it uses my profile and name.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So again, I guess I haven't explained correctly. I need to see the results of the batch file as soon as I run it. It's not a batch that does any configuration changes. It just reports on something and displays it in the command window.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial