Sign in to follow this  
Followers 0
guru

will ie open when a user is not logged in?

20 posts in this topic

#1 ·  Posted (edited)

The below script is to open an asp page in Internet Explorer at 2:00 am wait for a while and then close it. it works when a user is logged in.. but when the computer is restarted and no one is logged in (ctrl+alt+del login screen)it doesnot work :)

i've used firedaemon to set it as a service and checked interact with current desktop.

please help

; inifinite loop

While 1

if @HOUR = 02 and @MIN = 00 and @SEC = 00 then

  Run("c:\program files\internet explorer\iexplore.exe http://localhost/tools/oc/orgadmin.asp", "", @SW_MAXIMIZE)

  SplashTextOn("||org chart||", "Feedback Process.  Please wait...", 400, 44, -1, -1, 0, "Verdana", 14)

  Sleep(10000)

  SplashOff()

  $PID = ProcessExists("iexplore.exe")    ; Will return the PID or 0 if the process isn't found.

  If $PID Then ProcessClose($PID)

  endif

Sleep(1000)

Wend

Edited by guru

Share this post


Link to post
Share on other sites



I believe windows needs a user to run an application. Try RunAsSet... maybe? You could automate logging in and then do what you need to do then log out. Hmm... hopefully someone else has a better idea.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

runasset didn't work... :) but thanx anyway

it worked only after i logged in... i mean.. waited for a while and logged in as Administrator - ie came up along with splashscreen... the time then was 2:03

script with runasset

; inifinite loop

While 1

if @HOUR = 02 and @MIN = 00 and @SEC = 00 then

  RunAsSet("Administrator", @Computername, "password")

  Runwait("c:\program files\internet explorer\iexplore.exe http://wxp-1fl181s/teo/tools/oc/orgadmin.asp", "", @SW_MAXIMIZE)

  SplashTextOn("||orgadmin||", " Maintaining Feedback Process.  Please wait...", 400, 44, -1, -1, 0, "Verdana", 14)

  Sleep(10000)

  SplashOff()

  $PID = ProcessExists("iexplore.exe")    ; Will return the PID or 0 if the process isn't found.

  If $PID Then ProcessClose($PID)

  RunAsSet()

  endif

Sleep(1000)

Wend

Edited by guru

Share this post


Link to post
Share on other sites

That was a shot in the dark, because I don't think there is a way to run applications in Windows (NT series anyway) without logging into a user account. You could set up the PC with auto login so the user doesn't get the login screen then also bypassing your problem. That sucks for security though. Maybe if I understood why you are opening the page and then closing it I could suggest alternative ways to accomplish what you are after.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

purpose of opening and closing a page:

everyday a report has to be sent to my manager about a yadayada analysis of the prev day in email. so the page opens up - collects the feedback as per the org chart and sends it in a mail.

os: the one i'm workin on is win xp pro..

the os on the server is win 2k server edition

while the server being restarted or shutdown is remote and even if it does someone will immeditely logon as Admin and lock it... i'm just covering myself for a just-in-case situation.

Edited by guru

Share this post


Link to post
Share on other sites

Just right click the desktop and go to properties. Set the sleep time to max, and set it so that it will never log you off or shutdown the power.

Share this post


Link to post
Share on other sites

Just right click the desktop and go to properties. Set the sleep time to max, and set it so that it will never log you off or shutdown the power.

<{POST_SNAPBACK}>

:)

Share this post


Link to post
Share on other sites

That will work... Unless it pisses you off to see the picture on the monitor in the middle of the night, even then, just turn off the monitor =)

Share this post


Link to post
Share on other sites

What python so eliquintly stated is that you need to make sure in your power settings that your computer is not configured to shutdown automitically or hibernate if it is left idle for too long.

This is accompished by right-clicking your desktop, clicking properties. On the "Screen Saver" tab, click the "Power...". A dialog box will appear with 4 tabs. On the "Power Schemes" tab you will find dropdowns labeled "System standby:", and "System hibernates:". Verify that both of these dropdowns have "Never" selected and then click OK, and close the Display properties window.

