Uninstall
You may need to uninstall your K2 environment. Re-run the Setup Manager to remove K2.
When uninstalling K2 components from your environment it is very important to follow the specified order of events, to ensure a successful removal of all K2 components. If you are uninstalling K2 blackpearl and K2 smartforms, start by first uninstalling K2 smartforms.

Removing K2 blackpearl is essentially a reversal of the installation and configuration process. The K2 blackpearl Setup Manager will identify the components installed and remove them from the target system.

If you have installed K2 blackpearl in a distributed environment, uninstall all client components first. Then uninstall the server components in the following order:
- K2 for Reporting Services
- K2 Workspace
- K2 for SharePoint
- K2 Server
Uninstalling steps:
- Be sure to save all your work and close the designers before continuing.
- Ensure that all K2 related processes, such as K2 Designer for Visual Studio, K2 Designer for SharePoint, K2 Web Designer (Legacy), and K2 blackpearl Server service, are shut down.
- Run the K2 blackpearl Setup Manager (Setup.exe or browse to Start > All Programs > K2 blackpearl > K2 blackpearl Setup Manager) and select the Remove K2 blackpearl option.
- Follow the on-screen prompts to complete the wizard.
- Reboot after the uninstall.

After uninstalling the K2 blackpearl components, there are some manual steps to clean up the environment. They are as follows:
Manually remove remnants
Your folder directories may differ from those listed below based on your installation location or if you are running on 32-bit or 64-bit operating system.
- Delete the K2 Workspace icon from the desktop.
- The K2 blackpearl menu item is left in the Start menu after the uninstall. Delete this menu item by right-clicking the Start menu and selecting Explore / Open All Users. Then browse to Programs folder and delete the K2 blackpearl folder.
- The SourceCode assemblies remain in the Global Assembly Cache (GAC). Delete all SourceCode assemblies from the C:\Windows\Assembly folder.
- The SourceCode registry key remains after uninstall. Delete the registry key located at HKEY_LOCAL_MACHINE > SOFTWARE > SourceCode.
- The K2 blackpearl folder structure remains. Delete the folder located at C:\Program Files\K2 blackpearl (this may differ depending on your installation location)
- The databases remain in SQL Server, which means data is preserved. To restore the server to a clean state, delete the databases highlighted in the image below. If you need to preserve process or logged information, make a backup copy before deleting the databases.
- The machine.config file has remaining SourceCode entries. Edit the machine.config file, located at C:\Windows\Microsoft.NET\Framework\v2.0.50727\config, and remove all sections that mention SourceCode, including the <sourcecode.configuration> node. Be sure to save your changes to the file.
- The K2 hidden lists are left in the sites K2 was activated to. SharePoint APIs or tools such as SharePoint Manager can be used to find and delete the hidden lists. K2 hidden lists utilize a GUID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} as part of their name and can be further identified by the description which will contain text similar to “Internal list used by K2…”.
- Some “SourceCode.SharePoint.WebPart…” features are installed in the following location: <install drive>:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES. These can be deleted.
- Delete the following directory: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\SourceCode.ReportDataService.
- Remove the following nodes from the RSReportDesigner.config located in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSReportDesigner.config. Use and copy code from the Tip box below:

<Extensions>
<Data>
<Extension Name="SOURCECODE" Type="SourceCode.Data.SmartObjectsClient.SOConnection,SourceCode.Data.SmartObjectsClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16A2C5AAAA1B130D" />
</Data>
<Designer>
<Extension Name="SOURCECODE" Type="Microsoft.ReportingServices.QueryDesigners.GenericQueryDesigner,Microsoft.ReportingServices.QueryDesigners" />
</Designer>
</Extensions>
SQL Reporting Service fix
This step is only required if you encounter an error browsing to the SQL Web Service, or if you are not able to open SQL Reporting Services after the uninstall. This step only needs to be performed on the server that has the K2 for Reporting Services component installed.
- After uninstalling K2 blackpearl, browse to C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer (this location may vary depending on where you installed SQL Server Reporting Services).
- Edit the rssrvpolicy.config file in a text editor such as Notepad.
- Find the CodeGroup node, and edit it as specified in the Tip box below:
- Save your changes to the file.
<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Nothing">
<IMembershipCondition class="AllMembershipCondition" version="1">
</IMembershipCondition>
</CodeGroup>

