Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 20

Runas batch including password

$
0
0

Lol, I love my solution.. thanks @Meganerd for a step in the right direction!

Script (if script not elevated, re-run "self" as Administrator):

@echo off
whoami /groups | find "S-1-16-12288"

if NOT %errorlevel% == 0 (
  runas /savecred /user:%computername%\administrator "%~f0"
  exit
) else (
  cls
  echo Re-ran as Administrator
)
:: Do Something...
pause


Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles





Latest Images