Are you looking to uninstall a Sitecore XP instance from your PC or a server? Have you named the instance incorrectly or you just need to clean up some space?
Whether you’re cleaning up after a development project or making way for a fresh installation, removing Sitecore XP completely can sometimes be a boring task. In this guide, I’ll walk you through a PowerShell script that automates the removal process.
The Uninstallation Script:
Get the latest version on my repository: https://github.com/alvaropmontenegro/sitecore-uninstaller-script
It contains a .ps1 file named Uninstaller-SitecoreXP.ps1
.
How to Use
- Clone or download the repository to your local machine.
- Open PowerShell with administrative privileges.
- Navigate to the directory where the script is located.
- Modify the script variables to match your environment.
- Run the script by executing
.\Uninstaller-SitecoreXP.ps1
. - Wait for the script to complete.
- Verify that Sitecore has been successfully uninstalled from your system.
Prerequisites
- PowerShell (version 5.1 or later)
- Administrative privileges
Compatability
This script was tested with Sitecore 9.3 and all the Sitecore 10.x versions.
Initiall Variables
Before running the script you must set up the initial variables, which includes:
- Website Name
- Root Path
- Host File Path
- Solr
- SQL Server config
To edit these variables, edit the .ps1 file and fill it in.
What does it do?
The idea of this scripts is to perfom the following 6 task:
Step 1: Remove the IIS Configuration
The script begins by removing the Internet Information Services (IIS) configuration associated with your Sitecore instance. It targets the Main Website, the Identity Server, and xConnect sites and their respective application pools, ensuring a clean removal of these components from your IIS.
Step 2: Delete Entries in the Hosts File
Next, the script removes entries related to your Sitecore instance from the hosts file.
Step 3: Delete Windows Services
Then, it proceeds to remove any Windows services associated with your Sitecore instance, which usually are the xConnect services. It stops the services before deleting them.
Step 4: Delete the Databases
Moving on, the script targets the databases associated with your Sitecore instance. Using SQL Server Management Objects (SMO), it drops each database. There’s a variable to add or remove any custom database if this is your case.
Step 5: Delete the Webroot Directory
The script then removes the root directory of your Sitecore instance from the file system. This step ensures that all files and folders related to your Sitecore installation are completely wiped from your system.
Step 6: Delete/Remove Solr Service (Optional)
If desired, the script offers an optional step to remove the Solr service along with its associated files and configurations. This step is useful if you no longer require Solr for your Sitecore installation.
Other Alternatives
In case it doesn’t work for you, try these other alternatives:
- https://www.c-sharpcorner.com/article/manual-uninstallation-of-sitecore-step-by-step-guide/
- https://www.vinayjadav.com/posts/uninstall-sitecore-instance-installed-with-sia
Leave a Reply