2 Replies Latest reply on Mar 13, 2018 6:09 AM by sck1025

    Script to show Powered Off VM along with Tag

    sck1025 Novice

      Can anybody help me out? 

       

      I need script that will show me what tag is assigned to a machine but only on machines that are powered off.

       

      So far I have:

      Get-VM |

       

      Select-Object Name, 

      @{N = 'Tags'; E = {(Get-TagAssignment -Entity $_).Tag -join '|'}} |

      Export-Csv c:\PoweredOffTag.csv

       

      This brings back the tags for all machines I am not sure where to place the "And" so that it queries just powered off VM's.

       

      TIA.