In this SharePoint online remove apps article, we will learn about how to remove the custom app from the SharePoint Online site using PnP PowerShell or how to remove an app from SharePoint Online using PowerShell.
SharePoint online remove apps – use case
Many times, due to technical issues we will not be able to remove the custom app installed on the SharePoint Online site manually, then we need to take the help of the PnP PowerShell command. For example, in our scenario, we were not able to remove the Nintex Forms for office 365 and Nintex Workflow for office 365. Again and again, we were getting the same error ” Sorry, we couldn’t remove the app. Click to retry”, we had tried multiple times by clicking on the “Click to retry” link but we have never been successful. Below are the error messages for the Nintex Forms for office 365 and Nintex Workflow for the office 365 app:
![]() ![]() |
In the above scenario, we are bound to use the PowerShell command to remove the custom app from the SharePoint Online site.
SharePoint online remove apps –
remove app from SharePoint Online using PowerShell PnP
#The below script is used to remove the custom app installed in the SharePoint Online site. cls $PSshell = Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorVariable err -ErrorAction SilentlyContinue if($PSshell -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } $fileName = "Removing custom app in SPO" #'yyyyMMddhhmm yyyyMMdd $enddate = (Get-Date).tostring("yyyyMMddhhmmss") #$filename = $enddate + '_VMReport.doc' $logFileName = $fileName +"_"+ $enddate+"_Log.txt" $invocation = (Get-Variable MyInvocation).Value $directoryPath = Split-Path $invocation.MyCommand.Path $directoryPathForLog=$directoryPath+"\"+"LogFiles" if(!(Test-Path -path $directoryPathForLog)) { New-Item -ItemType directory -Path $directoryPathForLog #Write-Host "Please Provide Proper Log Path" -ForegroundColor Red } #$logPath = $directoryPath + "\" + $logFileName $logPath = $directoryPathForLog + "\" + $logFileName $isLogFileCreated = $False function Write-Log([string]$logMsg) { if(!$isLogFileCreated){ Write-Host "Creating Log File..." if(!(Test-Path -path $directoryPath)) { Write-Host "Please Provide Proper Log Path" -ForegroundColor Red } else { $script:isLogFileCreated = $True Write-Host "Log File ($logFileName) Created..." [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg) Add-Content -Path $logPath -Value $logMessage } } else { [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg) Add-Content -Path $logPath -Value $logMessage } } ########################Remove Nintex 365 apps from SharePoint Online site############################## #Paramaters area $siteURL = "https://yourspositeURL" $userName = "yourSPOUser@yourdomain.com" $passWord = "YourSPOPassword" #Paramaters area - Ends $encPassWord = convertto-securestring -String $passWord -AsPlainText -Force $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord Try { Connect-PnPOnline -Url $SiteURL -Credentials $cred #Getting the site collection level feature by ID #$feature = Get-PnPFeature -Scope Site -Identity $featureID $NintexFormsforOffice365ID="255582b4-52bd-614e-9538-63ddb6b08fa5" $NintexWorkflowforOffice365ID="dfd5a4at-4556-96de-ad0f-fa40f8c09957" $allApps=Get-PnPAppInstance foreach($oneApp in $allApps) { $appID=$oneApp.ID #Uninstall-PnPAppInstance -Identity $NintexWorkflowforOffice365ID -force if($oneApp.ID -eq $NintexFormsforOffice365ID) { #The Nintex form for offfice 365 app is being removed from the SPO site collection. Write-host -f Yellow "Nintex form for offfice 365 app is being removed from: "$SiteURL Uninstall-PnPApp -Identity $NintexFormsforOffice365ID -force Write-host -f Green "The Nintex form for offfice 365 app successfully has been removed Successfully!" } if($oneApp.ID -eq $NintexWorkflowforOffice365ID) { #The Nintex workflow for offfice 365 app is being removed from the SPO site collection. Write-host -f Yellow "The Nintex workflow for offfice 365 app is being removed from: "$SiteURL Uninstall-PnPApp -Identity $NintexWorkflowforOffice365ID -force Write-host -f Green "The Nintex workflow for offfice 365 app successfully has been removed Successfully!" } } } Catch { $ErrorMessage = $_.Exception.Message +"in remving Nintex 365 app from the SharePoint Online site!:" Write-Host $ErrorMessage -BackgroundColor Red Write-Log $ErrorMessage } ########################Remove Nintex 365 apps from SharePoint Online site - Ends here ##############################
While removing the app, if we use the ‘Uninstall-PnPAppInstance’ command we will get the below warning:
“Warning – The command ‘Uninstall-PnPAppInstance’ is obsolete. use ‘Uninstall-PnPApp’ instead. ‘Uninstall-PnPAppInstance’ : No package was found for the provided app Instance.”

Summary: SharePoint online remove apps using PowerShell
Thus in this tutorial, we have learned about how to remove the custom app installed on the SharePoint site using the PnP PowerShell.
See Also: SharePoint online remove apps using PowerShell
You may also like the following SharePoint PowerShell tutorials:
- Office 365: How to create content type in SharePoint Online using PowerShell?
- Office 365: How to create document library in SharePoint Online using PowerShell?
- Export SharePoint user information list to CSV(Excel) file using PowerShell
- How to fix “The term ‘Get-MsolUser’ is not recognized as the name of a cmdlet”
- How to fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error
- How to hide quick launch menu in SharePoint online using PnP PowerShell
- Edit user Permission is greyed Out SharePoint Online
- Get workflow inventory from SharePoint online using PowerShell CSOM
- Create a modern team site using PnP PowerShell in SharePoint
- In 2 steps convert a classic SharePoint page to modern using PnP
- SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM
- Create SharePoint online list using PnP provisioning template
- SharePoint Automation: PowerShell script to get remote server information
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM
- SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM
- SharePoint Online Automation – O365 – Update document library metadata using PowerShell CSOM
- Introduction to SharePoint information architecture
Hope you have enjoyed reading this article and helped you. If you would like to appreciate our efforts or if you have a better solution or a different opinion, please write to the below comment section and do share this with your friends and colleagues. 🙂
1 comments on “SharePoint online remove apps: Remove custom app using PnP PowerShell effectively”