This will ensure that the system has not been shutdown automatically by Windows. You still run into the occasion that Windows is shut down manually and failed to be logged in on next boot. You may be able to trap this problem by checking the @Username macro. If no user is logged in then it should = "", I believe.

Hope this helps!

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

the server is always on unless some kinda maintainence is going on

Share this post


Link to post
Share on other sites

Thanks for clearing up my post. Sorry if it was confusing at all.

Share this post


Link to post
Share on other sites

Is this script running on your workstation or the server?

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

right now its runnin on my workststion.. if it works that is if i can get it work even if no one is logged in then it'll run on the server

Edited by guru

Share this post


Link to post
Share on other sites

Didn't you say that the server automatically logs in as Admin(locked)? I don't see why you need to worry about it running while not logged in if it automatically does so? Unless there is a way to email the reports without accessing the webpage, I don't see this working.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

this is just-in-case kinda situation... the server this app is hosted on is an internal server IT takes about an hour fix (something in case of a bsod - rare ) and to login as admin and lock it in the mean while if its around 1:30 .. the report doesn't go... i just wanted to be on the safer side thats all :)

Share this post


Link to post
Share on other sites

If your server is a Domain Controller, the RunAsSet should use @LogonDomain instead of @ComputerName.

Local login is disabled on DC's


CheersNobby

Share this post


Link to post
Share on other sites

You script does not show that you need to cklick anything or do something on the website. If you just have to load the website to make sure that the script on the webserver is running you could try URLDownloadToFile. For the webserver there's no difference if the page you've downloaded using URLDownloadToFile is shown by the Internet Explorer or if it's just saved to a file.

Share this post


Link to post
Share on other sites

I don't believe sugi is correct. If you the page contains code other than straight html then it is very possible that if you just open the page (which then processes the script) then it will execute the code which could really do anything. If you only URLDownloadFile the page then it doesn't get processed and does nothing.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

@guru

I know console applications can run without any account being logged in. I run a .cmd script as a service on about fifteen Win2K servers. The script is a loop with a two minute pause that runs various console applications based on changing network conditions. If your problem with IE is caused by it having to open a GUI window then using a console based browser like lynx instead of IE might do what you want.

john925

ps. The service runs under the system account.

Share this post


Link to post
Share on other sites

The below script is to open an asp page in Internet Explorer at 2:00 am wait for a while and then close it. it works when a user is logged in.. but when the computer is restarted and no one is logged in (ctrl+alt+del login screen)it doesnot work :)

i've used firedaemon to set it as a service and checked interact with current desktop.

please help

<{POST_SNAPBACK}>

Not sure if this will work, but I've gotten it to work to have Ghost sessions run on a Win2k server without anyone being logged in.

First, you won't need the WHILE loop or IF @HOUR line in your original script. Just have the script do what you want it to do and compile it.

Now, use the AT command from a Command prompt window to schedule the program to run at 2am:

AT 02:00 /EVERY:M,T,W,Th,F,S,Su yourprog.exe

This will schedule yourprog to run at 2am every Monday, Tuesday, (etc) - but it will be run by the System account.

When I set this up to run a Ghost session on a Win2k server, the script basically did nothing except look for a specific process (I made a copy of Ghost.exe with the same name as the session I wanted to invoke so I could spot the process easily), and if the process wasn't running, I ran it with the needed command line options. I then used the AT command as above to schedule the process to run daily at 6am. I was able to test the app while I was logged in, as well as kill the Ghost sessions I started for testing, and then once I ran the AT command, was able to open the Scheduled Tasks where it shows up as AT#, and right click on it and select RUN to invoke it as SYSTEM.

ONE WARNING - when I ran it from within Scheduled Tasks (or it ran on its own), I was unable to kill the Ghost sessions - insufficient privledge! However, I am able to kill the task using DameWare NT Utilities. You may also be able to kill the task using Sysinternals (free) PSKill (part of PSTools), but I haven't tried it.

Full details on the AT command and its syntax are available in XP's Help file (search for A-Z then click on "Command-line reference A-Z" and click on AT in the listing. If you're running XP, there's an enhanced version of AT called Schtasks - I haven't used it, but it looks like it's more versatile.

Hope this helps.

Jerry

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0