The Core Technologies Blog

Our Software // Windows Services // 24×7 Operation


OneDrive Slow? Try Disabling Files On-Demand

Speed up OneDrive

In recent months, several customers running OneDrive as a service have complained of torturously slow uploads. Files created on a PC take a very long time to appear in the cloud. In one case, it took more than 3 days for a small Word document to show up on OneDrive’s website!

The first instinct was to suspect AlwaysUp. Perhaps running as a Windows Service had somehow crippled OneDrive. But a few tests quickly disproved that theory. The performance problem showed up even when OneDrive was started normally on the desktop, outside of AlwaysUp.

The mystery has persisted for several months but recent feedback on various forums suggest that there may be a workaround. Apparently disabling the new Files On-Demand feature often restores sanity.

What is OneDrive Files On-Demand?

Files On-Demand is Microsoft’s attempt at making more efficient use of your hard drive. Instead of automatically transferring each file in the cloud onto your PC as soon as possible, OneDrive will delay the transfer of each file until you explicitly open it.

You can turn Files On-Demand on or off from your OneDrive Settings window. Right-click on the OneDrive tray, select Settings from the menu and move to the Settings tab in the window that comes up. The Files On-Demand option appears at the bottom of the form. It appears to be on by default:

OneDrive Files On-Demand

Files On-Demand trades space for speed of access. For example, let’s say you have a 10 MB PowerPoint presentation in the cloud. Without Files On-Demand, that document will be automatically copied to your computer, immediately consuming 10 MB on your hard drive. With Files On-Demand, OneDrive will “know about” the file but will not automatically transfer it. Your hard drive stores 10 MB less — great.

But the downside of Files On-Demand becomes evident when you need to use the file. Without Files On-Demand, you simply double-click the file and away you go. The document loads quickly because it is already on your computer.

With Files On-Demand enabled, double-clicking the PowerPoint issues a command to the cloud to dynamically download the file. At best you wait a few seconds for the download to complete and the file to open; at worst you can’t retrieve the document because you are not connected to the Internet.

As contributor Craig Long points out, “Files On-Demand is for those who have limited space available or for those who only occasionally need to open a file”. It’s a fine choice for individuals/hobbyists looking to conserve precious resources.

However, please be cautious when considering Files On-Demand in a professional setting. It would be a disaster in an office where OneDrive is mapped to a shared folder because the files not downloaded would never fully show up on the shared drive!

And furthermore, as Microsoft mentions, “you cannot search the contents within online-only files because they aren’t stored on the device” — a potential deal-breaker in a commercial environment.

Complaints of slow uploads with Files On-Demand

Several folks experiencing slowness were able to speed things up by disabling Files On-Demand. Here is one data point from the popular OneDrive forum hosted by UserVoice:

I have been waiting a week for the sync to complete, speeds is about 0,2kb/sec. My internet speed is 1GB/1GB. Then I turned off “sync on demand”. BOOM!!! Speed up to 15mb/sec. A factor 75.000 faster.

“John S” had a similar comment:

I had this same issue with large upload batches from my Mac (uploading about 13GB worth of data from a prior DropBox repository into a SharePoint location on Office 365 tenant) and figured out resolution myself after unsuccessful calls to MS Support: SOLUTION: turn OFF “Files on Demand”. Once off, I got normal upload speeds.

Apparently there may be problems with the new feature.

How to disable Files On-Demand

You can easily turn off Files On-Demand by un-checking the box on OneDrive’s settings page (available by right-clicking on the tray icon). Click OK on the conformation window to commit your changes:

Disable OneDrive Files On-Demand

Hopefully this simple change will put the spring back in OneDrive’s step!

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

Essential Windows Services: Spooler

Print Spooler

What is the Spooler service?

The Windows Print Spooler is a key operating system component that manages all printing on your computer. It is started when your PC boots and runs unattended, 24×7 as a Windows Service.

The Windows Service is named Spooler and its display name is Print Spooler. The service runs inside a process called spoolsv.exe:

Spooler Windows Service

