The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


An Early Look at Windows Server 2019

Windows Server 2019 Preview

Have you heard? Microsoft is set to release Windows Server 2019 later this year. It seems that consumer releases (like Windows 10) are launched with trumpets and parades while server releases sneak up on you in the middle of the night! 🙂

So what’s new in Windows Server 2019?

Here are our highlights from the August 2018 Insider preview (Build 17744):

  1. Windows Admin Center (WAC): Microsoft’s powerful browser-based server management tool is a one-stop-shop for administering PC’s — locally or remotely. Check out our review of WAC for a deeper look.

    Windows Admin Center
  2. Windows Defender Advanced Threat Protection (ATP): Beyond the traditional preventative protection technologies found in previous versions Defender, ATP features support for post-breach intrusion detection, automated investigation, and more.

    Windows Threat Protection
  3. Improved Security for Linux VM’s: Linux virtual machines can now benefit from Server 2016’s Shielded Virtual Machines technology, which can help to prevent the unauthorized copying of company resources.

  4. Support for Kubernetes (in Beta): Administrators running Kubernetes pods will be happy to see first-class support for the popular container technology in Server 2019. This beta version is a respectable start and we look forward to continued improvements on the way to a general release early next year.

Any updates for Windows Services?

Server 2019 brings no documented changes to the Windows Services SDK functions. The Services Control Panel application remains the same as it has for many years now.

The only significant difference is the removal of the Interactive Services Detection service, which makes it impossible to access Session 0 in Server 2019. This is not a surprise though; Microsoft is being consistent with the same change made in Windows 10 build 1803 (released in April).

Does AlwaysUp work with Server 2019?

Yes!

Our week-long testing with various applications failed to uncover a single defect or problem.

Here is AlwaysUp happily running Dropbox as a Windows Service:

AlwaysUp running Dropbox on Server 2019

Does Service Protector run fine too?

The story was the same with Service Protector. No problems at all on Server 2019.

Here we see Service Protector protecting the Windows Defender Firewall Service:

Service Protector on Windows Server 2019

And how about all your other utilities?

Thumbs up there too!

Utilities running on Windows Server 2019

Where can I find out more about Windows Server 2019?

Posted in Windows | Tagged , , , , , | Leave a comment

Q & A: How do I get AlwaysUp to run Java.exe in the PATH?

Q & A - Java
  I run a Java program EchoLink Proxy as part of Ham Radio networking. A routine update replaced the Java folder with its new version number thus my AlwaysUp Application field to run the program needed manual edit from:

C:\Program Files (x86)\Java\jre1.8.0_171\bin\java.exe

to

C:\Program Files (x86)\Java\jre1.8.0_181\bin\java.exe

I tried simply providing “Java.exe” (which works from a CMD prompt) but AlwaysUp requires the full-path. How can I get AlwaysUp to run the Java.exe in my PATH environment variable?

— Anonymous

Hi. AlwaysUp expects a full path, so I see the problem!

We recommend adding a “layer of indirection” to solve the problem. Please:

  1. Create a new Windows batch file that runs your full java command line. However, instead of specifying the full path to java, simply use java.exe.

    When run, the batch file will use whatever java.exe is in your Windows account’s PATH variable.

    Here is what our simple batch file (saved to “C:\Tools\start-java-app.bat”) looks like:

    Start Java Batch File

    Please open a command prompt, run your batch file and confirm that it launches your program (EchoLink Proxy) as you expect.

  2. Update your AlwaysUp entry to run the new batch file. Specify the full path to the batch file in the Application field on the General tab:

    Run the Batch File in AlwaysUp

    Be sure to clear the Arguments field if it contains the parameters for the Java command line! Those should already appear in the batch file.

  3. And on the AlwaysUp Logon tab, specify the Windows account you are logged in to right now. Java must be launched in this account so that it finds the correct PATH environment value.

    Set the account for running Java as a service
  4. Finally, update the new batch file to add a 5 second delay at the end. We recommend using the Windows TIMEOUT command, but there are several alternatives:

    timeout /t 5

    Without this adjustment, the batch file may exit very quickly and fool AlwaysUp into thinking that the batch file failed to start properly.

    Add a Timeout to the Batch File
  5. Save your batch file — and your settings in AlwaysUp.

