VMware Cloud Community
Tutti21
Contributor
Contributor
Jump to solution

export and import permission between 2 vcenter

Hello,

because a update killed our vcetner vmware suggested we build a new one.

I have already importet the roles + permission to that role

how can I Export and Import the permission of a of all roles on all objects e.g datacenters and folders.

will be nice if there is an easy way.

by tutti

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That depends what you have in the Propagate column in the CSV.

You could try with

Propagate = [Boolean]$row.Propagate


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
23 Replies
Tutti21
Contributor
Contributor
Jump to solution

 powershell cant recognize export-excel

seem like I cant do it with Excel Export is it possible to do it with Standard thinks where I dont Need to download Moduls

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Sure, you can use Export-Csv to two separate CSV files.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

ok now I have to files how do I Import this to the new vcenter?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The import part is also in that thread


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

but I have now 2 files and not 1 csv, can I just do 1 file and then run again with the other?

I did run them and I get "new-VIPermission: System.String cant convert to System Boolean"

is it because the csv dont have worksheet names?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can have 2 different types of objects in the same CSV.
So it is either 2 CSV files or work with the Worksheets


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

I get this

 

New-VIPermission : "System.String" can not be converted to "System.Boolean", for the Parameter "Propagate" is needed.
In Z:\Vmware\script\import vcenter.ps1:12 Zeichen:22
+     New-Vipermission @Sperm
+                      ~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VIPermission], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.PermissionManagement.NewVIPermission
 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That depends what you have in the Propagate column in the CSV.

You could try with

Propagate = [Boolean]$row.Propagate


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

Ok thanks that worked and because I already had the roles in there I only need 1 csv

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

Hello Lucd it seems not all permissions where set I got some lines with

 

New-VIPermission : the argumentiontransformation for the parameter "Entity" could not be processed. This parameter no longer accepts an array. As an
alternative you may pass multiple values by pipeline (if supported by the parameter).

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That could mean that you have entities (VM, Folders...) with the same name in the target vCenter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

yeah in the Import file I have 10 with the exact same lines with "UserXXX","admin","true","Test"","Folder"

so the script doesn't knwo the exact location of the folders.Can you help me to change this or is that not possible?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, that is possible when you use the full path in the export.
As I mentioned in Export / Import folder permissions - VMware Technology Network VMTN you can combine the export with the Get-FolderPath function.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

I only get VIobject is empty on the Folder script. I not really good with powershell can you help me merge the Folder and permission script to the Import and Export script?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could give this one a try: Copy Folders Permissions and Roles from vCenter - Bluewire


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

ok so I get a error that I have multible Datacenter in the vcenter  but I only named  one under "datacenter"

 

then in the import script it tells me something with switches what I dont know what to do

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Is that with that script I pointed to?
Which errors exactly?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Tutti21
Contributor
Contributor
Jump to solution

yeah in the script first 2 line it says no multible datacenter and it seems that it will still to all datacenter but cant keep up with it

 

on the import script I need to use -permissions  yeah guess what I need to state the datacenter too now too and then it did merge our 4 datacenter is this one and rearanged the folder but I only did the -permissions and  not -folder

so I gues I will do the handjob now move it back and make the permission that are missing too.

 

still thanks for you help

0 Kudos