使用PowerShell脚本连接到SSAS

发布于 2025-01-29 16:30:48 字数 319 浏览 4 评论 0 原文

我使用PowerShell及其工作来尝试该代码,但是在PowerShell Core中,我会收到以下错误。

**

错误信息: 异常调用与“ 1”参数的“连接”:“无法加载类型'system.security.security.principal.windowsimpersonationcontext'来自汇编'Mscorlib,版本= 4.0.0.0,culture = 4.0.0.0,culture =中性,publicKeytoken = b77a5c561934e089'。

排队错误: $ server.connect($ servername)

**

I tried the code using powershell and its working but in powershell core I get the following error.

**

Error Message:
Exception calling "Connect" with "1" argument(s): "Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

Error in Line:
$server.connect($ServerName)

**

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼窥荷 2025-02-05 16:30:48

没有足够的代码来确定确切的问题,但听起来您正在导入和使用本机SSAS库。您的代码有类似的东西吗?

$ass = [Reflection.Assembly]::LoadWithPartialName(“Microsoft.AnalysisServices”)
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($connection)

您可以在此处使用的本机PowerShell模块: https://learn.microsoft.com/en-us/analysis-services/powershell/analysis-services-services-powershell-reference?view = asallproducts-allproducts-allversions-allversions

Not quite enough code to determine the exact problem, but it sounds like you're importing and using the native SSAS library. Does your code have something like this?

$ass = [Reflection.Assembly]::LoadWithPartialName(“Microsoft.AnalysisServices”)
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($connection)

There are native PowerShell modules you can use here: https://learn.microsoft.com/en-us/analysis-services/powershell/analysis-services-powershell-reference?view=asallproducts-allversions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文