function Uninstall-SDKIISComponents { Import-Module WebAdministration $appPoolNames = @("WebClientAdmin","AuditService","BankService","WebClient","Client","Admin","ContentService","CoreService","ExceptionService","IPSTS","MessageCenterService","NagConfigurationService","NotificationService","RP-STS","SchedulerService","SecurityManagementService","STSConfiguration","symconnectmultiplexer","root") Function GetTemporaryASPNetDirectory { return "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\" } Function ClearIISTempFiles($appPools) { $appPools = ($appPools, @() -ne $null)[0] $appPools | % { $appPool = $_ try { $path = (Join-Path (GetTemporaryASPNetDirectory) $appPool) if (Test-Path $path) { [AlkamiDirectories]::FlushDirectory($path) } } catch { Write-Warning "could not delete temp files for app pool $appPool" } } } $copyDir = @" using System; using System.IO; using System.Collections.Generic; using System.Linq; public class AlkamiDirectories { public static void FlushDirectory(string directoryName) { if (Directory.Exists(directoryName)) { try { Directory.Delete(directoryName, true); } catch (Exception ex) { System.Console.WriteLine(string.Format("could not delete {0}. ex.message {1}", directoryName, ex.Message)); Directory.Delete(directoryName, true); } } } } "@; Add-Type -TypeDefinition $CopyDir $installPath = split-path -parent $MyInvocation.MyCommand.Path ############################################################################### ## install/configure ORB ## TODO: Copy this into the right path and then include it. iisreset /stop /timeout:60 Uninstall-AlkamiService -Path (Join-Path (Get-OrbPath) 'Radium') @( "AuditService" "BankService" "ContentService" "CoreService" "ExceptionService" "MessageCenterService" "NagConfigurationService" "NotificationService" "RP-STS" "STSConfiguration" "SchedulerService" "SecurityManagementService" "SymConnectMultiplexer" "CUFX" "OrbFX" "TextBanking" ) | % { if (Get-WebApplication -Name $_ -Site "Client") { Remove-WebApplication -Name $_ -Site "Client" } ## Ensure that the app exists (!!(Get ... and then ensure that there are NO applications attached to it (!xyz.Count == true if xyz.Count = 0) if (!!(Get-IisAppPool -Name $_) -and !(@(Get-WebConfigurationProperty "/system.applicationHost/sites/site/application[@applicationPool=`'$_`']" "machine/webroot/apphost" -name path).Count)) { Remove-WebAppPool -Name $_ } } @( "WebClient" "IPSTS" "WebClientAdmin", "Client", "Admin", "developer.dev.alkamitech.com", "IP-STS" ) | % { if (Test-Path IIS:\Sites\$_) { Remove-WebSite -Name $_ } if (Test-Path IIS:\AppPools\$_) { Remove-WebAppPool -Name $_ } } ClearIISTempFiles $appPoolNames $logDirectory = "C:\Orblogs" if (!(Test-Path $logDirectory)) { Remove-Item $logDirectory -Recurse -Force -ErrorAction Ignore } iisreset /start }