07-23-2023, 12:47 AM
I need the below command second column output `<USERNAME>` result to variables:
query sessions|find "Active"
>console <USERNAME> 1 Active
I know the `%USERNAME%` OR `whoami` could get the current user name but this script will run using administrator account and will need to be able to capture the current active logon username. If I could select the second column of the output results and assign it to a variable.. this will be a great help.
query sessions|find "Active"
>console <USERNAME> 1 Active
I know the `%USERNAME%` OR `whoami` could get the current user name but this script will run using administrator account and will need to be able to capture the current active logon username. If I could select the second column of the output results and assign it to a variable.. this will be a great help.