Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

System Error 1312 when using calling Perl via WinNT's AT command

by Anonymous Monk
on May 28, 2002 at 22:47 UTC ( [id://169929]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have an Active State Perl v5.6.1 script running on Windows NT Server that works just fine when I double click on it, however, it has a specific error when it is called via a schedule using Windows NT's AT command.
The error is "System Error 1312. A specific logon session does not exist. It may have already been terminated"

The Perl that is causing the problem is...
system ("NET USER /ADD $theStudent $thePassword");

Normally the NET command can be called in Perl, but it seems that calling the command in Perl via the AT command somehow does not give the same level of system access.

I tried calling the command thus...
system("CMD /C NET USER /ADD $theStudent $thePassword");
but it was the same.

If you have Windows NT / 2000 specific information on why this is occuring, I'd like to hear from you.

david.bakkers@centralcollege.edu.au
  • Comment on System Error 1312 when using calling Perl via WinNT's AT command

Replies are listed 'Best First'.
(RhetTbull) Re: System Error 1312 when using calling Perl via WinNT's AT command
by RhetTbull (Curate) on May 29, 2002 at 00:01 UTC
    I think the problem is probably with the permissions that the Scheduler service (which is used by the AT command) is running with. By default, the Scheduler service runs from the local System account which is a local account w/o network priveleges. Go to Control Panel->Services->Scheduler and make sure the Scheduler is set to start from an account with the right permissions to do what you want.

    On Windows 2000, it's easier to use the Scheduled Task feature in the Control Panel than the AT command and Scheduler service. In the Scheduled Tasks properties dialog for your task, you can enter a username/password to run the script as.

      ...you can also use the /interactive switch in the at command and it should use currently logged on credentials.

      Disclaimer: I haven't tested this as I don't have a Perl enhanced Win2k machine here right now.

      Update: Well, looks as if the /interactive switch wasn't it :) I just read the reply after trying this earlier today...no go.

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
        Thanks for the idea Wrex, but that wasn't it. It was the Schedule service's requirement for local Administrator access rights. I am using the /interactive switch though, as I like to see the Perl activity happen in a CMD window. I was recently caught out by running a PERL script that opened a file but had an error and was waiting for me hit return before altering the file and closing it. I mistakenly called the script via the AT command, without the /interactive switch, and couldn't for the life of me work out why the file was always locked and the script would not run again unless I rebooted. The script was waiting, invisibly, for me to hit return. I now never call a Perl script via AT without the /interactive switch unless I am POSITIVE that it is bug-free.
      Thank ever so much sensei. That turned out to be the answer :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-18 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found