?
Solved

admin

Posted on 2006-04-25
19
Medium Priority
?
233 Views
Last Modified: 2011-09-20
i have perl script and i am logged in as administrator

how do i make my per script is running as an administrator and not IUSR_machinename account
0
Comment
Question by:perlperl
  • 11
  • 6
  • 2
19 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 16537026
Is this when you run the script from the command prompt, or when a webserver runs the script?
0
 

Author Comment

by:perlperl
ID: 16538373
command prompt
0
 
LVL 39

Expert Comment

by:Adam314
ID: 16539178
The script should run as administrator (or whatever logon name is used) when you run from a command prompt - unless the script attempts to change users on it's own.


Have you looked at the USERNAME environment variable from within the script?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 2000 total points
ID: 16541417
runas /user:administrator your-script.pl
0
 

Author Comment

by:perlperl
ID: 16546242
is this a dos command

/user:administrator perl script.p,
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16546647
yes/no, just C&P to cmd.exe
0
 

Author Comment

by:perlperl
ID: 16546705
i get this


C:\>runas /user:administrator perl xl.pl
RUNAS USAGE:

RUNAS [/profile] [/env] [/netonly] /user:<UserName> program

   /profile        if the user's profile needs to be loaded
   /env            to use current environment instead of user's.
   /netonly        use if the credentials specified are for remote access only.
   /user           <UserName> should be in form USER@DOMAIN or DOMAIN\USER
   program         command line for EXE.  See below for examples

Examples:
> runas /profile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""

NOTE:  Enter user's password only when prompted.
NOTE:  USER@DOMAIN is not compatible with /netonly.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16546835
you have to use you domain also, instead of
  /user:administrator
use
    /user:Your-Domain-here\administrator
then you also have to quote the command with its options:
  "perl xl.pl"
0
 

Author Comment

by:perlperl
ID: 16547930
how to find domain name
0
 

Author Comment

by:perlperl
ID: 16547949
i tried that, i get
"attempting to start perl test.pl and nothing happened
0
 

Author Comment

by:perlperl
ID: 16547960
first it prompted for password...after entering correct password...nothing happened...it just exited without any error saying
attempting to start perl test.pl
0
 

Author Comment

by:perlperl
ID: 16547967
but when i do
echo %errorlevel%, i get
1

which there was something wrong
0
 

Author Comment

by:perlperl
ID: 16547986
the complete message was
attempting to start perl test.pl as user domain\Administrator....
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16548002
does your script run as normal user?
0
 

Author Comment

by:perlperl
ID: 16552584
how do i find that......
wat i know is i have loggen in to this host as Administrator
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16552963
> how do i find that......
perl test.pl
0
 

Author Comment

by:perlperl
ID: 16556577
when i login to the host,
i enter username "Administrator" and some password....but when i m trying to do some operations, i get access denied...
Am i the administrator or not?
0
 

Author Comment

by:perlperl
ID: 16556626
when i go to to
my computer -> manage -> local users and group  -> users
if i right click Administrator -> properties

i get,

"could not prepare property pages because: access is denied"

why do I get this message even i am logged is as administrator, or someone else is the administror with diffeent username
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16557220
so we do not have a perl nor a programming problem, but a permission problem with your system?
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question