Now, when you start your modified entry from AlwaysUp, the following will happen:

  1. AlwaysUp will start the batch file

  2. The batch file will launch Java from the PATH, as you have configured

  3. The batch file will “sleep” for 5 seconds

  4. The batch file will exit

  5. AlwaysUp will notice that the batch file has exited and “attach” to the Java.exe child process

  6. AlwaysUp will continue to monitor Java.exe and restart it (via the batch file) if it ever crashes/fails/exits.

Any monitoring, reporting and alerts you have configured should continue to work as they did before.

Please let us know if you run into any trouble implementing this approach!

Posted in AlwaysUp | Tagged , , , , , | Leave a comment

Q & A: My VB6 App Doesn’t Refresh in Session 0 — Help!

  We have a VB6 application we’re running as a service in AlwaysUp on Windows Server 2012 R2. When we run the application outside of AlwaysUp, the form refreshes fine. When we run the application in AlwaysUp, it can sometimes take several minutes for the form to refresh, starting out as a black form (see screenshot of Session 0 below). Any recommendations you might have to help with the refresh rate would be appreciated, thanks.

Application not refreshing in Session 0

— Jim Kinghorn, Taylor Technology Services

Hi Jim. You are running into one of the peculiarities of Session 0 — where user interface elements do not seem to be refreshed consistently. Unfortunately it is a “Windows thing” and is outside the control of AlwaysUp.

But all is not lost! Our development team took a look at your situation and concluded that calling the Windows RedrawWindow API function in Session 0 might fix the problem.

You have a couple of options:

Option #1: Update your code to refresh all windows periodically

Specifically, your code should:

  • Refresh the desktop window, by calling the VB6 equivalent of:

    RedrawWindow(NULL, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN)

  • Enumerate all top-level windows (using the EnumWindows API function) and call RedrawWindows on each visible window.

Performing those operations every few seconds should eliminate the black windows in Session 0.

Option #2: Setup our “RefreshWindows” utility to run in Session 0

If updating the code is not a viable option, you can:

  • Download our free RefreshWindows command line utility and save it to a folder of your choice. When run, the utility refreshes all windows every 5 seconds (using the RedrawWindows and EnumWindows functions as recommended above):

    Running RefreshWindows
  • Set it up as a Windows Service with AlwaysUp. All you should have to provide is the full path to the executable file on the “General” tab:

    Setup RefreshWindows as a Windows Service with AlwaysUp

When your machine boots, AlwaysUp will launch RefreshWindows.exe to ensure that all windows in Session 0 are periodically refreshed and properly drawn.

Enjoy!

Posted in AlwaysUp | Tagged , , , , , , , | Leave a comment

Interactive Services Detection Service Removed in Windows 10 (so no more Switching to Session 0)

Session 0 is Off Limits

Microsoft has finally done it. Session 0 is officially off limits.

The Interactive Services Detection Service — necessary to switch to Session 0 — has been removed in Windows 10 Version 1803 (released in April 2018). While applications running in Session 0 will happily create windows and prompts, no one will be able to see them.

But this is no big surprise. The geeks in Redmond have been marching in this direction for many years.

A brief history of Session 0 and Interactive Windows Services

Windows NT (1993)

The concept of multiple login sessions in solidified in this foundational release of Windows. Session 0 is created at boot, interactive Windows Services are supported and the first user to log in is placed in Session 0.

Windows Vista (2007)

To avoid shatter attacks, Vista prohibits users from logging in to Session 0. That new world order is dubbed “Session 0 Isolation”. The Interactive Services Detection service is introduced to allow users to temporarily access Session 0 — a band-aid for interactive Windows Services that show windows and prompts.

Windows 8 & Windows Server 2012

Microsoft continues to discourage interactive services. The NoInteractiveServices registry value, which enables the Interactive Detection Service and switching to Session 0, is set to 1 by default. This prevents anyone from switching to Session 0 (unless the registry is updated).

Windows 10 & Windows Server 2016

The keyboard and mouse no longer function in Session 0. This unwelcome behavior was widely thought to be a bug that Microsoft would eventually resolve, but it now looks like a deliberate action intended to cripple interaction with Session 0.

Windows 10, version 1703 (2017)

Microsoft promises to remove the Interactive Services Detection service in this Spring Creators Update but for some reason the service remains.

