PowerShell script exchange
Post Reply
hyvokar
Expert
Posts: 356
Liked: 23 times
Joined: Nov 21, 2014 10:05 pm
Contact:

Powershell script to set quota for users

Post by hyvokar » Sep 28, 2015 10:55 am

Hi!

Is it possible to alter quotas with powershell? I would need to set quotas automatically via script.
Bed?! Beds for sleepy people! Lets get a kebab and go to a disco!
MS MCSA, MCITP, MCTS, MCP
VMWare VCP5-DCV
Veeam VMCE

veremin
Product Manager
Posts: 16669
Liked: 1391 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell script to set quota for users

Post by veremin » Sep 28, 2015 2:18 pm 1 person likes this post

Sure, it is.

Code: Select all

$Tenant = Get-VBRCloudTenant -Name "Name of user"
$Resources = $Tenant.Resources[0]
$NewQuota = Set-VBRCloudTenantResource -CloudTenantResource $Resources -Quota "New value in GB"
Set-VBRCloudTenant -CloudTenant $Tenant -Resources $NewQuota
Thanks.

hyvokar
Expert
Posts: 356
Liked: 23 times
Joined: Nov 21, 2014 10:05 pm
Contact:

Re: Powershell script to set quota for users

Post by hyvokar » Sep 29, 2015 3:50 am

Thanks! :)
Bed?! Beds for sleepy people! Lets get a kebab and go to a disco!
MS MCSA, MCITP, MCTS, MCP
VMWare VCP5-DCV
Veeam VMCE

veremin
Product Manager
Posts: 16669
Liked: 1391 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell script to set quota for users

Post by veremin » Sep 29, 2015 10:32 am

You're welcome.

By the way, $Tenant.Resources returns array of quotas assigned to a given tenant. That's why I've used [0] to select the first quota.

If a tenant happens to have multiple quotas given to him, you should play with number in bracket to select the appropriate quota. (enumeration starts from zero, [0], [1], etc.)

Thanks.

Post Reply

Who is online

Users browsing this forum: tom_nl and 7 guests