Re: Admin Detection

2003-08-14 Thread xbury . cs

On 12/08/2003 20:51:49 metacard-admin wrote:
Has anyone come up with a way to determine the user privileges of the
current user without writing a file to the drive?

I'm trying to detect whether or not the current Windows user has Admin
rights. If the only way to determine this is to attempt to create a file,
what is the best path to use?

Scott,

on NT4 or W2K only... (it would be nice if someone posted the osx and linux variants ;)

echo %username%
will give you the current user name.

Then, put the result in comparison with 
c:\net localgroup 
Choose the administrator group
net localgroup administrators
you should see your user name in there.

Alternatives:
In a NT domain, the local admin may be useless!
You can find the admins in net group domain admins -- but only from the PDC...
Unless you have EnterpriseAdmin (obsolete I believe) -- more below...


So one simple solution to find out if you are an administrator is this:
c:\net sessions
System error 5 has occurred.

Access is denied.

or
c:\net sessions

ComputerUser name  Client Type   Opens Idle time

--
\\BELLINI  Windows NT 1381 0   00:07:10
The command completed successfully.


For enterprise admin

global EAAvailable 

 put shell(EA) into x
 put The name specified is not recognized is not in x into EAAvailable
 if not EAAvailable then answer EA - Enterprise Administrator is required for this program to work. Maybe EA's path is not in your system's PATH environment variable.

on CheckUserIsAdmin
if EAAvailable then
 local eainfo
 local marshalindomain,deputyindomain
 put shell(ea info) into eainfo
 -- parse this
 --  Marshal in Focus Domain?  Yes, Marshal with all Deputy powers
 --  Deputy in Focus Domain?   Yes
 
 put line lineoffset(Marshal in Focus Domain,eainfo) of eainfo into marshalindomain
 put line lineoffset(Deputy in Focus Domain,eainfo) of eainfo into deputyindomain
 
 get yes is in marshalindomain and yes is in deputyindomain
else
 get access denied is not in shell(net sessions)
end if
 return it
end CheckUserIsAdmin


Visit us at http://www.clearstream.com
  
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream International does not accept legal responsibility for the contents of this message.

The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Any views expressed in this e-mail are those of the individual sender, except where the sender specifically states them to be the views of Clearstream International or of any of its affiliates or subsidiaries.

END OF DISCLAIMER


Admin Detection

2003-08-14 Thread Scott Rossi
Has anyone come up with a way to determine the user privileges of the
current user without writing a file to the drive?

I'm trying to detect whether or not the current Windows user has Admin
rights.  If the only way to determine this is to attempt to create a file,
what is the best path to use?

Thanks  Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia  Design
-
E: [EMAIL PROTECTED]
W: http://www.tactilemedia.com

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard