PowerShell Helper scripts to manage Service Fabric services.
- Copy the files
- Open Command Line or PowerShell (Window + X, A)
- If you opened Command Prompt, then type powershell in order to use PowerShell commands
- Navigate to the scripts directory
cd your_directory
- Type
Import-Module .\ServiceFabricHelper.psm1
- Now you can use the methods from your PowerShell session
- Enable execution policy using PowerShell Admin
Set-ExecutionPolicy Unrestricted
- Navigate to the profile path
cd (Split-Path -parent $PROFILE)
- Open the location in Explorer
ii .
- Create the user profile if it does not exist
If (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
- Import the module in the PowerShell profile
Import-Module -Path script_directory -ErrorAction SilentlyContinue
Remove all Service Fabric applications from your local cluster
Remove all Service Fabric services
Remove-AllServiceFabricServices
Remove Service Fabric application
Remove service fabric application by project name and path
Remove-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\'
Remove service fabric application by project name, path and application name
Remove-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -AppName 'fabric:\MyTestProject.Test@0'
Remove service fabric application by project name, path and application name without deleting application type
Remove-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -AppName 'fabric:\MyTestProject.Test@0' -DeleteType $false
Update Service Fabric application
Update service fabric application by project name and path
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\'
Update service fabric application by project name and path using a different publish profile
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -Node 'Local.5Node'
Update service fabric application by project name, path and solution name
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -SolutionName 'C:\git\Service Fabric\TestProject\TestProject.sln'
Update service fabric application by project name and path using specific msbuild
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -MsbuildPath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe'
Update service fabric application by project name, path and application name
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -AppName 'fabric:\MyTestProject.Test@0'
Update service fabric application by project name, path and application name without deleting application type
Update-ServiceFabricApplication -ProjectName 'Test' -Path 'C:\git\Service Fabric\TestProject\' -AppName 'fabric:\MyTestProject.Test@0' -DeleteType $false