VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 Replies Last post: Nov 6, 2009 11:37 AM by LucD  

Manage Folder in Home - Inventory - Networking posted: Nov 6, 2009 7:08 AM

Click to view Math34's profile Lurker 1 posts since
Oct 13, 2009
Hi all,

I try to work with Network Folder and PowerCli without success http://communities.vmware.com/images/emoticons/confused.gif


http://communities.vmware.com/servlet/JiveServlet/downloadImage/7558/VMW01.JPG


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


http://communities.vmware.com/servlet/JiveServlet/downloadImage/7560/VMW02.JPG


Thanks in advance http://communities.vmware.com/images/emoticons/grin.gif


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"

Re: Manage Folder in Home - Inventory - Networking

1. Nov 6, 2009 11:37 AM in response to: Math34
Click to view LucD's profile Champion 2,445 posts since
Oct 31, 2005
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

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities