/build/static/layout/Breadcrumb_cap_w.png

Kace script to give local admin rights to logged in user in windows.

In response to a ITNinja question I came up with this method to script this without having to change the script for every user/machine you want to do this on.

We have had situations where we have to give the current user admin rights then take it away later.

Create a online shell script for windows.
Choose the proper Deploy system settings
Choose under "Windows Run As" - Local System

Sw7ai4.jpeg
wmic computersystem get username /format:list > C:\ProgramData\Dell\KACE\user\Cuser.txt

for /f "tokens=2 delims== skip=2" %%G in ('type C:\ProgramData\Dell\KACE\user\Cuser.txt') DO net localgroup administrators /add %%G

del C:\ProgramData\Dell\KACE\user\Cuser.txt /q



Comments

  • to remove the rights change /add to /delete - SMal.tmcc 9 years ago
  • Great idea, thanks for sharing :D - Glaporte 9 years ago
  • Will the user become an admin in their current session or must they logoff and re-login to gain admin privileges? - flip1001 9 years ago
    • will need to log off, you can add that to the script if you want - SMal.tmcc 9 years ago
  • Are there any method to make the user get admin privileges without logoff ???????? - moh_elhendy 8 years ago
    • no the user rights are checked at login - SMal.tmcc 8 years ago
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