Automation

 View Only
  • 1.  Change note through powercli

    Posted Jul 12, 2020 12:17 PM

    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?



  • 2.  RE: Change note through powercli

    Posted Jul 12, 2020 01:11 PM

    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

    }