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

[玩转系统] 使用 PowerShell 检查服务应用程序是否正在 SharePoint 中运行

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

使用 PowerShell 检查服务应用程序是否正在 SharePoint 中运行


如果您是 SharePoint 管理员,有时可能需要检查服务应用程序是否正在运行。就我而言,有几次,我必须在执行以下活动之前获取服务应用程序的状态:停止和启动服务、监视服务应用程序的可用性等。这篇博文将向您展示如何使用 PowerShell 来检查是否服务应用程序正在(或未)在 SharePoint 中运行。

用于检查服务应用程序状态的 PowerShell 脚本:

以下是我们如何使用 PowerShell 检查服务应用程序是否已创建并正在运行。


Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#Display Name of the Service Application
$DisplayName="Managed Metadata Services"

#Get the Service Application from its Name
$ServiceApp = Get-SPServiceApplication | Where { $_.DisplayName -eq $DisplayName}
    
if($ServiceApp -ne $null)
{
 #get the Service application status
 $ServiceApp.Status
}
else
{
 Write-Host "Service application either not found or not created!"
}

该脚本给出了服务应用程序的当前状态。您还可以从其类型获取服务应用程序。具体方法如下:


#Type Name of the Service Application
$TypeName="Managed Metadata Service"

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

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

Type NameAccess 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

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

取消回复欢迎 发表评论:

关灯