search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Virtual Machine Manager, Windows Powershell | No Comment | 2,616 views | 19/02/2014 17:05

You can grant user roles into Virtual Machines for AppController with following script:

1
2
3
4
5
6
7
8
9
$VMs = Get-VM
foreach ($VM in $VMs)
{
	$UserRole = $VM.UserRole.Name
	$UserRole = Get-SCUserRole -Name "$UserRole"
	$UserRoleID = $UserRole.ID.Guid
	$UserName = $VM.Owner
	Grant-SCResource -Resource $VM -UserName $UserName -UserRoleID @("$UserRoleID")
}

That will apply VM’s owner and UserRole as a granted user role.


Posted in Virtual Machine Manager, Windows Powershell | No Comment | 1,794 views | 17/06/2009 10:53

Checking System Center Virtual Machine Manager (SCVMM) User Role before creating would be better. Nobody wants to get errors when deploying virtual machines.  Checking SCVMM user role is so simple:

1
2
3
4
5
6
7
8
9
10
$UserRole = "blabla"
$checkvmmuser = Get-VMMUserRole $UserRole
if ($checkvmmuser.Profile -eq "SelfServiceUser")
{
Write-Host "That User Role already exist."
}
else
{
.\createvmmuser.ps1 "FirstName" "LastName" "SamID"
}

I don’t know any other way to check SCVMM User Role. But this is the best so far.