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.

PowerShell your world cup

PowerShell This is something that is very exciting and if you are interested you should try it. I found the post and tried it. Here is a function and how

🎉 New Year’s Special🎉
50% OFF for Life!

🔥 DELL Bare-metal Dedicated Server in New York & Amsterdam

💻 Server Highlights:

🔹 Powerful Compute: Dual Intel Xeon Gold (80 Cores, Hyper-Threading)
🔹 Massive Storage: 23TB SSD Flash + 1TB NVMe Boot (HW RAID)
🔹 1TB DDR4 RAM (2666MHz) for Ultimate Multitasking
🔹 10Gbps Redundant Uplinks for Ultra-Fast Connectivity
🔹 10 IPv4 + IPv6 Addresses Included 

💲 Just $699/month – 50% OFF FOR LIFE! (Reg $1399/month)
🚀 Zero Setup Costs | Flexible OS: Ubuntu, Proxmox, ESXi, Windows, etc.

✅ Reserve Risk-Free! 30-Day Money-Back Guarantee
💡 100% Uptime Assurance – Enterprise-Grade Hardware 

🖥 Ideal for Virtualization, Data-Intensive Apps, & High Traffic Sites

Use coupon code at checkout for the discount to apply FBHEO3023EJFB
⚡ Limited Availability – Don’t Miss Out!

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