Windows 10, version 1803 (2018)

The Interactive Services Detection service is officially removed. Switching to Session 0 is forbidden.

So what exactly are the ramifications of losing the Interactive Services Detection service?

Consequence #1: You won’t be able to switch to Session 0 from AlwaysUp on Windows 10

While your application will continue to run as normal in Session 0, attempting to switch to Session 0 will result in an error (reported on the Status Bar):

AlwaysUp: Switch to Session 0 fails
To see your application’s windows on your desktop, please restart your application in the current session. That option is available from the Application menu:
Restart in the Current Session

Consequence #2: Our Switch to Session 0 utility won’t work on Windows 10

Switch to Session 0 will run happily in your taskbar but you will encounter an error when you try to switch. Not surprisingly, the message says that the Interactive Services Detection service “does not exist as an installed service”:

Switch to Session 0 Error

Sayonara Session 0!

Posted in Windows Services | Tagged , , , , , | 8 Comments

Q & A: How can I see my Java Console Window when Running as a Service with AlwaysUp?

Q & A -Show Java Console Window
  I am running a Java application as a windows service with AlwaysUp. My JAR starts up fine and seems to be working as expected but I can’t see the Java console window to make sure that there are no errors. How can I see the console window?

— Alain Thiré, Thikro

Hi Alain. You cannot see your Java console window because it is running in a different Windows “Session”.

Let me explain a bit about Sessions and how they work:

  1. When you log into your PC, Windows creates a Session for you. That Session holds your desktop and all the programs you start. All your applications (processes) run inside that Session. Think of the Session as your own private room, holding all your things.

  2. If your wife logs in, she receives her own Session to hold all the applications she uses. Her Session is completely separate from yours and any program she starts will only be visible to her on her desktop. She gets her own private room.

  3. When your computer starts, windows creates a special Session for all services. That is, Windows Services have their own room. And because this is the first Session created, it is named Session 0.

Now when AlwaysUp starts your application as a Windows Service, it launches it in Session 0 (the home for all Windows Services). And because you are logged into a completely different Session (perhaps Session 1 or Session 2), you will not be able to see your application’s windows on your desktop. Your Java application isn’t in your room.

But fortunately that is not the end of the story. Here are three ways to see what Java is printing to the console.

Solution #1: Temporarily Switch to Session 0

Windows gives you the opportunity to view the Session 0 desktop whenever a window is displayed there. Click View the message when the Interactive Services Detection alert pops up:

Interactive Services Detection Dialog

AlwaysUp allows you to access Session 0 at any time. Simply select Tools > Switch to Session 0 from the menu:

Switch to Session 0 from the Menu

Or click the “monitor” button on the toolbar to do the same:

Switch to Session 0 from the Toolbar

Now be warned — Session 0 is a strange looking place! You won’t see a task bar, desktop icons or the familiar start button. Here is what the austere Session 0 looks like with Notepad running:

Session 0 with Notepad Running

Click Return now to revert to the safety of your normal desktop.

Note: Switching to Session 0 may not be a viable option on Windows 10 and Windows Server 2016 because you will be unable to use the keyboard and mouse in Session 0. Unfortunately there is no workaround and we cannot confirm if/when Microsoft will address this annoying problem.

Solution #2: Restart your Java application in your Session

A second way to view the Java window is to have AlwaysUp restart your Java application in your login session. Select Application > Restart in this session to have the console appear on your desktop, alongside your other windows:

Restart in this session

AlwaysUp will automatically return your application to Session 0 after you log off (or you can return it manually).

The obvious downside of this approach is that your application has to be stopped. Might a brief interruption cause problems? If so, restarting in your session may not be the solution for you.

Solution #3: Capture the Java console output to a file

The final solution reframes the problem. Instead of seeing the Java console window, is viewing the text printed in the window good enough?

If so, setup AlwaysUp to capture the console output to a text file. Activate the option and specify the full path to the log file on the Extras tab:

Capture Java console output

Simply open the text file to see what Java has printed to the console. Or even better, use a free “tail” utility to follow the file’s additions in real time. Both Powershell’s Get-Content cmdlet and Tail for Win32 have worked well for our team.

Best of luck with your Java application/service!

Posted in AlwaysUp | Tagged , , , , , | Leave a comment