The Spooler:

  • Runs silently in the background

  • The Spooler does not show any windows or tray icons. It is an invisible technical component that presents an Application Programming Interface (API) to programs looking to manage printing.

  • Accepts files to be printed, from all applications

  • The Spooler is always listening for print requests. It accepts documents from any application running on your computer.

    The process of handing off a document to the Spooler is called Spooling. Once an application is done spooling a document, the Spooler is responsible for the actual printing. The application can go back to its normal tasks.

    For example, let’s say you’re printing a spreadsheet from Microsoft Excel. You will notice a brief period as Excel prepares the document and hands off the print request to the Spooler. And during that time, a helpful window will announce that Excel is printing. However Excel is really sending the spreadsheet to the Spooler (i.e. spooling):

    Excel printing/spooling

    After the window has disappeared (i.e. Excel is done spooling), you will be free to edit your spreadsheet while the actual printing proceeds simultaneously. You can even close Excel! None of that matters to the Spooler, which will ensure that your spreadsheet makes it to the printer — independent of Excel.

  • Facilitates concurrent printing

  • Ever printed several, lengthy documents at the same time? The Spooler makes that possible — without overwhelming your printers.

    The Spooler maintains a queue of requests (a print queue) for each printer on your computer. When you print a document, the Spooler:

    • Adds a new item (a print job) to the print queue.
    • Sends the print job to the printer (when the printer is ready).
    • Monitors the printer as it produces pages.
    • Removes the job from the queue once the printer has produced all pages.

    Windows allows you to see (and manage) each printer’s queue. To open a print queue:

    1. Open the Control Panel (available from the Start menu).

    2. Type the word printers into the search box and click the View devices and printers link on the left:

      Find printers in Control Panel
    3. Find your printer in the list. Right click the printer and select See what’s printing from the menu:

      Select see what's printing
    4. A window showing all pending print jobs will come up. Here we see one item for Administrator — a text file printed from the Notepad application:

      The print queue window

      From there, you can cancel all print jobs (“clear the queue”), pause a specific job or stop printing altogether.

  • Will do everything in its power to ensure that documents are printed

  • The Spooler’s mission is to make sure that all your documents are printed — even if there is a brief outage or interruption.

    For example, if your printer temporarily disappears from the network, the Spooler will wait a reasonable time for the device to come back before declaring a failure.

    And if your request to print a single page is stuck behind a 200-page behemoth, the Spooler will ensure that your document gets its turn, eventually.

What happens if I stop the Spooler service?

Nothing can be printed when the Spooler service is stopped. And if you try to print without the service running, Windows will insist that no printers are installed:

No printers when Spooler is stopped

Indeed, when the service is running, printers show up as ready and waiting. Printing works fine:

Spooler service running, printers connected

But all printers become inaccessible the instant the service is stopped:

Spooler service stopped, printers not connected

Is it safe to disable the Spooler service?

If you don’t have any physical printers attached to your computer and you and never plan to do any printing, you can safely disable the Spooler service.

However, watch out for applications that silently use the printing API. They will also fail when the service is disabled.

What should I do if the Spooler service isn’t working?

If the Spooler is misbehaving, you should restart it. You can do so from the Services Control Panel application, or by running a couple of NET commands:

NET STOP Spooler
NET START Spooler

Be sure to run those commands from an elevated command prompt, otherwise they will fail with permissions errors.

I made a mistake. How do I cancel all printing?

To clear all printing, open the printer queue (see above) and select Cancel All Documents from the Printer menu:.

Select Cancel All Documents

Give the Spooler (and your printer) a few seconds to respond to the request.

Canceling didn’t work. Is there another way to clear out all pending documents?

Try running this sequence of commands to stop the Spooler, remove all files from the print queue, and restart the service. You will need to have admin rights:

NET STOP Spooler
DEL /Q /F /S C:\Windows\System32\spool\PRINTERS\*
NET START Spooler

The Spooler service won’t start (Error 1053)

As reported in Microsoft’s technical forum, the problem may be with “desktop interaction” — an obscure windows service setting.

To fix the issue:

  1. Open the Spooler service (from the Services Control Panel application)
  2. Switch to the Log On tab
  3. Un-check the Allow service to interact with desktop box:
    Un-check interact with desktop
  4. Click OK to save your change.

Afterwards, you should be able to start the service.

The Spooler service is stuck in the “Stopping” state — Help!

In that unusual situation, find and terminate the spoolsv.exe process from the Task Manager (admin rights required):

Task Manager: Terminate spoolsv.exe

The service should transition to the stopped state.

The Spooler service keeps stopping for no reason. How do I keep it running?

Our Service Protector utility may be able to help. Please follow this step-by-step tutorial showing how to protect the Spooler service.

Questions? Problems?

If you would like to know more about the Windows Print Spooler service, or you have a specific problem, please feel free to get in touch. We will do our best to help you!

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

Q & A: How do I Restart my Application/Service Regularly from AlwaysUp?

