cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
To help support our community and customers during the outbreak of Coronavirus (COVID-19), LogMeIn is providing free Emergency Remote Work Kits for Health Care Providers, Educational Institutions, Municipalities, Non-Profit organizations, and current LogMeIn customers. For more information please visit https://www.gotomeeting.com/work-remote
Highlighted
New Contributor

Windows Environmental Variables not working via One2Many in Powershell or Batch Files

Hi, I cannot get any windows environmental variables to work in powershell or batch files, such as %useranme% etc.  I am trying to run this simple powershell script.  It works when I run it directly on the user's machine, but not from Logmein:
Add-LocalGroupMember -Group "Administrators" -Member $env:username

1 REPLY 1
Highlighted
LogMeIn Contributor

Re: Windows Environmental Variables not working via One2Many in Powershell or Batch Files

Hi @hileman249,

I'm uncertain why the script would work locally but not through one-to-many.  You might try one of these two options to work around the problem though:

  1. Add a Local Account or Microsoft Account in Command Prompt

  2. Or change User's Account Type to Guest