After uninstalling K2 blackpearl and performing the manual steps, reboot the machine. Then ensure the environment does not have any K2-related components left. Use the checklist below:
- Make sure no K2 Databases are present on the SQL Server.
- Make sure the K2 blackpearl menu items are not present under Start > Programs.
- Make sure no K2 components are present in Add / Remove programs (Start > Control Panel > Add /Remove Programs).
- Make sure no SourceCode nodes are present in the machine.config file.
- Make sure no SourceCode assemblies are in the GAC (C:\Windows\Assembly).
- Make sure no K2 blackpearl folder is located under Program Files.
- Make sure no K2 For SharePoint tab in the SharePoint 3.0 Central Administration Site.
- Make sure no K2WorklistWebpart.wsp located in the SharePoint 3.0 Central Administration Site.
- Make sure no issues opening the SQL Server Reporting Services home page.

- When uninstalling K2 components from your environment you must follow the specified order of events to ensure a successful removal of all K2 components.
- You will not be able to remove a component when the K2 Designer for Visual Studio is running.
- You cannot use K2 blackpearl Setup Manager to remove K2 smartforms and vice versa.
- Uninstalling K2 blackpearl will remove all components from the target system. If you want to remove just a single component, select the Modify K2 blackpearl option from the Setup Manager.
- If the components are being removed from a distributed environment, then removing the components from the target system may cause issues in the associated environment /s. There are several manual clean up steps to ensure the environment works properly, as already shown in the sections above, be sure to follow them closely.
- If you have multiple K2 servers in a distributed installation and uninstall one of them, the remaining K2 servers in the farm may raise errors such as "cannot connect to [name of uninstalled server]". This error resolves automatically after a few minutes as background processes disable the uninstalled server’s entry in the server table.
- If you remove K2 blackpearl, then K2 smartforms will no longer function and will have to be removed as it relies on K2 blackpearl. Uninstall K2 smartforms before K2 blackpearl.

Removing K2 smartforms is essentially a reversal of the installation and configuration process. K2 smartforms Setup Manager will identify the components installed and remove them from the target system. This sections walks through the steps to remove K2 smartforms from a single server. For a distributed environment, perform these steps on all servers that have K2 smartforms installed.

If you have installed K2 smartforms in a distributed environment, uninstall all client components first. Then uninstall the server components in the following order:
- SmartForms for SharePoint
- K2 Designer
- SmartForms Runtime
- K2 smartforms
Be sure to uninstall all other components first, ending with the Server component.
Uninstalling steps:
- Be sure to save all your work and close the designers before continuing.
- Ensure that all K2 related Workflows, such as K2 smartforms Designer, K2 Designer for Visual Studio, K2 Studio, K2 Workflow Designer, K2 Designer for SharePoint, and K2 blackpearl Server service, are shut down.
- Run the K2 smartforms Setup Manager (Setup.exe or browse to Start > All Programs > K2 smartforms > K2 smartforms Setup Manager) and select the Remove K2 smarforms option.
- Follow the on-screen prompts to complete the wizard.
- Reboot after the uninstall.

- When uninstalling K2 components from your environment you must follow the specified order of events to ensure a successful removal of all K2 components.
- Uninstalling K2 smartforms will remove all components from the target system. If you want to remove just a single component, select the Modify K2 smartforms option from the Setup Manager.
- You cannot use K2 blackpearl Setup Manager to remove K2 smartforms and vice versa.
- If you remove K2 blackpearl, then K2 smartforms will no longer function and will have to be removed as it relies on K2 blackpearl.

The install / uninstall process for the K2 Language Pack is modular, meaning single or multiple languages can be installed or uninstalled simultaneously.

If you have installed languages from the K2 Language Pack, run the K2 Language Pack Setup Manager tool to remove the installed languages. This will remove all selected language components, Start Menu shortcuts, and related setup files from the Program Files directory.
Steps
- Run the K2 Language Pack Setup Manager (Setup.exe or browse to Start > All Programs > K2 blackpearl > K2 Language Pack > K2 Language Pack Setup Manager).
- A list of currently installed and available languages displays. A check next to a language indicates that the language is currently installed.
- To uninstall the installed languages, un-check the currently installed languages. Notice the Action status indicates Uninstall. Click Next.
- Click Yes to confirm uninstall.
- Click Next to uninstall the selected languages.
- Click Finish.




