1 Reply Latest reply on Jul 12, 2020 6:11 AM by LucD

    Change note through powercli

    amor123 Enthusiast

      Change note through powercli

       

      current note

      test hostname

      development

      january 2020

       

       

      change note

      test hostname

      infratema

      january 2020

       

      development -> infrateam

      Can I change a word?

        • 1. Re: Change note through powercli
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          You could do something like this

           

          $vmName = 'MYVM'

          Get-VM -Name $vmName | ForEach-Object -Process {

              Set-VM -VM $_ -Notes $_.Notes.Replace('development','infratema') -Confirm:$false

          }

           

          If you want to do this for all VMs, you could do

           

          Get-VM -Name $vmName |

          Where{$_.Notes -match 'development'} |

          ForEach-Object -Process {

              Set-VM -VM $_ -Notes $_.Notes.Replace('development','infratema') -Confirm:$false

          }

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz