Do Online Kscripts, ran as logged in user, return the values for %username% and %userdomain% windows environment variables?
Is it possible to run an Online Kscript (ran as the logged on user) and have it return the logged on user's username and domain values with %username% and %userdomain%?
If the kscript is being run as the logged on user then shouldn't those %username% and %userdomain% return that user's username and domain.
This is preventing the desired outcome from my kscript.
Thanks in advance
Answers (2)
From some of the other posts I've seen, variables tend to be a mixed bag. One thing to keep in mind is the account the script is running under - if it's set to run as System, AFAIK you won't be able to target user-specific items, so if that's your goal you'll probably want to set up the script to run as the curretly logged in user.
If you could advise on exactly what you are trying to accomplish with your script, more specific recommendations could be made, but it's currently a little open-ended and there are many possibilities.
John
Comments:
-
I made the kscript an Online Kscript so that I could select the option for it to run as the logged in user, so it is running as the user that's logged in and doesn't run when no one is logged in. The whole purpose of the kscript is to remove the logged in user from the local administrators group (if they are in this group and if it isn't the local "Administrator" account that's logged in). Thanks for replying. - bh585 12 years ago
I'm running vbscripts that successfully pull the currently logged in user, full scripts are here:
http://www.itninja.com/blog/view/inventorying-reporting-on-user-profile-specific-other-non-inventoried-data
So it appears it's possible, but I have read of others having issues with the environment variables.
I'm assuming your script runs correctly when run outside of the K1000 (i.e. locally & manually) - if that's the case, it could either be a bug (I would call support and have them advise) or possibly the script not being setup correctly (search on this forum for example configs). I've reported a number of bugs (or things that just don't work 100%), so it wouldn't be shocking if that's what it turns out to be - would be good to make sure support is aware of it though, which is why I usually call them.
John