MID Server - Windows File Permissions
I recently had a struggle with Windows File Permissions on my MID Servers and got into a real mess. So I though I would share my learnings.
The problem became apparent when we saw errors (about File permissions) in the MID Server logs.
In the config.xml, there is a configuration parameter that controls if the PowerShell Startup Script should be run.
This PowerShell Script changes the permissions of the agent folder (non-inherited) as described below.
You can turn off this script using this config:
Changing permissions on Files and Folders in Windows is a pain. (This is where Unix wins by a mile).
But it can be achieved in Windows if you follow some basic rules. The key is to change the file ownership before attempting to change an permissions.
- Make sure you turn off the PowerShell Scrip that automatically changes the permissions when the Agent starts - otherwise it gets very confusing. (see above).
- Don't try and change permissions with PowerShell; you can do everything faster and better with File Explorer.
- Open File Explorer (not 100% sure this is necessary - but does no hurt).
- Open a CMD Prompt as Administrator
- Type Explorer to Open File Explorer as Administrator
- Open a CMD Prompt as Administrator
- Change Ownership of all Files and Folders
- Right Click on your top level parent and select Properties. Click on the Security Tab and Click on Advanced.
- Change the Ownership to You (your logged in Account)
- Click on the option to propagate the ownership change to all Children (sub-folder and files)
- Right Click on your top level parent and select Properties. Click on the Security Tab and Click on Advanced.
- Set Permissions On Parent Folder
- Pick a parent folder from which you will set the permissions. For example, all my SN Agents are Installed under: D:\Apps\ServiceNow
- Set the Parent Folder to Non-Inherited
- Set all permissions on the Parent (read, write, execute etc.) for the User Accounts that you want.
- For Example, I set read-only for everyone, and ticked on all permissions for me, the service account, and the Administrators Group.
- Pick a parent folder from which you will set the permissions. For example, all my SN Agents are Installed under: D:\Apps\ServiceNow
- Now you can change the permissions on Sub Folders and Files.
- Change everything to inheritable from the Current (Parent) folder.
- Use the option For the This Folder, Subfolder and Files
- Click on the Option: Replace all child object permission entries with inheritable permissions from this object
- Change everything to inheritable from the Current (Parent) folder.
Labels:
https://www.servicenow.com/community/now-platform-articles/mid-server-windows-file-permissions/ta-p/2328287
