This is a simple way of adding memory to a powered-on vm, which has the Memory hot plug option enabled. It reads the server names from a file (deploy.csv) and updates the memory to what is specified in the script.
First the deploy.csv file
Actual script, MemoryMB needs to be updated
#Connect to vcenter server
#Import vm name and ip from file
Import-Csv deploy.csv |
$strNewVMName = $_.name
write-host "Server ----- $strNewVMName"
#MemoryMB needs to change
Set-VM -VM $strNewVMName -MemoryMB 6144
Get-VM -name $strNewVMName | Select Name, MemoryGB
$Report += $strNewVMName
write-host "Sleeping ..."
#Send out an email with the names
$emailFrom = "<from email id>"
$emailTo = "<to email id>"
$subject = "List of servers with upgraded memory"
$smtpServer ="<smtp server name>"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject