Welcome Guest.   Make a donation to an author on the site July 29, 2014, 03:43:55 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: A script in cmd to tell if the logged in user has admin rights  (Read 1284 times)
ewhitchu
Participant
*
Posts: 2

View Profile Give some DonationCredits to this forum member
« on: March 10, 2010, 04:30:07 AM »

I have used in a script, the technique:-
 mkdir \\%computername%\admin$\tester
IF NOT EXIST \\%computername%\admin$\tester\. goto noADMIN
rmdir \\%computername%\admin$\tester
set admin=true
exit /b 0
:noADMIN
set admin=false
exit /b 1

This works for XP and Windows 7 but I do not seem to be able to get it to work in Vista. Any solution that works across all platforms?

I am limited to just command shell, as clients often disable c/wscript and/or powershell.
Logged
AbteriX
Charter Honorary Member
***
Posts: 1,039


Member #520

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: March 10, 2010, 07:12:27 AM »

Don't know, but: Is the Admin$ share is enabled on the Vista box too?
Logged

Greetings, Stefan.
ewhitchu
Participant
*
Posts: 2

View Profile Give some DonationCredits to this forum member
« Reply #2 on: March 11, 2010, 12:59:19 AM »

Hi,

Generally the admin$ share has to be specially activated in Vista (not Windows7 however). Even having done that (a registry hack), the code sample fails.

I have a set of install scripts that must be run in command shell on network-connected systems, because some of my clients still will not allow WSH or Powershell at their sites!! I need a way of deciding if the user doing the install has admin rights before starting it.

There are several MSI installs and some dll registration and file copying involved, so I cannot simply make it one MSI.

Looks like I will have to spend a lot more time and make it a full installer so that I can raise the privilege myself.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.028s | Server load: 0.03 ]