Emailing vCloud Organization Users

June 11, 2013

Table of Contents

Due to a lot of requests I found necessary to show you guys who might be having a problem using the “notify users” function in the vCloud Director web UI through the vCloud API. Even though the functionality is not in the API , PowerCLI and Powershell make work easier with the vCloud snap-in and powershell’s send-MailMessage cmdlet.

This example is sending an email to all Org users reminding them of the number of VMs they have in particular organization. The good thing about this code it can be adapted to show; resource usage, IP addresses OS usage. It also has the ability to be used in either a system admin role or an organization admin role:

$mailServer = “mail.example.com”

$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 $mailServer -To $user.email -From “[email protected]” -Body $mailbody

}

Home

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

VMware Fusion 6.0.2 Update Released

VMware have just released a maintainance update (6.0.2) for their Mac based Fusion product. This minor update addresses a number of bug fixes to the recently released Fusion 6.X virtualization

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March