You may need to move the MID Server installation folder to a different folder or disk on the same host server. This applies to a MID Server installed on Windows, however the general ideas remain the same for Linux.
Release or Environment
Any, where a Windows hosted MID Server is installed. Versions prior to Geneva, or customers that don't run Discovery/Service Mapping, will not have a WMI Collector Service. Versions from Orlando will not have a WMI Collector Service, as the PowerShell code in the main MID Server service is now used for all WMI probes/patterns.
Valid reasons for needing to do this might be:
- When you extracted the install ZIP file, you ended up with the zip file name as part of the folder name (easy mistake to make with Windows explorer).
e.g. C:\Prod_Disco_MID\mid.madrid-12-18-2018_01-07-2019_0000.windows.x86-64\agent\ -> C:\Prod_Disco_MID\agent\
- You included spaces and extended characters in the folder names, which causes problems for probes.
e.g. C:\Bad Gottleuba-Berggießhübel MID Server\agent -> C:\East_German_MID_Server\agent
- You installed within a user profile, such as on your user's Desktop or Download folder, which doesn't work well, even when the windows service is set to login as that user.
e.g. C:\Users\Dave\Desktop\agent\ -> C:\ServiceNow_MID_Servers\Prod_Disco_MID\agent\
- File permissions policy limitations on the current disk or folder may not meet the requirements. Perhaps causing problems for auto-upgrades.
- You may need to move it to another disk due to underestimating how much disk space the MID Server would need, perhaps because you are needing to buffer large import sets, or use the Export Sets feature which must save files within the install folder. MID Server system requirements suggests recommended minimums in various configurations.
e.g. C:\ServiceNow_MID_Servers\Prod_Disco_MID\agent\ -> D:\ServiceNow_MID_Servers\Prod_Disco_MID\agent\
- ...and maybe others
Note: This is possible and safe to do, but I will leave it up to you to decide if this process is more hassle than simply installing a new replacement MID Server in the right place.
The only place a full path to a MID Server installation exists on the host is in the Registry keys that define the Windows Service. This procedure is based on manually moving the installation folder, and then updating the Windows Registry for the Windows Services to match the folder change.
The MID Server will have to be stopped while the change is made. You can't move files that are in use.
Warning: Any out-of-box code will use relative paths, relative to the agent folder. This procedure assumes all custom code also uses relative paths. e.g. Powershell script locations in Orchestration activities, Export Set file paths, etc..
- Stop the relevant Services
- ServiceNow MID Server
- Open the Services Control Panel applet. Run: services.msc
- Find the main MID Server service, and open it.
If the MID Server is named "Prod Disco MID" in the instance, and it was installed using the installer.bat installer, then:
Display name: "ServiceNow MID Server_Prod Disco MID"
Service name: "snc_mid_Prod Disco MID"
- Record the Service name
- Confirm the Path to executable matches what you thought it was. If not you may be looking at the wrong MID Server Service.
- Stop the MID Server Service
- WMI Collector Service
- Find the WMI Collector Service. By default there is one, regardless of how many MID Servers are installed. There may be more than one. There may be none if you don't use any Discovery products, in which case ignore this bit.
- Open each in turn until you find the one using the same agent folder in the Path to executable as your MID Server Service above
- If there is only one, then the names are:
- Display name: "ServiceNow WMI Collector"
Service name: "ServiceNow WMI Collector"
- Record the Service name
- Stop that WMI Collector Service, but only if it is using the binaries from this same MID Server install folder.
- ServiceNow MID Server
- Move the installation folder
- Copy the agent folder. Don't try and actually move it, as you will almost certainly have file locks.
- Paste it where you want it.
- Record the new path to the agent folder.
- Delete the old folder. If Windows prevents you deleting some files, check you don't have any logs open. You may also need to stop other MID Server services which are sharing the WMI Collector Service. You may need to restart the host server to free up the locks.
- Modify the Registry
- Open the Registry Editor. Run: regedit.exe
- Open this Key: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
- Find the keys within that with the Service Names of both the ServiceNow MID Server service, and WMI Collector service.
- For each service
- Click the key, to display the data on the right side of the screen
- Edit the ImagePath value to change the path. The main service value has the path in twice, so don't forget to modify both paths in the value.
- Update the Home Directory field on the MID Server record in the instance. This will avoid an 'Issues"record being automatically created for an unexpected folder change.
- Open a list of MID Server: MID Server -> Servers
- Personalize List Columns to add the Home Directory column
- Edit the folder patch from the list
- Start the Service again
- Check that the MID Server comes back Up again.