VMware Cloud Community
Math34
Contributor
Contributor

Manage Folder in Home - Inventory - Networking

Hi all,

I try to work with Network Folder and PowerCli without success

7558_7558.JPG

How I can script Folder creation and Move VM Port Group in target folder like below ?

7560_7560.JPG

Thanks in advance

FYI, When I try to select Network Folder in Datacenter Shell say "Folder with name 'Network' not found, using the specified filter(s)."

Code:

$dcName = $args[0]

$dc = Get-Datacenter -Name $dcName

$parent = Get-Folder "Network"

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

The Get-Folder cmdlet in the current build doesn't look in the Network folder.

To be able to use New-Folder on the Network folder you have to use a little trick

$dc = Get-Datacenter <datacenter-name> | Get-View
$netFolder = Get-View -Id $dc.NetworkFolder
$nf = Get-VIObjectByVIView -MORef $netFolder.MoRef
New-Folder -Name "Test" -Location $nf


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

Reply
0 Kudos