I have a powershell script that I'm attempting to execute over SSH. The command works perfectly when I run it from the server's powershell commandline.
Here is my Powershell script:
ImportSystemModules
$vms = Get-ClusterResource | Where-Object{$_.ResourceType -like "Virtual Machine"}
foreach ($vm in $vms)
{
if ($vm -eq "Virtual Machine server-name")
{
Echo "Stop $vm"
Stop-ClusterGroup $vm.OwnerGroup
}
}
Here is the command that I am executing:
C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -file "C:\Scripts\VMShutDown.ps1"
However, when I run this from a remote machine (Ubuntu 12.04). I get the following error:
Get-ClusterResource : The term 'Get-ClusterResource' 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.
Any thoughts to what I might be doing wrong?
Operating Systems:
Windows Server 2012 Standard - 64 Bit Operating System
Ubuntu 12.04.4 LTS