|
Answer» is there any way from an admin ACCOUNT on an xp pro pc to only use cmd to change a users account type from limited to another admin when you know the PASSWORD for that limited user account.
I know its easier to just to do it from the "User Accounts" applet in the control panel but i want to do it only by using the CMD though..
so is this possible at all. If so then how would i go about doing it then..??
thanx for anyones help.YES, it should be pretty easy. I think a limited account is just an account that is not a member of the local administrators group. Assuming that is the case, it should work by doing:
Code: [Select]net localgroup Administrators gumbaz /addJust change "gumbaz" to the account you want to promote. If you want to take it back down, then try:
Code: [Select]net localgroup Administrators gumbaz /deletehey thanks, it worked... now is there a way to CHECK to see what each users account type is via only CMD so it lists them out like: Bob - Admin Jane - Admin Sam - LimitedI wrote a batch file a while back that does something very similar as part of its task. Here is a modified version that is probably overkill for what you are looking for, but it should do what you want:
Code: [Select]echo off
setlocal echo. echo User accounts found: echo -------------------- call :ProcessAccounts EchoUsers goto :EOF
:ProcessAccounts for /f "delims=" %%a in ('net user ^| find " "') do call :ListAccountsSub "%%a" %~1 goto :EOF
:ListAccountsSub rem Check for blank fields by testing for null string where spaces should be set unam=%1 if "%unam:~21,2%"==" " call :%2 "%unam:~1,20%" if "%unam:~42,2%"==" " call :%2 "%unam:~26,20%" if "%unam:~71,2%"==" " call :%2 "%unam:~51,20%" goto :EOF
:EchoUsers net localgroup Administrators | findstr /i /c:%~1>NUL if not ERRORLEVEL 1 (set type=Admin ) else set type=Limited echo %1|findstr /I "Administrator ASPNET Guest HelpAssistant IUSR IWAM krbtgt Support_ tmpl">NUL if errorlevel 1 (echo %~1 - %type%) else (echo %~1 - %type% ** Probably a System Account) goto:EOF would you mid explaining a lil about what each part of that code does exactly please.??
Also is there a way to script some batch code to put all the non Admin users into the Admin group regardless of what name the user has, so like some type of variable that just looks and sees all the users available that are not admins and then changes all those limited accounts into admins...
is there anyway to do that..??No problem. Here is the code with comments:
Code: [Select]echo off rem Store the existing environment setlocal echo. rem Echo header to the screen echo User accounts found: echo -------------------- rem Call the ProcessAccounts function call :ProcessAccounts EchoUsers rem After function is run goto the EndOfFile (exit the program in this case) goto :EOF
:ProcessAccounts rem Process each line of the "net user" command and pass the information to the LisAccountsSub function for /f "delims=" %%a in ('net user ^| find " "') do call :ListAccountsSub "%%a" %~1 rem After function is run, goto the EOF (go back to the calling function in this case) goto :EOF
:ListAccountsSub rem Check for blank fields by testing for null string where spaces should be set unam=%1 rem The net user command lists the names in 3 columns. rem If there are spaces at specified locations, then there should be a valid name before the spaces if "%unam:~21,2%"==" " call :%2 "%unam:~1,20%" if "%unam:~42,2%"==" " call :%2 "%unam:~26,20%" if "%unam:~71,2%"==" " call :%2 "%unam:~51,20%" After the function is run, goto the EOF (go back to the calling function in this case) goto :EOF
:EchoUsers rem run the net localgroup Administrators command, and compare the results to the current user net localgroup Administrators | findstr /i /c:%~1>NUL rem If the findstr does not have an errorlevel of 1, then the name was found. rem If the name was found, then that user is probably a member of the local Administrators group rem Note that if there is a short name contained within a longer name that is also a user this may be a false positive rem if the user is not a member of the Administrators group, they must be a "Limited" user rem Set the TYPE variable to output later if not errorlevel 1 (set type=Admin ) else set type=Limited rem if the username contains any of these names, then it is likely a system account not created by the user echo %1|findstr /I "Administrator ASPNET Guest HelpAssistant IUSR IWAM krbtgt Support_ tmpl">NUL rem Output the results of what we found for this user to the screen if errorlevel 1 (echo %~1 - %type%) else (echo %~1 - %type% ** Probably a System Account) rem goto EOF, to continue the loop until we run out of information goto:EOF And, yes there is a way to put each user in the Administrators group ... but I wouldn't recommend this. But if you REALLY want to do this, you could add a line like:
Code: [Select]if %type%==Limited net localgroup Administrators %1 /AddBut, again; I would recommend against doing this.sorry that code just seems a lil too advanced for me..
how would i code just a simple lil bat script to just convert all available accounts to Admin accounts with no confirmations or what not..
I'm sure its probably not recommended to do this, but its for testing purposes in a vmware environment though.
|