Whenever a Sitecore installation fails or an instance takes up too much of my disk space, I end up uninstalling the Sitecore instance. I use the SIF scripts in the installation package to perform this task. This article describes the simplest way to automate Sitecore uninstall tasks with SIF.
Go to the package installation root on your File Explorer.
Create a copy of the file XP0-SingleDeveloper.ps1
.
Rename it as Uninstall-XP0-SingleDeveloper.ps1
.
Open the file Uninstall-XP0-SingleDeveloper.ps1
in an editor.
Change the values of the below variables appropriately.
# The Prefix that will be used on SOLR, Website and Database instances.
$Prefix = "<prefix-provided-during-installation>"
# The Password for the Sitecore Admin User. This will be regenerated if left on the default.
$SitecoreAdminPassword = "<admin-password-provided-during-installation>"
# The root folder with the license file and WDP files.
$SCInstallRoot = "."
# Root folder to install the site to. If left on the default [systemdrive]:\\inetpub\\wwwroot will be used
$SitePhysicalRoot = ""
# The name for the XConnect service.
$XConnectSiteName = "$($prefix)xconnect.dev.local"
# The Sitecore site instance name.
$SitecoreSiteName = "$($prefix)sc.dev.local"
# Identity Server site name
$IdentityServerSiteName = "$($prefix)identityserver.dev.local"
# The Path to the license file
$LicenseFile = "$SCInstallRoot\license.xml"
# The URL of the Solr Server
# Change to Solr instance URL
$SolrUrl = "https://localhost:8840/solr"
# The Folder that Solr has been installed to.
# Change to the path to your Solr instance
$SolrRoot = "C:\Solr\solr-8.4.0"
# The Name of the Solr Service.
# Change to the name of your Solr instance
$SolrService = "solr-8.4.0"
# The DNS name or IP of the SQL Instance.
# Change to your database server
$SqlServer = "localhost"
# A SQL user with sysadmin privileges.
# Change if a different database user was used
$SqlAdminUser = "sa"
# The password for $SQLAdminUser.
$SqlAdminPassword = "<sql-admin-user-password>"
Change the below lines as mentioned:
# Comment this line by adding # in the beginning
#Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Object XP0-SingleDeveloper.log
# And Uncomment this line by removing the # in the beginning
Uninstall-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Object XP0-SingleDeveloper-Uninstall.log
Run PowerShell as Administrator.
Run the below command in PowerShell.
cd '<Path\To\Installation Files>'
.\Uninstall-XP0-SingleDeveloper.ps1
This should remove and clean up your websites, databases and indexes related to the specific instance.
Please feel free to post your questions/suggestions in the comments.
Happy Sitecoring!