Hi CLIers.
In vclouds UI we see there is a button to email all available email addresses in that certain vCloud Org.
Is there some call that can be made from PowerCLI to perform this Action?
Say I want to notify how a whole Org that they have X number of VMs.
Thanks for your help in advance,
-Joel
It appears the email function is not in the API, but the request is fairly easy to do without sending an email through the API.
1. Get all users and vapps in Org.
2. For each of the users, figure out how many VMs they have in vApps they own
3. Send an email.
Here's some code!
$users = Get-CIUser # use -Org "OrgName" if connected to system Org $VApps = Get-CIVApp # use -Org "OrgName" if connected to system Org foreach ($user in $users) { $counter = 0 $ownerVApps = $VApps | where {$_.owner -eq $user} $vapps | ForEach-Object {$counter += $_.extensiondata.children.vm.count} $mailbody = "Greetings, You currently have $counter virtual machines in Organization: $($user.Org)" Send-MailMessage -SmtpServer "mail.example.com" -To $user.email -From "PowerCLI" -Body $mailbody }
It appears the email function is not in the API, but the request is fairly easy to do without sending an email through the API.
1. Get all users and vapps in Org.
2. For each of the users, figure out how many VMs they have in vApps they own
3. Send an email.
Here's some code!
$users = Get-CIUser # use -Org "OrgName" if connected to system Org $VApps = Get-CIVApp # use -Org "OrgName" if connected to system Org foreach ($user in $users) { $counter = 0 $ownerVApps = $VApps | where {$_.owner -eq $user} $vapps | ForEach-Object {$counter += $_.extensiondata.children.vm.count} $mailbody = "Greetings, You currently have $counter virtual machines in Organization: $($user.Org)" Send-MailMessage -SmtpServer "mail.example.com" -To $user.email -From "PowerCLI" -Body $mailbody }