Q & A - Restart Application

We are currently using AlwaysUp with several executable instances. We need to have these restarted daily due to memory leaks from the application.

I don’t see a scheduling restart option in AlwaysUp. I think this could be done through a windows task but I see that these are being run as windows services. Would you recommend doing this as a windows task or would the Service Protector be a better option?

— Kevan Hauver, AAA Northeast

Hi Kevan. Sorry to hear of the awful memory leaks!

Yes, Service Protector could help your situation but there is no need to purchase that additional software. Here are a couple of options to restart your application periodically:

Restart once daily (via the Monitor tab)

AlwaysUp makes it very easy to restart your application once per day, at a time of your choosing. Edit your application in AlwaysUp and look for the Every setting on the Monitor tab.

Here is what the Monitor tab looks like when configured to restart the program every day at 2 AM (a time when the software/server is likely to be “quiet”):

Restart every day at 2 AM

Note that AlwaysUp can restart conditionally — only when one or more conditions are met. For example, to avoid restarting when the software is busy, check the It has been idle for at least box and fill in an appropriate duration.

And if you find that simply restarting the application doesn’t clear the problem, you can try rebooting the entire machine. That option is available at the bottom of the form.

Restart multiple times per day (using the Windows Task Scheduler)

If restarting once per day is not enough, you have my sympathies!

For that situation, we recommend creating a simple script that will restart your service and then enlisting the Windows Task Scheduler to restart the service as often as you like. Follow these steps, which you should be able to complete in 10 minutes or less:

Step 1: Create a batch file to restart your AlwaysUp service

First, please create a batch file that restarts your AlwaysUp service. It will contain two lines — one to stop the service and another to start it.

For example, if your AlwaysUp application is named “Dropbox”, your batch file should contain the following calls to the Windows NET command:

  NET STOP "Dropbox (Managed by AlwaysUpService)"
  NET START "Dropbox (Managed by AlwaysUpService)"

The ” (Managed by AlwaysUpService)” portion is a necessary part of the service’s name. All services created by AlwaysUp feature that suffix.

Note: The batch file may not work as expected if it takes your application longer than 30 seconds to shut down. This is because NET STOP will only wait for 30 seconds before giving up. And if it does give up, the subsequent call to NET START will fail too. So after running the batch file, the AlwaysUp service may end up in the “Stopped” state — not what you want for your 24/7 application!

For slow applications, we recommend using our free ServicePilot utility instead of NET. ServicePilot can be configured to wait much longer than 30 seconds for the service to stop.

Assuming that you have downloaded and saved ServicePilot to your AlwaysUp folder, here is what the batch file looks like with ServicePilot instead:

  "C:\Program Files (x86)\AlwaysUp\ServicePilot.exe" -restart -wait 300 "Dropbox (Managed by AlwaysUpService)"

That command will wait for up to 300 seconds (5 minutes) for the service to restart.

Give the batch file a meaningful name and save it to your AlwaysUp folder (C:\Program Files (x86)\AlwaysUp). We’ll need its full path in the next step.

Step 2: Setup the Task Scheduler to run the batch file

Here’s how to run the batch file (and restart your application) every day at noon.

  1. Start Task Scheduler. This is best done by running taskschd.msc from a command prompt, or by opening the Control Panel, searching for “schedule” and clicking the Schedule tasks link:

    Start Task Scheduler
  2. Once the Task Scheduler window appears, select Create Basic Task on the left:

    Task Scheduler: Create Basic Task
  3. In the Create Basic Task Wizard window, enter a suitable name. You can leave the description blank.

    Enter a name for the task

    Click Next to proceed.

  4. The Daily option (which we want) should already be selected, so click Next to move to the next screen:

    Run the task daily
  5. Here you specify the time to restart the service/application. We have selected today at noon but you should select whatever time works for you.

    Leave Recur every at 1 day and click Next when you are ready to proceed.

    Specify the time to restart the application
  6. We want to start a program (the default), so click Next to move on:

    Start a program
  7. Click the Browse button and choose the batch file you created in the previous step. Recall that we placed ours in the AlwaysUp folder (C:\Program Files (x86)\AlwaysUp):

    Select the batch file you created

    Click Next to proceed.

  8. The basic configuration is now complete and you will see a summary of the scheduled task to be created.

    Check the Open the Properties dialog… box and click the Finish button:

    Task summary
  9. And on this final screen, select the Run whether user is logged in or not option and check the Run with highest privileges box. These are required by Windows to manipulate the service on your behalf.

    Set task security

    Click OK to wrap up. (On some versions of Windows, you will have to enter the password for your account on the way out.)

  10. Your task is now fully configured. Navigate into the Task Scheduler Library on the left and confirm that all is well:

    Daily restart task configured

