batch file help to call current login profile ssid and reg add value in

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
junqi89
Posts: 4
Joined: 29 Sep 2014 08:17

batch file help to call current login profile ssid and reg add value in

#1 Post by junqi89 » 13 Mar 2020 12:34

hi i need help on this i am trying to call an user ssid and then add a registry value into the ssid registry... The problem i facing if i run the batch file as administrator from other user profile it will call the administrator ssid instead of the userprofile ssid.. how can i overcome this problem to call userprofile ssid when i run as administrator?

For /F "Skip=1 Delims=" %%A In (
'"WMIC UserAccount Where (Name='%UserName%') Get SID"') Do For %%B In (%%A
) Do Reg Add "HKU\%%B\Software\Microsoft\Office\16.0\Common\Identity" /V DisableADALatopWAMOverride /T Reg_DWord /D 1 /F>Nul

Thanks for the help.

scavenger
Posts: 18
Joined: 23 May 2015 13:51
Contact:

Re: batch file help to call current login profile ssid and reg add value in

#2 Post by scavenger » 22 Apr 2020 14:05

when you open a CMD prompt as ADMIN, please type 'whoami'
you will see that you are still the same user.
your user has admin rights that's not the same as loggin in as administrator user or runas another user.
please give more context as why your %username% variable would be different when you run the script as admin

Post Reply