Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > how can a Perl script for Win32 tell if it's running as an admin?

Reply
Thread Tools

how can a Perl script for Win32 tell if it's running as an admin?

 
 
Bennett Haselton
Guest
Posts: n/a
 
      06-03-2004
Is there a way for a Win32 Perl script running under Windows 2K/XP to
determine if it's running as an administrator? (Not necessarily *the*
administrator account, but any account with local admin privileges.)
Other than a hack like trying to write to a normally restricted
directory or registry key.

-Bennett
 
Reply With Quote
 
 
 
 
Jack Challen
Guest
Posts: n/a
 
      06-03-2004
Bennett Haselton wrote:
> Is there a way for a Win32 Perl script running under Windows 2K/XP to
> determine if it's running as an administrator? (Not necessarily *the*
> administrator account, but any account with local admin privileges.)


Try searching the docs for the Win32 module on CPAN for the string "admin"

cheers

jack
 
Reply With Quote
 
 
 
 
Bennett Haselton
Guest
Posts: n/a
 
      06-03-2004
Jack Challen <(E-Mail Removed)> wrote in message news:<tmCvc.1$OG.321@psinet-eu-nl>...
> Bennett Haselton wrote:
> > Is there a way for a Win32 Perl script running under Windows 2K/XP to
> > determine if it's running as an administrator? (Not necessarily *the*
> > administrator account, but any account with local admin privileges.)

>
> Try searching the docs for the Win32 module on CPAN for the string "admin"
>
> cheers
>
> jack


Great minds think alike Before posting this mesasge I had already
searched all the local HTML docs for the Win32 module for the string
"admin", but I couldn't find anything, so that's when I asked here.

I went to
http://cpan.uwinnipeg.ca/dist/Win32/
to do a search to see if anything had been created more recently, but
the search bar wouldn't let me search just within that module.

Are you aware of some function in that module that does what I need,
and you were trying to lead me there without spoonfeeding me or
were you just giving me a suggestion as the first place to look?
Anybody have ideas for a second place?...

-Bennett
 
Reply With Quote
 
David K. Wall
Guest
Posts: n/a
 
      06-03-2004
Bennett Haselton <(E-Mail Removed)> wrote:

> Jack Challen <(E-Mail Removed)> wrote in message
> news:<tmCvc.1$OG.321@psinet-eu-nl>...
>> Bennett Haselton wrote:
>> > Is there a way for a Win32 Perl script running under Windows
>> > 2K/XP to determine if it's running as an administrator? (Not
>> > necessarily *the* administrator account, but any account with
>> > local admin privileges.)

>>
>> Try searching the docs for the Win32 module on CPAN for the
>> string "admin"

>
> Great minds think alike Before posting this mesasge I had
> already searched all the local HTML docs for the Win32 module for
> the string "admin", but I couldn't find anything, so that's when I
> asked here.


Hmm. I searched my local copy of the Win32 docs and found
Win32::IsAdminUser().

I'm using Activestate Perl 5.8.3, build 809.


C:\> perl -MWin32 -e "print $Win32::VERSION"
0.22


> Are you aware of some function in that module that does what I
> need

[snip rest of sentence]

I suspect he was.

 
Reply With Quote
 
MrReallyVeryNice
Guest
Posts: n/a
 
      06-04-2004
In addition to the suggestions provided above, you might also consider this
post:

http://groups.google.com/groups?hl=e...&th=bc17797480
3e52b3&seekm=muadnaaNJo41huvdRVn-sA%40comcast.com#link2

Let us know if that solves your problem.
MrReallyVeryNice


 
Reply With Quote
 
Jack Challen
Guest
Posts: n/a
 
      06-04-2004
Bennett Haselton wrote:
> I went to
> http://cpan.uwinnipeg.ca/dist/Win32/
> to do a search to see if anything had been created more recently, but
> the search bar wouldn't let me search just within that module.


Hmm... oddness
I went to http://search.cpan.org/~nwclark/perl...Win32/Win32.pm

and used my browser's "find in this page" option to look for "admin".
This found me Win32::IsAdminUser()

> Are you aware of some function in that module that does what I need,
> and you were trying to lead me there without spoonfeeding me or
> were you just giving me a suggestion as the first place to look?


Sorry, had assumed zero effort on your part, and was trying to lead you to
the answer, so your assumption was correct

cheers
jack
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Trouble running Perl script from within a Perl script laredotornado@zipmail.com Perl Misc 4 07-29-2011 01:44 PM
CAN any one tell it whats the code tell it yogesh C++ 1 03-14-2007 01:12 PM
Script to Tell Tell Time then Limit by it? Mike A Javascript 17 11-19-2003 02:16 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments