Run command going through a file content

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 month, 1 week ago.

  • Author
    Posts
  • #56153
    Profile photo of Bill M
    Bill M
    Participant

    How can I run multiple get-vmreplication for multiple clusters?

    Get-VM –ComputerName(Get-CusterNode (Get-Content C:\Users\a\Desktop\cluster.txt)) | Where-Object { $_.Name -like '*FS*' } | Get-VMReplication | Select Name, State, Health, PrimaryServer

    I want to check the hyper-v replica status of VMs from multiple clusters.
    The txt file looks like this:
    Pxxclus4
    Pxxc1
    Lfdcl1

  • #56180
    Profile photo of Don Jones
    Don Jones
    Keymaster
    Get-Content | 
    ForEach-Object {
      # The $_ placeholder will represent one line at a time from the text file
    }
    

    Something like that?

You must be logged in to reply to this topic.