Forum Discussion
ahinterl
Aug 22, 2023Copper Contributor
New-ClusterAffinityRule: cmdlet not recognized
Several *-clusteraffinityrule cmdlets are described in MS articles, but I cannot use either of them, PS reports that the respective cmdlet is not recognized. Is there a special module I need to insta...
LainRobertson
Aug 24, 2023Silver Contributor
PS: Windows PowerShell (aka 5.1) is fine.
You don't need PowerShell (aka 7.x) for this at all. In fact, not all shipped modules even work properly with PowerShell.
Cheers,
Lain
ahinterl
Aug 24, 2023Copper Contributor
Hi Lain, this is what I get:
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
[X] Failover Clustering Tools RSAT-Clustering Installed
[X] Failover Cluster Management Tools RSAT-Clustering-Mgmt Installed
[X] Failover Cluster Module for Windows ... RSAT-Clustering-Powe... Installed
[ ] Failover Cluster Automation Server RSAT-Clustering-Auto... Available
[ ] Failover Cluster Command Interface RSAT-Clustering-CmdI... Available
Maybe it's the last item that I'm missing...
But anyway, even if I can get the cmdlet to run directly on the cluster node itself, I wonder how I can make use of it on a remote management machine (I normally do things in Visual Studio Code there)...
- LainRobertsonAug 24, 2023Silver Contributor
Right, so this is all coming together now that I know you were looking to run the commands remotely. Probably my poor attention span, but I didn't spot that in your earlier posts.
Okay, so you can still do things remotely. It just requires some preparation beforehand.
# Create the new session. Note: You may need to exclude -UseSSL if you haven't configured secure WinRM; $Session = New-PSSession -ComputerName rpfile02.robertsonpayne.com -UseSSL; # Load the FailoverClusters module into that remote session prior to importing the session. Invoke-Command -Session $Session -ScriptBlock { Import-Module -Name FailoverClusters }; # Now, import the session. There's various parameters you can use here but I'm going with the simple approach. Import-PSSession -Session $Session;
You can now run New-ClusterAffinityRule and so forth.
Cheers,
Lain