13

I need to run overnight automation testing using RFT and IE on Windows7 virtual machine. I found that restarting the Windows box before the testing starts helps.

I am moving the production environment from Windows XP to Windows 7. RFT used to complain when running RFT scripts that CRFCN0557E: Activation failed when running under a Terminal Services environment. This may be caused by using a minimized terminal window - try playing back without minimizing the terminal window (it does not need to be full-screen).

Running tscon.exe 0 /dest:console prior starting any RFT script fix the error on Windows XP. But not on Windows7.

I did some research and was trying for hours to fix that but nothing helped. There is no screen saver turned on on Windows7.

I tried to run both but nothing helped.

tscon.exe 0 /dest:console
tscon.exe 1 /dest:console

On Windows7 tscon returns

{ErrorPrintf(): LoadString failed, Error 15105, (0x00003B01)}
Error [15105]:The resource loader cache doesn't have loaded MUI entry.
Error [0]:The operation completed successfully.

On Windows XP tscon returns

Could not connect sessionID 0 to sessionname console, Error code 7045
Error [7045]:The requested session access is denied.

I just double checked that running tscon.exe 0 /dest:console on Windows XP solves the issue. Cannot understand the output of the tscon command then.

Any idea how I can run RFT scripts after I restart the Windows box automatically? Preferably without involving any other computer. I was even thinking to use the old Windows XP to make remote desktop session to make RFT happy. I hope there is other better solution to that.

Radek
  • 1,133
  • 4
  • 26
  • 38
  • I created another question that might be related. http://serverfault.com/questions/429364/how-to-run-a-command-as-administrator-on-windows7-from-a-command-line – Radek Sep 19 '12 at 02:40
  • Also this looks promising http://msdn.microsoft.com/en-us/library/windows/hardware/gg463353.aspx not sure what it means for me. – Radek Sep 19 '12 at 02:41

2 Answers2

15

Before I get to your primary issue I'd like to point out that the fact that you are getting the message

{ErrorPrintf(): LoadString failed, Error 15105, (0x00003B01)}
Error [15105]:The resource loader cache doesn't have loaded MUI entry.

is an indication that something has become corrupted on your system. MUI is the multilingual user interface. Is the Windows 7 computer in question set to use a language other than "English (United States)"? It looks like tscon is trying to find and display an error message in your configured language, but it can't find the language file that it should use. This may be a symptom of a larger problem. You're using tscon.exe that was installed on that computer and not one you copied from another computer, right?

You might be able to correct this problem by running sfc /scannow after taking a snapshot and seeing if tscon gives the same error.

As for your primary issue, the number you are supplying to tscon indicates which session ID to act on. Have you checked if you are using session 0 or 1? Run query user to see what your session ID is and then use that number.

For example, I get this output from query user on one of my servers:

 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
>starfish              rdp-tcp#4           2  Active          .  9/20/2012 10:12 PM

Since my session ID is 2, I run tscon 2 /dest:console to send that session to the console. When I go to the console and run query user I see the following:

 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
>starfish              console             2  Active          .  9/20/2012 10:12 PM

I also tested this on a Windows 7 Pro desktop with the same results.

If you have success with the commands above, you can put the following into a batch file and run it to send your current session to the console.

for /f "skip=1 tokens=3 usebackq" %%s in (
  `query user %username%`
) do (
  %windir%\System32\tscon.exe %%s /dest:console
)

It should also eliminate the need to restart the computer, which I suspect was to make sure you always got session ID 0.

Starfish
  • 2,716
  • 24
  • 28
  • Very interesting. I need to ready and investigate more on Monday. Right now I can do the testing after reboot if I don't do 'remote connection' to Windows7 before the testing starts. If I do I won't work. – Radek Sep 21 '12 at 07:13
  • I weren't able to run 'tscon' but then I found it in winsxs directory. There was also mui file. I copied both of them to my directory and from there I run tscon.... – Radek Sep 24 '12 at 05:52
  • 1
    OK, so I found out if I run `tscon 1 /dest:console` from a command line as admin it works. Now I need to find out how to run this exe file always as administrator. – Radek Sep 24 '12 at 06:33
  • Don't forget to run the batch command (`for /f ...`) as administrator. See also http://support.smartbear.com/viewarticle/72794/ – bishop Aug 29 '15 at 01:32
  • For those who still have issues after disabling screen saver, few pointers here http://superuser.com/questions/51416/server-2008-locks-me-out-when-not-using-the-machine-for-10-minutes-after-install – binithb Dec 02 '15 at 11:26
1

This page says the issue is with the system being locked when trying to run it through scheduled tasks: http://www-01.ibm.com/support/docview.wss?uid=swg21304791

Setup the system to automatically login, disable the screen saver and automatic locking, and see if that helps. Don't connect to the machine through remote desktop - that will lock the console session. Install vnc to login instead or use whatever method your virtual machine software provides. In fact, turn off remote desktop so you can't lock the system by accident.

To setup autologin, run "control userpasswords2"

According to this: http://support.microsoft.com/kb/302801 Tscon would actually leave the session unlocked in server 2003 (and, presumably) xp. This was a bug that has likely been corrected in newer windows versions.

Grant
  • 17,671
  • 14
  • 69
  • 101
  • I already set up auto login & disabled screen saver. How do I disable automatic locking? – Radek Sep 21 '12 at 02:17
  • I am reading the MS page and I really don't understand how it works or should work. When would RFT work? If the console is locked or not locked? What I used to do with XP is that I scheduled to restart the XP box, then the system automatically logged rft user and the user ran `tscon.exe 0 /dest:console` and then started the tests. This flow doesn't work on Windows7. – Radek Sep 21 '12 at 02:24
  • I think if you just switch to connecting via vnc instead of remote desktop it will work then. Using remote desktop will lock the screen, which breaks rft` – Grant Sep 21 '12 at 02:40
  • Disabling locking should be done for you if you disable the screen saver, also make sure sleeping and turning off monitors is disabled in power management. – Grant Sep 21 '12 at 02:42
  • How can using vnc solve this issue? If I run RFT straight after reboot and there was no remote desktop connection before? – Radek Sep 21 '12 at 03:40
  • Have you configured the computer to automatically login? Also, in your other comment: "Right now I can do the testing after reboot if I don't do 'remote connection' to Windows7 before the testing starts. If I do I won't work." which matches up perfectly with what I've described. – Grant Sep 21 '12 at 12:28
  • Yes, I set it up so 'rft' user is logged in automatically after boot. – Radek Sep 24 '12 at 04:50
  • @Grant I guess sleeping and turning off monitors are not applicable while working with Virtual machines , or is it ? – binithb Dec 02 '15 at 11:29