There are several different ways of doing this, but beware the pitfalls of 
each:

There used to be a way to do literally what you suggest: Run STAFProc as a 
Windows service. However that method no longer works in modern versions of 
Windows because there was an executable program (I think it's name was 
SRVANY.EXE) that's used to make that work, and that program no longer 
works on recent Windows systems e.g. Vista or Windows/2008.

There is a method documented in the STAF documentation, available right in 
the installation wizard, to start STAF at startup, but if you look behind 
the covers it's really running it at user login. That's ok, if you start 
your machines and immediately log in, but if you're in the habit of 
rebooting your machine (or having it rebooted for you) and you don't 
immediately log in, your machine will not be contactable by STAF until 
someone logs in. This method uses the Windows "scheduled task" facility to 
schedule a task to run STAFProc and specifying that the task should be 
scheduled to run "At Logon".

To overcome the limitation mentioned above (where STAF doesn't start after 
a reboot, until someone logs in) you might think to change the scheduled 
task from a schedule of "At Logon" to "At System Startup". That works, 
sort-of: True, STAFProc starts during system startup, so it comes up 
automatically after a reboot. That's good. 

However, if it's started in this way, we have found, that since STAFProc 
is invoked by Windows during startup it's essentially the same as running 
as a service, and modern Windows versions impose limitations on services 
interacting with the Windows desktop. The specific problem that this 
causes is this: If you use STAF to drive tests on the system, and if some 
of the tests use GUI testing tools (such as Rational Functional Tester), 
then the tests don't work because the test tool (RFT) can't "see" the 
Windows desktop and running applications.

This problem DOES NOT occur if you use the STAF-provided method, where it 
schedules the task to run "At Logon".

So the solution we have hit upon is to DO BOTH of the following:
1. Use the STAF-provided method to start STAFProc at startup (which really 
means "at user logon").
2. Use the Windows facility called AutoAdminLogon, where you set some 
registry keys to specify a userid and password to log on as.

In this mode, when Windows reboots it automatically logs on as that user, 
which in turn triggers the STAFProc scheduled task and RFT is able to 
"see" the desktop. Life is good.

There are several ways to enable AutoAdminLogon but the way I do it is via 
a .reg file. I take text like the following:

----Snip----
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"="1"
"DefaultDomainName"="MyWindowsDomain"
"DefaultUserName"="MyUserId"
"DefaultPassword"="MyAdminPassword"
----Snip----

...and put it into a file with an extension of .reg. Then, doubleclick the 
file from a directory window or type the filename in a Command Prompt, 
respond positively to the prompts, and it'll set the appropriate registry 
values to enable this feature.

----------------------------------------------------------------------------------------
Joe Veilleux
IBM/Lotus Domino Server Quality Engineering
5 Technology Park Drive
Westford MA 01886
Email: joeveill...@us.ibm.com




clayton neal <clayton_n...@yahoo.co.uk> 
06/12/2009 01:36 PM

To
staf-users@lists.sourceforge.net
cc

Subject
[staf-users] STAF as windows service






Hiya,

To run STAF a user has to be logged onto the machine
Is there a way to run STAF on a machine as a Window Service, which is 
executing when no user is logged in ?

Regards

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to