$env:username

edited March 2017 in Powershell
I get a funny when trying to automate with powershell (on startup) and asking for the username/domain
(using set variables from local Windows 10 laptop)

The next two examples giving me a un expected output:
$USERDNSDOMAIN=$env:USERDNSDOMAIN
$USERNAME=$env:USERNAME

username gives me the computername with an $ sign on the end
Userdnsdomain is empty

Suppose these values aren't available on startup?

Comments

  • bravurasoftbravurasoft Redmond, WA
    Can you post the relevant part of the powershell script?
  • Figured it out... script is running under system not user :lol:
    Is there any way I can script user settings?
  • bravurasoftbravurasoft Redmond, WA
    Yes, the OptiTune agent and scripts all run under the LOCAL_SYSTEM account.

    You may be able to launch another instance of powershell as another user, if you know their user name and password.
Sign In or Register to comment.