param ( [string]$InstallFolder = "c:\\Program Files (x86)\\Matrix42\\Matrix42 Workplace Management" ) if ( -not (Test-Path -Path $InstallFolder) ){ Write-Warning "Path does not exist: $InstallFolder" #Exit } function StartService { param ($Name) if (Get-Service -Name $Name -ErrorAction SilentlyContinue) { Write-Host "Starting $Name..." Start-Service -Name $Name } } function StopService { param ($Name) if (Get-Service -Name $Name -ErrorAction SilentlyContinue) { Write-Host "Stopping $Name..." Stop-Service -Name $Name } } StopService -Name "Matrix42.SPS.Engines.Common" StopService -Name "Matrix42.SPS.Engines.CommonX86" StopService -Name "Matrix42.SPS.Engines.Scheduler" StopService -Name "Matrix42.Data.Gateway" StopService -Name "Matrix42.Worker" iisreset.exe -stop $webFolder = "$InstallFolder\\Web" Write-Host Write-Host "Removing legacy files and folders" Get-ChildItem -Path "$webFolder\\" -Exclude bin,Forms,GDIE,Images,ServiceManager,WorkflowStudio | ForEach-Object {Remove-Item $_ -Recurse } Get-ChildItem -Path "$webFolder\\Forms\\" -Exclude AttachmentHandler.ashx,Web.config | ForEach-Object {Remove-Item $_ -Recurse } Get-ChildItem -Path "$webFolder\\GDIE\\" -Exclude Templates | ForEach-Object {Remove-Item $_ -Recurse } Get-ChildItem -Path "$webFolder\\ServiceManager\\" -Exclude Services | ForEach-Object {Remove-Item $_ -Recurse } Get-ChildItem -Path "$webFolder\\bin\\" -Exclude log4net.dll,Matrix42.BizLogic.Common.dll,Matrix42.Common.dll,Matrix42.Contracts.Common.dll,Matrix42.Contracts.Platform.dll,Matrix42.Resources.Core.dll,Matrix42.Resources.dll,Matrix42.Web.AttachmentHandler.dll,Microsoft.Practices.ServiceLocation.dll,update4u.ServiceManager.BizLogic.dll,update4u.ServiceManager.Common.dll,update4u.ServiceManager.WebUI.dll,update4u.SPS.Config.dll,update4u.SPS.Contracts.dll,update4u.SPS.DatabaseFileStorage.dll,update4u.SPS.DataLayer.Contracts.dll,update4u.SPS.DataLayer.dll,update4u.SPS.Instrumentation.dll,update4u.SPS.Security.dll,update4u.SPS.Utility.dll,update4u.SPS.WebUI.Resources.dll | ForEach-Object {Remove-Item $_ -Recurse } Get-ChildItem -Path $InstallFolder -Include Telerik.Web*.dll -Recurse | ForEach-Object {Remove-Item $_} Get-ChildItem -Path "$InstallFolder\\svc\\bin\\" -Include Telerik*,Infragistics* -Recurse | ForEach-Object {Remove-Item $_} Write-Host Write-Host "Adjusting files" $NewWebConfig = ' ' [IO.File]::WriteAllLines("$webFolder\\web.config", $NewWebConfig) [IO.File]::WriteAllText("$webFolder\\legacy-removed-manually.mark", "do not remove") Write-Host StartService -Name "Matrix42.SPS.Engines.Common" StartService -Name "Matrix42.SPS.Engines.CommonX86" StartService -Name "Matrix42.SPS.Engines.Scheduler" StartService -Name "Matrix42.Data.Gateway" StartService -Name "Matrix42.Worker" iisreset.exe -start