I'm getting error when I ran the batch file like this,
Could not connect session Id 12 to session name console, error code 5
Error [5]: access denied
and I'm attaching the batch file.
This is my code, I need disconnect ane lock the vm by using this batch file code
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)
rem Rundll32.exe user32.dll, LockWorkStation