Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232869

Re: Help - Automating the AD-Groups to Roles Assignment for a VM

$
0
0

I assume you have the VM name in variable $vmName, then you could do

$vm = Get-VM -Name $vmName

New-VIPermission -Entity $vm -Principal ("SVR_" + $vmName) -Role $role

You can place those lines in a loop.

That could for example be a loop controlled by the content from a CSV file.

Something like this

Import-Csv C:\vmnames.csv | %{

   $vm = Get-VM -Name $_.vmName

   New-VIPermission -Entity $vm -Principal ("SVR_" + $_.vmName) -Role $_.role

}

This assumes the CSV file would look something like this

"vmName";"role"

"vm1","administrator"

"vm2","read-only"


Viewing all articles
Browse latest Browse all 232869

Trending Articles