PowerShell script exchange
Post Reply
hyvokar
Veteran
Posts: 406
Liked: 29 times
Joined: Nov 21, 2014 10:05 pm
Contact:

Powershell script to set quota for users

Post by hyvokar »

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: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell script to set quota for users

Post by veremin » 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
Veteran
Posts: 406
Liked: 29 times
Joined: Nov 21, 2014 10:05 pm
Contact:

Re: Powershell script to set quota for users

Post by hyvokar »

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: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell script to set quota for users

Post by veremin »

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: david.domask and 17 guests