JSI Tip 9611. How can I use a startup script to make every user that logs onto my domain a local administrator of the PC they log on to?

Use tip 5609 ยป How do I assign scripts in Windows to assign a startup script to each PC in the domain.

To make every user that logs onto the domain a local administrator of the PC they logged on from, the start script should contain:

@echo off
setlocal
set OK=N
for /f "Tokens=*" %%a in ('%SystemRoot%\system32\net.exe LOCALGROUP "Administrators" ^|%SystemRoot%\system32\find.exe /i "NT Authority\Interactive"') do (
 set OK=Y
)
If "%OK%" EQU "N" %SystemRoot%\system32\net.exe LOCALGROUP "Administrators" "NT Authority\Interactive" /ADD
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish