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

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


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.


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


First, I would set your policy to bypass. This can't be done from the script itself, because, well, that's what needs to run with this policy. You could look into setting your powershell ise profile to do this for you.

Set-ExecutionPolicy Bypass

To your question. Not all modules can use the Import-Module feature. For instance, modules from the technet.microsoft.com site must sometimes be manually installed and unzipped. I'm including a script I use below to do this automatically.

    #https://www.petri.com/manage-windows-updates-with-powershell-module\    $url = "https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/file/41459/47/PSWindowsUpdate.zip"    $module = "PSWindowsUpdate"    $zipped = "$($PSScriptRoot)\$($module).zip"    $unzipped = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules"    #$unzipped = "$PSScriptRoot\$($module)"    if (Get-Module -Name $($module)) {           Write-Host "Module exists $($module)"        } else {           Write-Host "Getting Module $($module)"    if(!(Test-Path $zipped)){        (New-Object System.Net.WebClient).DownloadFile($url, $zipped)        if($?){Write-Output "Downloaded zip $($zipped)"}    }else{        Write-Output "Zip found $($zipped)"    }    if(!(test-path "$($unzipped)\$($module)")){    Add-Type -assembly “system.io.compression.filesystem”    [io.compression.zipfile]::ExtractToDirectory($zipped, $unzipped)    if($?){Write-Output "Unzipped to $($unzipped)"}}    Unblock-File -Path "$($unzipped)\$($module)" -Confirm    if($?){Write-Output "Unblocked file $($unzipped)"}    Import-Module $unzipped\*\$($module).psd1 -Verbose    if($?){Write-Output "Imported module $($unzipped)"}        }