The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation

OneDrive Doesn’t Sync Directory Junctions

OneDrive Doesn't Sync Linked Folders

What is a directory junction?

A directory junction is an alias of one folder to another.

Put another way, a directory junction allows you seamlessly access the contents of a folder from another directory, with a different path.

For example, let’s say that you have folder “C:\Users\Username\Documents\Media\All Movies” on your computer. However, you find that directory too long to type when working with it from the command line. You dream of entering a shorter path — such as “C:\Movies” — but you don’t want to copy the files to a new location.

To solve the problem, you would create a directory junction mapping “C:\Movies” to “C:\Users\Username\Documents\Media\All Movies”. After doing that, all your movies will be accessible from “C:\Movies” too. For all practical purposes, “C:\Movies” becomes a synonym for the longer path.

Directory junctions can be created with the with the mklink command. For example, this command creates the alias for the scenario above:

mklink /j "C:\Movies" "C:\Users\Username\Documents\Media\All Movies"

Why use a directory junction with OneDrive?

A directory junction provides convenience and flexibility when designing your cloud synchronization strategy. In theory, by allowing you to place any arbitrary folder inside your OneDrive folder, you can extend the scope of your OneDrive backup without having to duplicate large folders and files.

Let’s illustrate with a practical example.

Say you’ve installed OneDrive to synchronize your OneDrive folder (“C:\OneDrive”) with the cloud. Everything is working well.

However, you also want OneDrive to backup “C:\Shared\CustomerSuccess\Templates” — a shared folder with important company files. How do we instruct OneDrive to sync that folder as well?

Well, this is where folder linking comes in. You can create a directory junction in your OneDrive folder that points to the Templates folder, like this:

Create a directory junction with mklink

Doing so places an alias of the Templates folder right inside the OneDrive folder, as illustrated here:

The directory junction in the OneDrive folder

And soon after you’ve created the directory junction, OneDrive will notice the new linked folder and sync it to the cloud:

OneDrive has synced the linked folder

Problem solved, right? Unfortunately, not so fast…

OneDrive doesn’t detect changes to the files in directory junction

While OneDrive synced the contents of the new linked folder when the directory junction was first established, it didn’t re-sync the folder when something changed.

For example, when we created a new file called “evaluation-2023.docx” in the linked folder, OneDrive didn’t copy the file to the cloud:

OneDrive doesn't sync a new file in the linked folder

It’s as if OneDrive didn’t realize that the new file was there at all.

And the same was true for other changes too. OneDrive missed all deletes, renames and updates to the files in the linked folder. None made it to the cloud.

In fact, the only time OneDrive synced the linked folder was when the application started. Afterwards, OneDrive completely ignored the linked folder.

Needless to say, this unusual behavior renders the directory junction we created in the OneDrive folder useless. If we can’t rely on OneDrive to recognize changes to our files, why bother linking the folder at all?

But… why?

The reason is likely very technical — rooted in the low-level file system services provided by the Windows Operating System.

OneDrive probably calls FindFirstChangeNotification to monitor the OneDrive folder. And whenever a file is changed:

  1. FindFirstChangeNotification lets OneDrive know that something in the folder has been updated

  2. OneDrive figures out what’s changed and copies the new file up to the cloud.

However, FindFirstChangeNotification treats directory junctions and other links specially. From the Symbolic Link Effects on File Systems Functions documentation:

 If the path points to a symbolic link, the notification handle is created for the target. If an application has registered to receive change notifications for a directory that contains symbolic links, the application is only notified when the symbolic links have been changed, not the target files.

Translation: FindFirstChangeNotification won’t shout when a file inside a directory junction changes. And unfortunately, that leaves OneDrive in the dark. 🙁

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

Essential Windows Services: SysMain

SysMain Service

What is SysMain?

SysMain is a Windows Service that monitors the applications running on your computer and tries to improve their performance over time.

For example, if SysMain notices that you run Microsoft Excel frequently, it may automatically place Excel in your computer’s memory. And with Excel already loaded into RAM, the program will come up on your desktop much faster when you actually open it.

The end result is that by anticipating what you’re likely to do soon, SysMain can make your computer seem faster than it is.

The service’s display name is SysMain and it runs as LocalSystem inside the service host process, svchost.exe. By default, the service is set to start automatically when your computer boots:

SysMain Windows Service

Note that in previous version of Windows (before Windows 10 18H2), SysMain was called Superfetch. Microsoft changed the name because future versions of the service will likely do much more than simply caching frequently used programs in memory.

Why is SysMain using so much CPU and RAM?

As mentioned, SysMain’s goal is to speed things up by preparing key applications before you actually need them. Doing so makes your applications load faster.

But the downside of that approach is that SysMain uses system resources before necessary — without your explicit consent/request.

Let’s go back to our Excel example, where SysMain loads Excel into memory before you launch the program. The truth is that when SysMain loads Excel, the service uses CPU and memory to complete that task. And if you happen to be using another application when SysMain is doing its work, your PC may appear sluggish — or even unresponsive.

Fortunately, SysMain won’t bog down most modern PC’s. When there are ample amounts of CPU and RAM, you won’t even notice the Windows Service helping you in the background.

The trouble comes up when your RAM and CPU are limited. In those situations, SysMain is constantly competing with the interactive user for precious resources, and that can make your machine appear slower than it is!

Is it OK to disable the SysMain Windows Service?

Yes. SysMain isn’t an essential system process and you can safely disable it.

Indeed, if your PC suffers from “random spikes” in CPU or RAM, you should see if turning off SysMain reduces or eliminates the problems.

Furthermore, a common bit of advice is to disable SysMain whenever your computer has a fast hard drive. In that situation, pre-loading applications into RAM only saves you a few milliseconds. For example, you probably won’t even notice the small speedup that SysMain provides if you’ve got a speedy solid-state drive (SSD).

However, one bit of advice if you disable SysMain. Because it’s possible that SysMain will deliver significant speedups in future versions of Windows, be sure to reevaluate the service as Microsoft improves its operating systems.

Questions? Problems?

If you would like to know more about the SysMain 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

How to Turn Off Files On-Demand in OneDrive

How to Turn Off Files on Demand in OneDrive

What is OneDrive Files On-Demand?

Files On-Demand saves space on your hard drive by “lazily” downloading the contents of your files from OneDrive only when necessary.

With Files On-Demand, all your files are actually listed on your computer. And as you can see below, each file displays the cloud icon in the status column indicating that it’s online-only:

Online-only files

To be clear, an online-only file does not have its contents downloaded onto your hard drive. You can think of it as a shell — a placeholder for the “real” file in the cloud.

The great thing is that online-only files take up virtually no space on your hard drive. And that’s true regardless of the size of your files in the cloud. As a result, if all your files are online-only, your local OneDrive folder will be tiny — even if you have many gigabytes stored online.

Note that when you first setup the OneDrive desktop application, Files On-Demand will be active by default. All your files will be online-only:

Files On-Demand is active by default

We’ll show you how to change that below.

What’s the problem with online-only files?

While Files On-Demand is great at saving space, it has one major downside. Whenever someone tries to access an online-only file, the OneDrive desktop application must be running to download the file’s contents.

If OneDrive isn’t running, any attempt to work with an online-only file fails with a cryptic error:

Error when accessing an online-only file

And the need to have OneDrive always running can cause unforeseen problems, especially in commercial environments.

For example, let’s say you have OneDrive installed on a server. You’ve shared your OneDrive directory over the network, to allow your users to access the files without having OneDrive installed.

Everything works well when your server is on and OneDrive is running. Your users can access all files just fine — even the ones that are online-only.

However, if OneDrive.exe is not running on the server — maybe because the server rebooted and you didn’t log in yet — your users won’t be able to access the online-only files. Their programs will fail in strange ways, like Adobe Acrobat did when we tried to open an online-only PDF file:

Acrobat cannot open an online-only PDF file

It’s easy to see how the inability to get to the files could cause head-scratching and frustration!

Fortunately, it’s easy to avoid those problems. Simply turn off Files On-Demand.

Disable Files On-Demand and make OneDrive download all your files to your computer

To turn off OneDrive Files On-Demand:

  1. Click the OneDrive tray icon to summon the tray window. From there, click the gear in the upper right and choose Settings from the menu:

    Open OneDrive Settings
  2. In the Sync and Backup section, scroll down and expand Advanced settings.

  3. Under Files on Demand, click Download all files:

    Files On-Demand Settings: Download all files
  4. Finally, click Continue to confirm that you want OneDrive to download all your files:

    Confirm download all OneDrive files

After a few minutes (or hours if your OneDrive is immense), all your files will be available on your hard drive. You’ll be able to access them without issue — even when the OneDrive desktop application isn’t running.

Posted in OneDrive | Tagged , , | Leave a comment

6 Reasons Why AlwaysUp is the Best Tool to Run Multiple Applications as Windows Services

AlwaysUp is the Best Tool for Running Multiple Applications as Windows Services

Most service wrappers focus on a very basic task: installing a single application as a Windows Service. In doing so, they provide little or no support if you need to run several applications when your computer boots.

Understanding that some people need to convert more than one program, we’ve worked hard to ensure that AlwaysUp does a great job managing multiple applications as services. Indeed, there is no limit on the number of applications you can run in AlwaysUp. You can install 1 or 100 — it’s up to you.

Anyway, let’s review the top six reasons why AlwaysUp is your best choice when you need to create many Windows Services.

Reason #1: You can manage all your applications in a friendly, intuitive console

Free alternatives like Microsoft Srvany will install any application as a Windows Service. And others have a friendly GUI that makes installation a mostly point-and-click affair.

However, not many tools provide a console that allows you to monitor, manage and update your applications after they have been installed as services.

With those others, you’ll need to rely on the Services application if you wish to start, stop or update your application. And even though Services is a great little app, it’s going to display your new services mixed in with the nearly 100 installed by Microsoft. That makes it very difficult to work with your own.

In contrast, AlwaysUp makes it easy to manage your new services. The console lists all the applications you have installed and allows you to work with them individually or as a group.

For example, here we have AlwaysUp happily managing 10 applications: Dropbox, OneDrive, and a few Java servers:

AlwaysUp managing 10 applications

It’s easy for you to see which applications are running and which are stopped.

And when you’re ready, key information about each program is a mouse-click away:

AlwaysUp showing OneDrive Information

Furthermore, with the AlwaysUp console you can:

  • Operate on a batch of applications, all at once;

  • Sort the table — by name, application path or state;

  • Hide disabled apps (ones that cannot be started);

  • Search, to show only the entries matching the text you entered;

  • Tag applications, to enable grouping and filtering;

  • View applications as large icons, small icons, or as a simple or detailed list.

We’ll cover some of those capabilities and the advantages they offer in the next sections.

Reason #2: You can start, stop, restart or update several services together

The AlwaysUp console supports multiple selection. As such, you can use the standard Shift and Ctrl key combinations to select multiple application rows.

For example, here we’ve chosen all the java servers that are running:

Java applications running are selected

And with that subset selected, we can choose to restart them all at once from the “Application” menu:

Restarting the Java applications selected

Note that you can perform several operations on the group as a set. With a single action, you can:

  • Stop the selected applications;

  • Start them all;

  • Restart the entire group in your session;

  • Change the startup type for each entry;

  • Apply tags to the applications, as a unit;

  • Export each app to a portable XML file.

Those functions are all available from the toolbar and in the “Application” menu.

Reason #3: You can group and filter your applications using tags

Tagging is an organizational feature that allows you to group your applications in any way you like.

For example, you will notice in the screenshots above that the Dropbox and OneDrive entries have a tag named “cloud”. To focus on just those two applications and temporarily eliminate the rest from the view, we would:

  1. Activate the Filter Pane from the View menu;

  2. In the Filter Pane, check the Show only applications with tag box;

  3. Choose the “cloud” tag from the list.

Show applications with the cloud tag

From there, we could simply select both applications and start, stop or restart them.

As you can see, tags make it easy (and efficient) to work with a subset of your applications as a unit.

Reason #4: You can easily export and import your applications “in bulk”

AlwaysUp makes it easy for you to move your applications between your computers. Simply export each application from the “source” PC and import it onto the “destination” machine to recreate it there.

The Bulk Import Wizard provides an optimal experience when you have to import multiple apps. Instead of making you stand up each application separately, the wizard requests common information (like your Windows password) once and applies it to all the applications being imported. The end result is the speedy recreation of all your services on your new computer.

Easily import your Windows Service applications into AlwaysUp

Importing with the wizard can be a real time saver when you’re moving dozens of apps!

Reason #5: You can update your view to fit more applications on your screen

Customers running north of 50 applications in AlwaysUp tell us that screen real estate is a precious commodity. It’s important for them to have all their apps visible in the window — without constantly having to scroll or page around to see them all.

Over the years, we’ve made many improvements to AlwaysUp targeted at those space-conscious customers. For example, you can use the “View” menu to hide the:

  • Toolbar of buttons at the top;

  • Status bar at the bottom;

  • List headers that summarize the applications you are running.

By removing some of those visual components, you can dedicate maximum space to the list of applications:

Hide components to show more applications

And if you really want to pack them in and show 100+ applications, you can switch to small icons (via the “View” menu):

View small icons to show even more applications

As you can see, AlwaysUp makes it super easy to show as many of your applications on screen as possible.

Reason #6: We’ve been making improvements in this area for almost 20 years

Like many of the other service wrappers, AlwaysUp started out with a focus on installing a single application as a service. After all, that’s what most folks want to do at first.

But over the years, our customers have shown us that they are much more ambitious. Indeed, we have a few of corporate clients that use AlwaysUp to manage over 100 applications on a single server!

We’ve learned a lot from those customers. And we consistently try to improve AlwaysUp to meet their strenuous demands.

Most recently, our developers tuned underlying algorithms to ensure that our code performs efficiently when orchestrating many applications. Those efforts reduced CPU usage by a whopping 45% in some circumstances.

AlwaysUp running many applications

And we won’t stop there. We’ll continue to improve the software and make it even easier for you to manage multiple programs. Be sure to let us know if you have any great ideas. 🙂

Posted in AlwaysUp | Tagged , | Leave a comment

Q&A: Why Can’t OneDrive Find my Folder?

Why Can't OneDrive Find my Folder?
  We are currently testing AlwaysUp to manage OneDrive from two Windows 2022 STD 21H2 servers and sharing the data externally.

Installation was very easy but it looks like the sync is not working as expected.

Your FAQ says to try starting OneDrive in the current session. When I did, the attached dialogue popped up behind the AlwaysUp app:

OneDrive folder error

Can you tell me how to troubleshoot this further or how I might resolve the issue?

— Marcus

Hi Marcus, thanks for trying AlwaysUp. Fortunately, we have lots of experience running OneDrive as a Windows Service. We’ll get you going soon!

In fact, we’ve seen this specific issue before. Let’s dig into the problem and show you how to fix it.

Your Windows account doesn’t have explicit rights to the OneDrive folder

OneDrive is complaining because the user account you specified on the AlwaysUp Logon tab can’t access the folder. That Windows account needs to be granted permission to the folder for OneDrive to work.

But that’s strange because OneDrive has no problem reading and writing files in the folder when you start it normally on your desktop!

The issue comes up because:

  1. Your rights to the OneDrive folder are granted because you are a member of the Administrators group

  2. AlwaysUp strips away administrative rights in order to run OneDrive as a Windows Service

Fortunately, the problem is easy to fix.

How to grant your Windows account its own rights to the OneDrive folder

Instead of relying on your membership in an administrative group to give you permission to access the OneDrive folder, you should give your account its own rights. Here’s how to do that, step-by-step:

  1. Open Windows File Explorer.

  2. Navigate to your OneDrive folder.

    Normally that’s in “C:\Users\[Your User Account]\OneDrive”, but it will be elsewhere if someone changed where OneDrive stores its files.

  3. Right-click your OneDrive folder and choose Properties:

    Choose Folder Properties
  4. In the OneDrive Properties window, move to the Security tab.

  5. Click Edit:

    Edit OneDrive Security
  6. In the Permissions for OneDrive window, click Add:

    Add permissions for OneDrive
  7. In the Select Users or Groups window, enter your Windows username. This must be the same account you specified on the Logon tab in AlwaysUp. For us that’s “Mike Jones” — a OneDrive user on our Windows 11 QA machine:

    Enter the Windows user account

    Click OK.

  8. Your account will now be listed in the Select Users or Groups window. Make sure that it has full control:

    Grant full control to the folder

    Click OK.

  9. And back in the OneDrive Properties window, click OK to save all your changes:

    OneDrive folder security updated

That’s it. You should be good to go.

To confirm, please start OneDrive in your current session from AlwaysUp. The error window shouldn’t pop up — and the OneDrive icon should appear in your task tray.

Happy syncing!

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