Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

perl based windows "login" script

by seven.reeds (Initiate)
on Dec 19, 2012 at 20:10 UTC ( #1009624=perlquestion: print w/ replies, xml ) Need Help??
seven.reeds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Windows has script hooks for user login/logout and system start/stop these are available through the gpedit tool. I have a perl script that I would like to run via these hooks. My windows admin is telling me some troubling things though.

My goals include:

  • have the script live in non-User space, some directory owned by Admin that plain users can not otherwise reach
  • have the script execute with the User's environment (profile)

On a Linux box I might put the script in /usr/local/sbin and let a sudo'ers file deal with the execution. Is there a Windows equiv to sudo?

My Windows admin is telling me that Windows will not let him run perl scripts as Administrator -- a la, right click the script name and select "Run as Administrator". He says the only way for this script to work is to have it in a place where ALL users can "see" it and execute it.

Since the script uses paths and passwords for things that regular users should not know I am very concerned.

Is there a way to protect the script while allowing it to be run by the masses?

Seven

Comment on perl based windows "login" script
Re: perl based windows "login" script
by tobyink (Abbot) on Dec 19, 2012 at 20:43 UTC

    runas is roughly equivalent to sudo.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: perl based windows "login" script
by VinsWorldcom (Priest) on Dec 19, 2012 at 21:02 UTC

    As tobyink points out, 'runas' is the Windows command line equivalent to 'sudo', so have a look at that.

    Also, I'm on Windows 7 x64 with Strawberry Perl 5.16.1. When I Shift-right-click on a .pl file, I can confirm I do NOT get a "Run as administrator" option. However, I DO get that option for .bat (Windows batch files). Strawberry Perl comes with 'pl2bat', so maybe give that a test drive.

    NOTE: 'pl2bat' basically wraps the Perl script in a Windows batch file - it doesn't "convert" it.

Re: perl based windows "login" script
by rpnoble419 (Pilgrim) on Dec 19, 2012 at 23:37 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1009624]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-12-28 22:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls