Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find the Connect-ServiceFabricCluster cmdlet when using Powershell

I'm trying to follow this article about deploying a service fabric app through powershell, but I have an issue with running the Connect-ServiceFabricCluster cmdlet. I get the following:

Connect-ServiceFabricCluster : The term 'Connect-ServiceFabricCluster' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:2
+  Connect-ServiceFabricCluster
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-ServiceFabricCluster:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Following other articles on the internet, I've tried importing the following things:

Import-Module "$ENV:ProgramW6432\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1"

Import-Module "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ServiceFabric"

I also saw somewhere to try and set execution policy before importing modules, so I tried this:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser

In the Modules section of the Powershell ISE I see the ServiceFabricSDK module, but I don't see this cmdlet.

How do I get access to these cmdlets?

Thank you for any help.

Current versions:

Running $PSVersionTable.PSVersion, I get

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

Service Fabric SDK is version 2.5.216

like image 912
Kolichikov Avatar asked Apr 11 '17 16:04

Kolichikov


2 Answers

Are you running x86 version of Powershell ISE? I got this error as well but when I switched to the other ISE the cmdlet was available again.

like image 80
CGM Avatar answered Sep 23 '22 14:09

CGM


You should make sure you are running the Windows Powershell as opposed to just Powershell. This made a difference for me.

like image 24
Kurt LP Avatar answered Sep 22 '22 14:09

Kurt LP