With this new task in place, Windows will automatically restart the AlwaysUp service every day at noon.

Step 3: Repeat the process to configure additional restarts

Want to restart again at 2 PM? Simply repeat the process to create another task but select 2 PM instead of noon.

Advanced users can save a few clicks by exporting the task to a XML file, updating the file to specify a different time, and importing the modified XML to create a new task.

Hopefully you don’t have to create too many tasks…

Best of luck with your application!

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

Q & A: Can my CAE/Visio Application Run Properly as a Windows Service?

Q & A - Computer Aided Engineering Application

I must run a Computer Aided Engineering (CAE) application as a service but it doesn’t work with AlwaysUp. I guess that Visio is the problem because the startup phase of the tool runs up to the Visio initialization (via COM) and then hangs. When I try to register Visio standalone, it’s also not working.

Any idea what I can do to isolate the problem?

— Rüdiger Lange, AUCOTEC


Hi Rüdiger. You are likely running into a couple of problems. Here are our recommendations to resolve the issues:

Specify the correct Windows account in AlwaysUp

Your CAE application needs to run in the Windows account where Visio was installed. If not, your tool will fail when it tries to start Visio.

You see, when you installed and configured Visio, it saved several settings in your account. Those settings are not accessible to other users of the computer.

Even if another user found and launched the Visio executable, Visio would start, but it may come up “blank”. Whatever settings you provided at installation (and any changes you subsequently made while using Visio) may not be visible.

So please enter the user name and password of your Visio Windows account on the Logon tab to have AlwaysUp start your CAE application in that account. For example, here we have configured the “Administrator” account:

Specify the account for Visio

Start Visio as a Windows Service too

AlwaysUp will run your CAE application in the background, in the isolated Session 0. Now because COM components cannot communicate easily across login sessions, Visio must run in the same session. Therefore, you should also launch Visio as a Windows Service with AlwaysUp.

We don’t have a tutorial for Visio but setup should be the same as for any application in the Microsoft Office suite. Here are the guides for:

But please be aware of the following cautionary note from Microsoft for when running an Office program as a Windows Service:

All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

That sounds pretty bad, right? However, in our experience, there is a large subset of Office features that work perfectly fine unattended.

However please heed the Redmond warning and test thoroughly, to make sure that your automation functions as expected in the background in Session 0. We will be here to help you if you run into any trouble!

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

AlwaysUp 11.5: Improvements for Session 0 Isolation, Server 2019, and more

Check out what's new in AlwaysUp 11.5


AlwaysUp version 11.5 is now available for download!

This release delivers a handful of important changes, along with the usual under-the-hood refinements.

“Switch to Session 0″ removed when it’s not supported

