Monday, September 11, 2017

PowerCLI script to rename Virtual machines from a CSV file

PowerCLI script to rename Virtual machines from a CSV file

$csv=Import-CSV rename.csv 

 foreach($vm in $csv)
{
Get-VM $($vm.oldname) |   Set-VM -name $($vm.newname) -confirm:$false

}

Rename.csv

oldname,newname
Win2008,WIN2008
winvm-test1,WINVM-TEST1
winvm-test2,WINVM-TEST2
winvm-test4,WINVM-TEST4

Output:

NamePowerStateNum CPUsMemoryGB
------------------------------
WIN2008PoweredOff12
WINVM-TEST1PoweredOff12
WINVM-TEST2PoweredOff12
WINVM-TEST4PoweredOff12

1 comment:

  1. Alternately, play the buy-a-pay to wager more money in return for more chances of profitable somewhat than profitable a larger amount of money. You can even play video games and take advantage of|benefit from|reap the advantages of} bonus rounds and regular special events to attempt to win. When you play video games, wager more to cover 카지노사이트 more profitable potentialities, since these games work like buy-a-pay slots.

    ReplyDelete