无法获取 Service Fabric PowerShell 模块

Unable to get Service Fabric PowerShell module

我 运行 在 Windows Server 2016 Datacenter 上,但我无法获得 Service Fabric commandlet,例如 Connect-ServiceFabricCluster。

Documentation 说:Service Fabric PowerShell 模块随 Service Fabric SDK、运行时和工具一起安装。

我还能尝试什么?它在我正在使用的其他系统中工作 Windows 10. 我可以从它工作的另一个系统导出模块并在此处导入它吗?

不知道你是怎么安装service fabric sdk的;我自己尝试过并能够在列表中找到 Connect-ServiceFabricCluster。我可以建议两种最简单的安装方法。

一个。含 Choco 套餐

choco install MicrosoftAzure-ServiceFabric-CoreSDK --source webpi --confirm

乙。单独安装

Install visual c++ 2012 SP1 redistributable package

Invoke-WebRequest "http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU1/vcredist_x64.exe" -OutFile "C:\vcredist.exe" -UseBasicParsing; \ Start-Process "C:\vcredist.exe" -ArgumentList '/install', '/passive' -NoNewWindow -Wait; \ rm "C:\vcredist.exe"

Install Service Fabric Runtime

Invoke-WebRequest "http://download.microsoft.com/download/3/2/1/3217654F-6882-4CEA-BD51-49287EDECE9B/MicrosoftServiceFabric.6.0.232.9494.exe" -OutFile "C:\ServiceFabricRuntime.exe" -UseBasicParsing; \ Start-Process "C:\ServiceFabricRuntime.exe" -ArgumentList '/AcceptEULA', '/QUIET' -NoNewWindow -Wait; \ rm "C:\ServiceFabricRuntime.exe"

Install Service Fabric SDK

Invoke-WebRequest "http://download.microsoft.com/download/3/2/1/3217654F-6882-4CEA-BD51-49287EDECE9B/MicrosoftServiceFabricSDK.2.8.232.msi" -OutFile "C:\ServiceFabricSDK.msi" -UseBasicParsing; \ Start-Process "msiexec" -ArgumentList '/i', 'C:\ServiceFabricSDK.msi', '/passive', '/quiet', '/norestart', '/qn' -NoNewWindow -Wait; \ rm "C:\ServiceFabricSDK.msi"

这是输出

$> Get-Command *ServiceFabricCluster* -All

就我而言,我使用 PowerShell 7.x 作为我的默认 PowerShell 版本。显然,ServiceFabric PowerShell 模块仅与该版本部分兼容,因此不会自动加载。一旦我使用 PowerShell 5.x 管理 ServiceFabric,PowerShell 上加载的模块就会启动并准备好使用。