Align VMs with Storage - Storage Spaces Direct

 Align-VMsWithStorage.ps1 is a script that can be used to align your VMs with your Cluster Shared Volumes. With Storage Spaces Direct all writes are routed through the owner of the CSV which can cause ineffiecient IO paths.  This script makes sure your VM is running on the sam

 
 
 
 
 
(0)
245 times
Add to favorites
Servers
1/17/2019
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Error MethodNotFound
    4 Posts | Last post January 17, 2019
    • Hi Darryl,
      
      Thanks for sharing this script. We certainly want to use this.
      I've tried the script in our test environment, unfortunately with some errors. 
      After these errors, the migration runs as expected.
      Can you help me with these errors?
      
      
      Method invocation failed because [Microsoft.HyperV.PowerShell.VirtualMachine] does not contain a method named 'op_Addition'.
      At C:\No_Backup\HCI Installation Scripts DELL R740\testing\Align-VMsWithStorage.ps1:128 char:13
      +             $VMs += Get-VM -ComputerName $clusternode
      +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound
      
      Method invocation failed because [Microsoft.HyperV.PowerShell.VirtualMachine] does not contain a method named 'op_Addition'.
      At C:\No_Backup\HCI Installation Scripts DELL R740\testing\Align-VMsWithStorage.ps1:128 char:13
      +             $VMs += Get-VM -ComputerName $clusternode
      +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound
      
      Method invocation failed because [Microsoft.HyperV.PowerShell.VirtualMachine] does not contain a method named 'op_Addition'.
      At C:\No_Backup\HCI Installation Scripts DELL R740\testing\Align-VMsWithStorage.ps1:128 char:13
      +             $VMs += Get-VM -ComputerName $clusternode
      +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound
      	
      	Found 1 VM(s) to be optimized.
      Confirm
      Are you sure you want to perform this action?
      Performing the operation "Migrating to YYYYYY using live migration" on target "XXXXXX".
      [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
      
    • Hi Jiri,
      
      I think this has to do with the $VMs variable already used in your powershell session. Anyway, I changed the code which should help mitigate the issue. Try it out! :)
    • Hi Darryl,
      
      Thanks for modifying so quick :-)
      Errors are gone now, but there is also no VM found to be optimized:
      Found 0 VM(s) to be optimized.
      
      When I run your old script (0.9.2) it gives back 
      Found 1 VM(s) to be optimized.
      
      Can you take a look? 
      Thanks, Jiri
    • Nothing has changed on that part, so probably the VM has moved to the right owner. Let's talk on Slack if you have more questions/issues.