Hi,

I'm using a script where i'm piping a command to a text file on around 1000 pc's so for easy individual results i'm piping the command to %username%.txt in a batch file. This works without a problem if I run the command manually on a machine but when I put the command in to a Kace script i just get files generated called .txt instead of bob.txt, mary.txt, jim.txt etc

I understand this is probably due to the command running as the local system account instead of the user logged in.

Any idea on how I can get around this little problem?

Thanks!

Ben.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
You could write an AutoIt script to perform a RunAs or select a username from a logged on session that isn't the local SYSTEM account. I don't think there is any way you can accomplish your goal using KBOX scripting. Scripts will all run as SYSTEM, and the %username% variable is dependent on the profile the script is run in. You could try using the machine name instead of the username, but if you want the username you'll need to write some VBS or AutoIt to poll logged on users from active sessions.
Answered 01/22/2010 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
If you're interested in going the AutoIt route, I've found a function created by an AutoIt user to return the username of the console session (i.e. the person logged on directly to the machine).

http://www.autoitscript.com/forum/index.php?showtopic=102764
Answered 01/22/2010 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
%computername% was good enough for me! excellent! thanks!
Answered 01/22/2010 by: bwarren33
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity