当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何使用 PowerShell 删除 SharePoint 2013 中的服务应用程序?

作者:精品下载站 日期:2024-12-14 14:04:51 浏览:14 分类:玩电脑

如何使用 PowerShell 删除 SharePoint 2013 中的服务应用程序?


要求:使用 PowerShell 删除 SharePoint 2010/2013 服务应用程序。

如何删除 SharePoint 2013 中的服务应用程序?

如果您使用的是 SharePoint 2013,当您不再使用某个服务应用程序时,您可能需要删除该服务以释放一些服务器资源。您可以使用 PowerShell 来执行此操作。在本指南中,我们将向您展示如何删除 SharePoint 中的服务应用程序!

  • 转到 SharePoint 2013 管理中心网站
  • 导航至应用程序管理 >> 管理服务应用程序
  • 在管理服务应用程序页面上,选择要删除的服务应用程序。
  • 单击功能区中的“删除”按钮。

    [玩转系统] 如何使用 PowerShell 删除 SharePoint 2013 中的服务应用程序?

  • 您将看到一个确认对话框,如果您想删除服务应用程序数据库,请选择“删除与服务应用程序关联的数据”。如果您不想删除服务应用程序的数据库,请保留此复选框。
  • 单击“确定”删除服务应用程序。删除后,您将看到确认对话框。

    [玩转系统] 如何使用 PowerShell 删除 SharePoint 2013 中的服务应用程序?

使用 PowerShell 删除 SharePoint 2013 中的服务应用程序

有时,您可能必须在某些情况下使用 PowerShell,例如您无法删除服务应用程序,因为它可能已损坏。要摆脱服务应用程序并使用 PowerShell 将其完全删除?那么,这里有一些 PowerShell cmdlet 可以帮助您!

要从 PowerShell 中删除服务应用程序,请使用 Remove-SPServiceApplication cmdlet。
语法:
Remove-SPServiceApplication {Service-App-ID} [-RemoveData]
例如
删除-SPServiceApplication“222b3f48-746e-4cd2-a21c-018527554120”-RemoveData

Remove-SPServiceApplication 需要我们要删除的目标服务应用程序的 GUID,不是吗?那么,如何获取服务应用程序ID呢?具体方法如下:

运行: Get-SPServiceApplication cmdlet,它会为您提供以下带有 ID 字段的结果:

[玩转系统] 如何使用 PowerShell 删除 SharePoint 2013 中的服务应用程序?

用于删除 SharePoint 2013 服务应用程序的 PowerShell 脚本

让我们通过 PowerShell 使用显示名称强制删除服务应用程序。


#Display Name 
$DisplayName="Excel Services Application"

#Get the Service Application from its Display Name
$SeviceApp = Get-SPServiceApplication -name $DisplayName

#Delete the Service Application
Remove-SPServiceApplication $SeviceApp -removedata -confirm:$false

从其类型名称中获取服务应用程序并删除:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Type Name String
$TypeName="Usage and Health Data Collection Service Application"

#Get the Service Application from its Type
$SeviceApp = Get-SPServiceApplication | Where {$_.TypeName -eq $TypeName}

#Delete the Service Application
Remove-SPServiceApplication $SeviceApp -removedata -confirm:$false 

这是所有服务应用程序的类型名称:

TypeAccess Services Web Service ApplicationAccess Services 2010 Web Service ApplicationApp Management Service ApplicationApplication Discovery and Load Balancer Service ApplicationBusiness Data Connectivity Service ApplicationExcel Services Application Web Service ApplicationMachine Translation ServiceManaged Metadata ServicePerformancePoint Service ApplicationPowerPoint Conversion Service ApplicationSearch Administration Web Service ApplicationSearch Service ApplicationSecure Store Service ApplicationSecurity Token Service ApplicationState ServiceUsage and Health Data Collection Service ApplicationUser Profile Service ApplicationVisio Graphics Service ApplicationWork Management Service ApplicationWord Automation Services上述所有 cmdlet 都会删除服务应用程序及其代理!

如何删除服务应用程序代理?

如果要单独删除服务应用程序代理,请使用:Remove-SPServiceApplicationProxy cmdlet:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Type Name String
$TypeName="Machine Translation Service Proxy"

#Get the Service Application Proxy from its Type
$SeviceAppProxy = Get-SPServiceApplicationProxy | Where {$_.TypeName -eq $TypeName}

#Remove the Service Application Proxy
Remove-SPServiceApplicationProxy $SeviceAppProxy -removedata -confirm:$false

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