in Education by
I have a task coming up where I have to manually enter an HKEY_USER key value and string value for every single Windows profile on all computers. This could take some time. I have leant to automate them all, or at least, some of the processes. I have the adding key process (from a list of sids.txt) working: @echo off pushd %~dp0 for /f "usebackq tokens=*" %%A in ("SIDS.txt") do ( REG ADD "%%A\create\key\here" /f REG ADD "%%A\create\key\here" /t REG_SZ /d "add string value here" /f ) pause To further speed things up I was hoping to get some help getting the SID from each user profile from here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList For each SID listed e.g.: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-2686047782-4092528985-2296408390-1413 Within the keys there is a profile-image-path value which contains the name of the Windows user profile. What I would like to be able to do is pump the Windows profile name and the sid into a text file formatted like the following, then I can edit fairly quickly, remove non-Windows user profile entries (like default or system accounts) and run my working code above against the listings - edited to have just a list of SIDS like in the working code above. S-1-5-21-2686047782-4092528985-2296408390-1413 mickey.mouse S-1-5-21-2686047782-4092528985-2296408390-1411 Donald.duck JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Simplest method would beto do it with wmic useraccount query: wmic useraccount get name,sid | findstr /vi "SID">somefile.txt type somefile.txt This would list every account and redirect output to a file called somefile.txt and it will simply type the file to show you the content of the file. Another way is to see if the userprofile directory exists. which should eliminate system accounts. @for /f "delims=" %i in ('wmic useraccount get name^,sid ^| findstr /vi "SID"') do @for /F %a in ("%i") do if exist "C:\users\%a" @echo(%i>>somefile.txt

Related questions

0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    My script launches a MS Edge window and then tries to log into Netflix with my credentials. The problem ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I have an HTML page that contains some filenames that i want to download from a webserver. I need ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I have already tried to make a login form and I also want to display the user login profile that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have already tried to make a login form and I also want to display the user login profile that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Windows will automatically generate a domain-wide __________ security certificate for any user who encrypts a file for the first time. Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    I would like to display a twitter user profile without having the app prompt the phone user for creating an ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I'm starting out with force.com development, and I'm currently a little hazy about what the above terms all mean. ... (if at all)? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    _________ databases are used to store Session information, User profile, preferences, and shopping cart data. (1)Key-Value Pair (2)Graph (3)Document (4)Column...
asked Apr 21, 2021 in Technology by JackTerrance
0 votes
    Can two users have the same profile? Can two profiles be assigned to the same user in Salesforce?...
asked Nov 11, 2020 in Technology by JackTerrance
+1 vote
    _________ databases are used to store Session information, User profile, preferences, and shopping cart data....
asked Oct 11, 2020 in Education by anonymous
0 votes
    Inno Setup is a nice easy to use installer. It is rated high in this stackoverflow question. I have ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
...