Content Manager 24.4 Governance and Compliance SharePoint App Help Center

# E: Example PowerShell Scripts

These example scripts are provided to help with troubleshooting, and in some cases to aid in bulk actions.

OpenText takes no responsibility for the use of these scripts. They are intended to be used by administrators with sufficient PowerShell knowledge, in order to customise and tweak these scripts in accordance with local systems and policies. If you are unsure, test the script in a non-production environment. If you are still unsure, DO NOT USE them.

## SharePoint

List all SharePoint Trusted Security Token Issuers

`Get-SPTrustedSecurityTokenIssuer | select Name,RegisteredIssuerName | fl`

App Management

Remove Content Manager app from all sites and site collections in a web application

`## Remove-App.ps1
## Remove (uninstall) all app instances for a product id on an particular web application
##
## Usage:
##
## ## Remove an App by uninstalling all the instances of an App
## Remove-App -productId <ProductId> -webAppUrl <webAppUrl>
##
param(
[Parameter(Mandatory=$true)] [String] $webAppUrl
)`

`Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
# Set excluded paths as comma-delimited strings, replace these examples
[array]$excludedPaths = "http://spdev12013/sites/inplacerm/not",
"http://spdev12013/sites/my/nothing"
# Set Content Manager App ProductID
$productId = "C493061F-E2BB-4516-8537-45C4FB005D83";
function RemoveInstances($productId = $null, $webAppUrl = $null)
{
$outAppName = "";
$sites = Get-SPSite -WebApplication $webAppUrl
$outWebs = @()
foreach($site in $sites){
if($site.AdministrationSiteType -ne "None"){
continue;
}
$webs = Get-SPWeb -site $site
foreach($web in $webs) {
$appinstances = Get-SPAppInstance -Web $web
foreach($instance in $appinstances) {
# Check if there are sites where the property should not be changed
if ($excludedPaths -notcontains $_.Url) {
if($productId -eq $instance.App.ProductId) {
if ($outAppName -eq "") {
$outAppName = $instance.Title;
}
$outWebs += $web;
Write-Host "Uninstalling from" $web.Url;
Uninstall-SPAppInstance -Identity $instance -confirm:$false
}
}
}
}
}
return ($outAppName,$outWebs)
}
$confirm = Read-Host "This will uninstall all instances of the App and is irreversible. Proceed? (y/n)"
if($confirm -ne "y"){
Exit
}
$global:appName = $null;
$global:webs = $null;
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges(
{
$returnvalue = RemoveInstances -productId $productId -webAppUrl $webAppUrl;
$global:appName = $returnvalue[0];
$global:webs = $returnvalue[1];
}
);
$count = $global:webs.Count;
if($count -gt 0){
Write-Host "All the instances of the following App have been uninstalled:";
Write-Host "App Name:" $global:appName;
Write-Host "Product Id: $productId";
Write-Host "Number of instances: $count";
Write-Host "";
Write-Host "Urls:";
foreach($web in $global:webs) {
Write-Host $web.Url;
}
}
else {
Write-Host "No instances of the App with Product Id $productId found.";
}
return;`

Removal of the SharePoint 2010 Integration Solution

Please do not retract and remove the SharePoint 2010 Integration solution. Instead please read this blog article for latest information on the correct steps and tools to use to perform the removal and clean-up of the SharePoint 2010 Integration solution: http://www.imsharepoint.net/blog/2017/6/21/how-to-upgrade-from-sharepoint-2010-integration-solution-to-sharepoint-2013-integration-app

## Windows Azure

Create an Windows Azure Managed Cache

`New-AzureManagedCache -Name hprm -Location "East Asia" -Sku Basic -Memory 128MB
Get-AzureManagedCache`

Copyright 2008-2024 Open Text
Version 24.4 | Last updated October 2024
Contact

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to hprmdocumentation@microfocus.com.

We appreciate your feedback!

Product: Content Manager 24.4

Topic Title: E: Example PowerShell Scripts