As you may have noticed, Microsoft has crippled access to Session 0 in Windows 10 Build 1803 and later. And even though the writing had been on the wall for some time, we were still disappointed to see that convenient functionality removed from Windows. :(

But we live in Microsoft’s world, and we must react to their dictates as best we can.

So going forward, AlwaysUp will scan the operating system and determine if Session 0 is accessible or not. If it’s not, then:

  • The Switch to Session 0 toolbar button will be hidden:

    Switch to Session 0 Toolbar Button Removed

  • The Switch to Session 0 menu entry (found under the Tools menu) will be removed:

    Switch to Session 0 Menu Entry Removed

Note that your application will continue to run properly as a Windows Service in the isolated Session 0 — you just can’t see it there. You can always select Application > Restart in this session from the menu to bring your program visibly onto your desktop.

View & set Windows Service “Read” permissions

While AlwaysUp would allow you to set who can start, stop or modify each Windows Service it creates, the interface could not show (or grant) someone the ability to simply read the service. This shortcoming was recently addressed in Service Security Editor and we have now done the same in AlwaysUp.

Select Application > Advanced > Service Security Settings to interact with the new “Read” element:

View/Set Service Read Permissions

Technical enhancements for Windows Server 2019

Windows Server 2019 was released in October (and re-released in November after some disturbing technical glitches were addressed). AlwaysUp version 11.5 includes minor technical tweaks to ensure smooth, 24/7 operation of your Windows Services on Server 2019.

You can rest assured that AlwaysUp is fully compatible with the new OS.

Small Improvements for Windows Server 2019

Other fixes & improvements

  • Improved support for the latest builds of Windows 10 and Windows Server 2016. Each major update was thoroughly tested and no issues were found.

  • The registration window now displays the version number — to help customers complete registration on the correct version of the software.

  • The registration process provides additional labels and informative pop-up messages to help customers complete the process without incident.

  • The enhanced “Help” menu includes a link to our Blog and a link to an article describing how to report problems.

  • When AlwaysUp is running in evaluation mode, the title of the main window now mentions when the 30-day trial will expire.

As usual, please review the release notes for the full list of features, fixes and improvements included in this release.

Upgrading to AlwaysUp Version 11.5

If you purchased AlwaysUp version 10 (after January 2017) you can upgrade to version 11.5 for free. Just download and install “over the top” to preserve your existing applications an all settings. Your registration code will continue to work.

If you bought AlwaysUp version 9 or earlier (before January 2017), you will need to upgrade to use version 11.5. Please purchase upgrades here — at a 50% discount.

See the full upgrade policy for additional details.

Enjoy!

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

Why should I Pay for AlwaysUp when Free Alternatives are Available?

Every now and then, someone reviewing our AlwaysUp software declares it “too expensive”. They ask: “Since I can find free tools (like Microsoft’s Srvany) to run my application as a Windows Service, why in the world would I spend $50 on your software?”

Sure, not everyone looking to run a program as a service needs AlwaysUp. A free tool can be a fine choice, especially for hobbyists and home users.

But if you are a professional working in a commercial environment, please be sure to answer these five questions before making a commitment:

1. Where will you go for help if you have questions (or things go wrong)?

The wonderful world of Windows Services can be tricky to navigate. Technical obstacles (like Session 0 Isolation) abound.

As a professional, you owe it to your business to plan for all eventualities.

Tech Support when you need it
  • Is there a phone number to call when you or your team needs urgent help?
  • How about a support email with a 24-48 hour response time?
  • Can you easily find online FAQ’s and other helpful resources?

At minimum, please make sure you have a contact!

2. How much of your own time will you have to spend on the “free” solution?

The cost of an item is usually more than its initial, sticker price. We often underestimate true, long-term cost because we forget to add our time to the equation.

For example, say you want to buy a new computer desk. Which is cheaper?

  1. A ready-to-go desk for $199
  2. The same desk from Ikea for $149

It’s a no-brainer, right? #2 is the way to go.

But what if it’s going to take you a couple of hours to unbox and assemble the Ikea furniture? Does option #1 (which avoids that extra labor) seem the more cost effective choice now?

Spend money to save time

Similarly, a free alternative to AlwaysUp definitely saves a few bucks at first.

But once you have the free software, how much of your valuable time must you devote to installation, troubleshooting and support? Might those ongoing costs dominate the equation?

We realize that your time is important. And we designed AlwaysUp to save you time — initially and over the many months and years you will use the product.

For example:

How much is your time worth?

3. Are you willing to take on the additional risk?

When you use unsupported software in your business, you become responsible for it when it fails. The buck stops with you.

At your own risk

Are you willing to assume that risk? To accept blame from your boss/team if the software misbehaves or becomes unusable after a Windows update?

Realize that your reputation (and perhaps your job) may be at stake, especially if you are operating a mission-critical system!

4. Are you sure you won’t need AlwaysUp’s extra features?

With over a decade of real-world use, AlwaysUp has evolved to include a ton of features — many of which are not found in free alternatives.

AlwaysUp is feature-rich

For example, AlwaysUp can:

  • Automatically restart your application if it crashes, hangs, or uses too much CPU
  • Send you an email when your application stops;
  • Boost your application’s priority, to make it run faster;
  • Capture your application’s output to a text file;
  • Send you a weekly report showing how your application is performing.

Check out this PDF flyer comparing AlwaysUp and Srvany for more:

AlwaysUp vs. Srvany (PDF)

As many customers have discovered, these extra features can come in very handy down the road!

5. How important is security?

Needless to say, you should be very careful when introducing new software into your secure environment.

AlwaysUp is digitally signed, so you can be positive that it is from our reputable company:

AlwaysUp is Digitally Signed

In addition, AlwaysUp has been evaluated by the US Department of Commerce Bureau of Industry and Security and has earned an export classification of EAR99:

AlwaysUp ECCN (PDF)

Can you say the same for the free software?

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

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 , , , , , | Leave a comment