Posted in
Virtual Machine Manager,
Windows Powershell,
Windows Server |
No Comment | 2,456 views | 26/07/2013 15:56
You can set User Role Quota for each Cloud Profile in SCVMM 2012 SP1.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| $UserRoles = "BackOffice","CallCenter","ExchangeTeam"
foreach ($UserRole in $UserRoles)
{
$UserRole = Get-SCUserRole $UserRole
$Clouds = "DMZ Cloud","Prod Cloud","Test Cloud"
foreach ($Cloud in $Clouds)
{
$MyCloud = Get-SCCloud $Cloud
$CPUCount = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole" | Measure-Object -Property CPUCount -Sum).Sum
$Memory = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole" | Measure-Object -Property Memory -Sum).Sum
$VMCount = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole").Count
[int]$NewCPUCount = [int]$CPUCount + 40;
[int]$NewMemory = [int]$Memory + 81920;
[int]$NewVMCount = [int]$VMCount + 10;
Get-SCUserRoleQuota -UserRole $UserRole -Cloud $MyCloud | Set-SCUserRoleQuota -CPUCount $NewCPUCount -MemoryMB $NewMemory -VMCount $NewVMCount
}
} |
$UserRoles = "BackOffice","CallCenter","ExchangeTeam"
foreach ($UserRole in $UserRoles)
{
$UserRole = Get-SCUserRole $UserRole
$Clouds = "DMZ Cloud","Prod Cloud","Test Cloud"
foreach ($Cloud in $Clouds)
{
$MyCloud = Get-SCCloud $Cloud
$CPUCount = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole" | Measure-Object -Property CPUCount -Sum).Sum
$Memory = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole" | Measure-Object -Property Memory -Sum).Sum
$VMCount = (Get-VM -Cloud $MyCloud | Where UserRole -like "$UserRole").Count
[int]$NewCPUCount = [int]$CPUCount + 40;
[int]$NewMemory = [int]$Memory + 81920;
[int]$NewVMCount = [int]$VMCount + 10;
Get-SCUserRoleQuota -UserRole $UserRole -Cloud $MyCloud | Set-SCUserRoleQuota -CPUCount $NewCPUCount -MemoryMB $NewMemory -VMCount $NewVMCount
}
}
That will set on all profiles on $UserRoles array.