@MGreen This is the error I getting. At first I thought it was just Server 2008 R2 machines but it is happening on a few Windows Server 2012 R2 as well. The strange thing is out of 69 servers of various OS levels, it fails on 12 with the below message or an error about The 'get-vm' command was found in the module 'HyperV', but the module
could not be loaded.
You must provide a value expression on the right-hand side of the '-' operator.
At line:1 char:31
+ & {$a = get-vm|? {($_.State - <<<< in "Saved","Off" -and $_.AutomaticStartAc
tion -ne "Nothing") -and ($_.ReplicationState -eq "Disabled" -or ($_.Name -in (
Get-VMReplication|?{$_.PrimaryServer -eq ([System.Net.Dns]::GetHostByName($env:
computerName).HostName)}).VMName))}; if ($a){$a|% {if ((gci (Get-VMHardDiskDriv
e -VMName $_.Name -ControllerLocation 0).Path).LastWriteTime -gt (Get-Date).Add
Days(-2)){Start-VM $_} }}else {Write-Host "No issues detected."} }
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : ExpectedValueExpression