Advertisement
ForeverZer0

Run As Admin Check

Sep 3rd, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.21 KB | None | 0 0
  1. def elevated?
  2.   whoami = `whoami /groups` rescue nil
  3.   if whoami =~ /S-1-16-12288/
  4.     true
  5.   else
  6.     admin = `net localgroup administrators | find "%USERNAME%"` rescue ""
  7.     admin.empty? ? false : true
  8.   end
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement