Yesterday, I wanted to upgrade my Microsoft Office and then planned to clean up my Windows laptop from unused programs, particularly the ones installed by chocolatey (Windows package manager). But, you guess it, things don’t always go as planned.

The first problem I encounter was Error Code: 30015-4 (5) while trying to re-install my Microsoft Office, and then several C:\ProgramData\Microsoft\Windows GetLastError:5 error messages.

These problems were related to Windows permissions, and I suspect that they were caused by a Microsoft troubleshooter tool called SaRA. The tool might have accidentally messed up my Windows permissions during the process of cleaning up the previous Microsoft Office. As a result, my Windows no longer be able to install or remove some apps.

I was able to resolve these problems by manually resetting the permissions of the respective app folders back to their original state. So I think it would be fun to post the walkthrough (might be boring for you 😅).

The Problems

The first problem I ran into was Error Code: 30015-4(5) during the installation of Microsoft Office.


I clicked on the online help, and it was pointing out to this page. At the bottom of the page, it offers an “easy fix” tool to resolve the problem above. I downloaded and ran that tool, but the error remains 🙃.


At this point, I couldn’t install or uninstall any applications wrapped with Windows Installer (.msi) anymore, including NodeJS. It’s the same problem as the one in my PrintNightmare post, in which my Visual Studio refuses to install the Windows SDK.


And somehow, this also affects my laptop’s WiFi functionality/features, such as:

  1. I’m unable to save WiFi profiles and the auto-connect no longer works.
  2. I’m unable to turn on the mobile hotspot feature
  3. The “Forget” and “Properties” options are missing when a right-click is performed on a WiFi connection.
  4. There is a stack-based buffer error!

The most weird one is a stack-based buffer error came from my WiFi settings.


The stack-based buffer error raises when I right-clicked any currently in use Wi-Fi connection from the Wi-Fi settings.


Also, the “Forget” and “Properties” options were missing. I found a similar issue here but the solution doesn’t suite my environment.


Identifying The Root Cause

Searching for Error Code: 30015-4 (5) on the Microsoft Support site didn’t really help, so I started to search for the official documentation about error codes, and then I found this page. I couldn’t find anything about “30015-4” on that page, but I think I did know what is a “(5)” meant.


At this point, it was clear that these problems were related to the system permissions (even my Wi-Fi problem).

I started to investigate C:\Program Files\ and C:\Program Files (x86)\ (the default folder for installed apps), but no problems were found there. So the next one is C:\ProgramData, where all application data is stored/created.

While investigating all the folders under C:\ProgramData\ and C:\ProgramData\Microsoft, I noticed that some of the folders only have my account listed in their security properties.


Normally, the folder permissions under C:\ProgramData should be configured similar to the image below (taken from VirtualBox folder).


And here are the advanced permission settings.


Now I know how the default permissions look like and I can use this as a template to fix the other folders with bad permissions.

Let’s Fix Them

Office Error Code: 30015-4 (5)

This error Error Code: 30015-4 (5) can be resolved by enabling the inheritance on the respective app folder, which is C:\ProgramData\Microsoft\OFFICE. So that the permissions of the Microsoft folder will be inherited to the OFFICE folder. I will also remove my account, “Fahmi FJ”, from the permission entries.


If you’re not sure about this, do check the other folders’ permissions under the same parent folder. Using this case, then the parent folder is C:\ProgramData\Microsoft\, and the child are any folders under C:\ProgramData\Microsoft\[child].

I got my Ms Office back now.



Any GetLastError:5, can be resolved using the same method as above, by enabling the inheritance to the affected application folder.

In my case, I got the following error message from chocolatey and node.js:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs GetLastError: 5

Then, first, I will look into the permissions of Microsoft folder, then Windows folder, and then Start Menu folder, and it turned out the problem is in the Windows folder permissions. So, to resolve this problem, I have to inherit the Microsoft folder permissions to the Windows folder, see image below.


And then, I will revert the Start Menu folder permissions to default, see image below.


Finally inherit the Start Menu folder permissions to the Programs folder.


Again, if you’re not sure about this, and didn’t want to reinstall your Windows, try install a fresh Windows on Virtual Machine / Cloud and inspect the default permission settings.

Stack-based and WiFi error

This section may resolve the following problems.

  • SystemSettings.exe - System Error: The system detected an overrun of a blabla..
  • Windows won’t remember Wi-Fi password
  • The “Forget” and “Properties” options are missing from Wi-Fi connection.
  • Mobile Hotspot Wi-Fi

In my case the root cause of these problems was also the folder permission.

In Windows, all Wi-Fi profiles are stored in C:\ProgramData\Microsoft\Wlansvc\Profiles, so if the permissions are messed up, the system is most likely to crash or partially working. In my case, my laptop is able to connect to any Wi-Fi network, but it can’t remember the Wi-Fi profile, so I have to re-enter my Wi-Fi password every time I want to connect. This caused by the system didn’t have write access on C:\ProgramData\Microsoft\Wlansvc\Profiles.

But, after reverting the permissions of the Wlansvc folder , the WiFi functionality/features returned back to normal.


It also fixed the missing options and auto-connect.


The error message that says “The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application” is no longer arise on the Wi-Fi settings.

Padahal cuma mau reinstall Office, merembetnya kemana-mana 🙃.


That’s all! I hope this post helps you too.

I will try to keep this post updated whenever I face the same problem related to Windows Permissions.