Quantcast
Channel: Remote Desktop Services (Terminal Services) forum
Viewing all articles
Browse latest Browse all 1106

query user %USERNAME% fails

$
0
0

I have a new AWS instance with Windows Server 2019 (x64) I need to run some batch scripts but fails.

Part of the script is

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
  %windir%\System32\tscon.exe %%s /dest:console
)

found that following line is failing...

query user %USERNAME%

when I Run separately above line in command line gets ....

No User exists for My.User_dev
.................................................................................................. 

if I query like query user will list as my.user_dev  

which is actual  user I'm logged in with.

...................................................................................................

If I run following...

query user My.User_dev

same...error displayed.

and following 

query user my.user_dev

Same...

No User exists for my.user_dev


........................................................................................................

How could I solve this ? I'm new to windows scripting.

Note...this is windows command line script not powershell...since there there is no forum specific to windows script , posted under powershell 

Viewing all articles
Browse latest Browse all 1106

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>