powershell SharePoint Powershell在SharePoint模式下测试Analysis服务。这用于解决SharePoin中的Analysis服务问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell SharePoint Powershell在SharePoint模式下测试Analysis服务。这用于解决SharePoin中的Analysis服务问题相关的知识,希望对你有一定的参考价值。
$ssasServers = Get-SPExcelServiceApplication | Get-SPExcelBIServer $_
if(-Not $ssasServers) { Write-Host "The server pool is empty." } else { $ssasServers }
$adomd = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient")
Write-Host (dir $adomd.Location).VersionInfo.FileVersion –ForegroundColor Yellow
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient")
$server = "scushp01\POWERPIVOT"
$adomd = new-object Microsoft.AnalysisServices.AdomdClient.AdomdConnection
$adomd.ConnectionString = "Data Source=$server;"
$adomd.Open()
if($adomd.State –eq "Open") {Write-Host "Connected" –ForegroundColor Yellow} else {Write-Host "Connection failed." –ForegroundColor Red}
$adomd.Close()
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient")
$server = "http://scushp01/sites/Testing/Shared%20Documents/Book1.xlsx"
$adomd = new-object Microsoft.AnalysisServices.AdomdClient.AdomdConnection
$adomd.ConnectionString = "Datasource=$server;"
$adomd.Open()
if($adomd.State –eq "Open") {Write-Host "Workbook loaded" –ForegroundColor Yellow} else {Write-Host "Workbook loading failed." –ForegroundColor Red}
$adomd.Close()
$spclient = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.SPClient")
if($spclient) {Write-Host "SPClient is installed." –ForegroundColor Yellow} else {Write-Host "SPClient is not installed." –ForegroundColor Red}
##Determine the admins for the Analysis server
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = "scushp01\POWERPIVOT"
$amo = New-Object Microsoft.AnalysisServices.Server
$amo.Connect($server)
$admins = $amo.Roles.GetByName("Administrators")
foreach($admin in $admins.Members){Write-Host $admin.Name –ForegroundColor Yellow}
$amo.Disconnect()
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = "scushp01\POWERPIVOT"
$amo = New-Object Microsoft.AnalysisServices.Server
$amo.Connect($server)
Write-Host "The SSAS server version is: " $amo.Version –ForegroundColor Yellow
$amo.Disconnect()
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = "scushp01\POWERPIVOT"
$amo = New-Object Microsoft.AnalysisServices.Server
$amo.Connect($server)
$mode = $amo.ServerMode
Write-Host "The SSAS server is operating in $mode mode." –ForegroundColor Yellow
$amo.Disconnect()
##Tests opening the workbook
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient")
$server = "http://scushp01/sites/Testing/Shared%20Documents/Book1.xlsx"
$adomd = new-object Microsoft.AnalysisServices.AdomdClient.AdomdConnection
$adomd.ConnectionString = "Datasource=$server;"
$adomd.Open()
if($adomd.State –eq "Open") {Write-Host "Workbook loaded" –ForegroundColor Yellow} else {Write-Host "Workbook loading failed." –ForegroundColor Red}
$adomd.Close()
以上是关于powershell SharePoint Powershell在SharePoint模式下测试Analysis服务。这用于解决SharePoin中的Analysis服务问题的主要内容,如果未能解决你的问题,请参考以下文章
powershell Powershell用于将Powershell与SharePoint 2007一起使用
powershell SharePoint Powershell添加列表项
powershell Sharepoint Powershell Snippets
powershell 为SharePoint 2013创建SharePoint服务帐户(最低)
使用 Powershell 插入 Sharepoint 凭据
powershell SharePoint事件接收器powershell脚本