Jump to content

marmfield

Members
  • Posts

    7
  • Joined

  • Last visited

My Information

  • Location
    St. Louis, Missouri
  • Agent Count
    4000 - 6000 Agents

marmfield's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I get the same error on the host itself. We have about 68 HyperV hosts and only 14 get this error. I'll keep plugging away at it to see if I can figure out why the error, unless it is related to the fact that these HyperV hosts don't have any VMs on it and that would be the reason for the null value. Is there a way to check for this? I really need to learn Powershell so I don't have to ask all these questions! M
  2. @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
  3. Thank you for this information! @MGreen How do I modify this to not generate a failure on a server that has the Hyper-V role installed but isn't hosting any VMs? I know that best practice would be to remove the Hyper-V role but that isn't always an option for some of our clients. Thank you in advance, Matt
×
×
  • Create New...