VMware Cloud Community
amor123
Enthusiast
Enthusiast

Change note through powercli

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?

Tags (1)
Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

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: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos