Addition of new VirtualPortGroup in a folder.

Hello.

I'm trying to figure out if there is a way to create a new virtualportgroup and then add it to a folder under network in a scritp/oneliner.

Today, I use this to add exchanges:

Get-Cluster "your Cluster | Get-VMHost | Get-VirtualSwitch-name "vSwitch0" '

| New-VirtualPortGroup-name ' new VLAN ' VLanId - 123

For security reasons, we set the permissions on the folders for different groups of users

But now I have manually need to move the new portgroup to the right folder, it forge be nice to be able to do this in the script.

We run ESX4.0 u1

Christian

This is possible, but you need to use the SDK method because the Move-File cmdlet does not yet support the folder 'network '.

This is an example of script

$pgName = 'MyPG2'                          # Name of the new portgroup
$esxName = 'esx41.test.local'          # ESX host where the new portgroup is created
$tgtFolder = 'MyNet'                          # Child folder in the network folder

$esxImpl = Get-VMHost $esxName

# Create portgroup
$pgImpl = $esxImpl | Get-VirtualSwitch -Name 'vSwitch1' | New-VirtualPortGroup -Name $pgName  -VLanId 777

# Get network folder
$esx = $esxImpl | Get-View
$dc = Get-Datacenter -VMHost $esxImpl | Get-View
$netFolder = Get-View $dc.NetworkFolder

# Find portgroup
$netFolder.ChildEntity | where {$_.Type -eq 'Network'} | %{
     $child = Get-View $_
     if($child.Name -eq $pgName){
          $pgMoRef = $child.MoRef
     }
}

# Move portgroup into folder
$netFolder.ChildEntity | where {$_.Type -eq 'Folder'} | %{
     $child = Get-View $_
     if($child.Name -eq $tgtFolder){
          $child.MoveIntoFolder($pgMoRef)
     }
}

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • Records show new messages, but there is no new messages in the folder

    I have used filters to set up the folder called application, which I used for several months now, all of a sudden I have a problem with one of this file see the new messages, but there is no new messages in the folder. I checked with my email providers email based web browsers to see if new emails have came that should go into the folder named application and none has to go into the folder of file titled application. Any ideas on what is causing this problem and how to fix it?

    Good. You can then mark the thread as "Solved" Please?
    Thank you.

  • Error: failed to create or save new files in the folder where it was downloaded during the upgrade from Windows Vista to Windows 7

    Original title:

    Attempt to upgrade Windows Vista to Windows 7

    I try to update my Windows Vista to Windows 7. I bought to download the rom update the Microsoft store and downloaded, but when I try to start the upgrade I have a stateing message that it is impossible to create or save new files in the folder where it was downloaded. I checked the security permissions in the file and made sure that no programs are 'read only', but it won't always go beyond this point!

    Hello

    What is the edition of Windows Vista installed on the computer?
    Make sure that you upgrade to the correct version, some versions of Windows cannot be upgraded with the installation disc you are trying to use. For example, you cannot upgrade a 32-bit version of Windows to a 64-bit version, or upgrade a higher edition of Windows like Windows Vista Ultimate Edition, to a lower edition, such as Windows 7 Edition Home Premium. If this is the case, you will need to use the custom during installation option.
    Before you attempt to upgrade, please run the Windows 7 upgrade Advisor:
    http://Windows.Microsoft.com/en-us/Windows/downloads/Upgrade-Advisor
    Also, check if your computer is compatible for Windows 7, using the Compatibility Center:
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx
    To learn more about the upgrade process, please visit the link below:
    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-Vista-to-Windows-7
    I hope that helps!
  • foreach new-virtualportgroup

    I am creating a virtualswitch and exchanges for several hosts, but when I try this below, I only get the vswitches created on the host computers.

    I do however find first created so Exchange hosts but not the other hosts

    any idea?

    SE connect-VIServer vc

    $hostarray = @("host1","host2","host3")

    {foreach ($vmhost to $hostarray)

    New-VirtualSwitch - VMHost $vmhost - name vSwitch4

    New-VirtualPortGroup - vSwitch4-name - VLanId 10 - vlan10 VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan15 - VLanId 15 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan17 - VLanId 17 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan20 - VLanId 20 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name - VLanId 30 - vlan30 VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan40 - VLanId 40 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan50 - VLanId 50 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSWitch4-name vlan60 - VLanId 60 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan160 - VLanId 160 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSwitch4-name vlan162 - VLanId 162 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - vSWitch4-name vlan220 - VLanId 220 - VirtualSwitch confirm: $false

    }

    Not in front of a PC with access to test at the moment, but from memory, you need to pass a vSwitch object to New-VirtualPortGroup. So, something like this:

    SE connect-VIServer vc

    $hostarray = @("host1","host2","host3")

    {foreach ($vmhost to $hostarray)

    $vSwitch = New VirtualSwitch - VMHost $vmhost - name vSwitch4

    New-VirtualPortGroup - $vSwitch - name - VLanId 10 - vlan10 VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan15 - VLanId 15 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan17 - VLanId 17 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan20 - VLanId 20 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name - VLanId 30 - vlan30 VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan40 - VLanId 40 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - vlan50 - VLanId 50 - name VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - vlan60 - VLanId 60 - name VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan160 - VLanId 160 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan162 - VLanId 162 - VirtualSwitch confirm: $false

    New-VirtualPortGroup - $vSwitch - name vlan220 - VLanId 220 - VirtualSwitch confirm: $false

    }

  • Add a new column to the folder in the administrator of Discoverer9i

    Hello

    We use Discoverer9i administrator. Initially, we have created a view and add this point of view in Discoverer Administrator. After somtime, we added two new columns in the view, but these new columns are not reflective in Discoverer Administrator.

    I would like to know how we can add these two column in discoverer in the same folder without delete and recreate the folder.

    Kind regards

    Hassan

    Hello

    Login in as discoverer administrator, right-click on the folder and select Refresh. This should prompt then allows you to add new columns to the folder.

    Rod West

  • Addition of new LUT´s / Can´t find the LUMETRI folder.

    Hello!

    Sorry for my bad English.

    I want to add LUT´s to the creative Panel again.

    I have several LUT´s different a lot and I don't want to go through... every time.

    I really want to use this "Preview" window


    I Don t even find Lumetri folder.

    He has only one record of Configuration and presets.


    I m very happy if you understand what I want to and can help me.

    Greetings from Finland.

    mailto:[email protected]

    Screen Shot 2015-07-02 at 01.55.43.png

    Hi Frank,.

    Check out this post: addition of LUT Lumetri color? Adobe Community

    Thank you

    Kevin

  • Add the new entry name of folder of bookmarks does not

    (There's a reason I'm fool the previous thread on this subject, as well as my response to this: I couldn't find a way to add FireFox 10.0.2 to the tags of the thread.) If the thread tags may be edited/added, I wouldn't highlight problems with FireFox 10.0.2 by launching this new thread.)
    RE add new bookmarks folder, can not enter the name of the new folder:

    I am now having this problem with FireFox 10.0.2, 11/03/2012

    When I click on add a folder, a new folder appears in the tree view and the folder name field is highlighted for the entry. But when I start to type characters in the field, I can only type 1 or 2 characters at the most seized stops accept input. I then go to the bookmarks menu, locate the new folder, right-click it, click Properties and complete the registration of the name of the folder.

    At worst, the folder name field will cease to accept entry as soon as I type the first tank, in which case the name of the folder will remain as "new folder." I find the new folder in the bookmarks menu to change the name, as described above.

    It is very annoying because it adds a number of additional steps just to add a new folder in the bookmarks menu. Add the new folder through the "Show all bookmarks" and navigate through the folder hierarchy are an alternative workaround, but that records all the steps.

    Any ideas or solutions?

    Hi John99,
    It has worked well in Mode without failure. Thanks for the suggestion!

    I'm going offline a bit to understand what add-on, plugin, etc., could be causing it. In the meantime, I have marked your suggestion to use Mode safe as useful so that anyone else coming here could get the clue.

    I should probably drop another line in the thread for the guy who in (or has been) using FireFox 7...

    I'll post my results if I can understand it.

    UPDATE:

    I went after any add-on which had nothing to do with bookmarks.

    It was the first add-on I tried, SortPlaces 1.9.1 that automatically sorts bookmarks in various ways according to the parameters. When I disabled it, the problem disappeared.

    I re-enabled it and checked the options to see if I could understand why she was stop to add the new folder. In the 'Options' tab, there is a time limit for how long interval SortPlaces will wait before you sort a bookmark changed or added. It was set to 3 seconds.

    It is not long enough for old men by typing the new name of folder. I put it in 10 seconds. Then, I created a new folder of bookmarks and start typing a name long nonsense, while I looked at the clock. After that 10 seconds it stopped accepting the entrance, right on the mark. What this hidden for me earlier, it was that when he stops to accept input, you don't see the new folder to place in the position of sorting on the menu add a folder. You will see that if you expand the folder later. It's probably why I didn't connect the two.

    Anyway, problem solved. I'm leaving the delay to 10 seconds. If I ever need to be longer, I'll just increase it.

    Thanks again for the suggestion of Mode safe and enjoy the next season of mud.

    Alan Mintaka

  • Try to install XP SP3, says the installation program requires additional 1 MB in the specific folder

    I installed all the updates and now it ended on the sp3 update, it says configuration required additional 1 MB in this folder, I have 52 GB windows 39 GB is free I fragmented my disk cleaned undesirable twice manually downloaded sp3 of chosen installation one of the driver for the desarchives installation file, but the error is still there as the cockroaches on earth would survive. I did all the possible things like undesirable fragmentation of the disk fragmentation registry cleaning now tell me something new that I can solve my headache.
    And I read all the prerequisites for installing SP3 I uninstalled my Avira and only tried too. Please don't just before me a good link kindly help me specifically
    Here cut my update of the register newspaper
    187.062: Service Pack 3 Setup has encountered an error: the update.ver file is not correct.
    185.843: there is not enough disk space on C:\WINDOWS\$NtServicePackUninstall$ to install Service Pack 3. The Setup program requires a minimum of 1 megabytes of free space or if you also want to archive the uninstall files, Setup requires 1 megabyte of free space. Extra free space on your hard drive and try again.
    181.687: drive C: free 40393MB req: 398 MB w/uninstall 827 MB
    181.687: share \\?\globalroot\: free 0MB req: 1 MB w/uninstall 1 MB
    181.687: DoInstallation:AnalyzeDiskUsage failed

    Hello

    Thanks for your help, Kim. But I guess I won't find the answer in this thread. Also for your future responses to this problem I found a solution.
    If you open your registry database and open the tab of the local machine and in current software > windows you can see that when the Service Pack is installed on windows by default sets "Spcache" in the directory of the CD-ROM so that you will not be able to install unless if you have a RW in your ROM. Or the simple solution to change its value from CD-ROM drive allows, assume that "C:\". "drive"N:\ ". "to your windows.

    Nice day

  • Class not found exception after adding a new image in the folder resources.

    The app works perfectly well on the Simulator and the device. After adding a new set of images, he began to show in every race, on the Simulator and the device, a class not found exception.

    When you try to delete some images to find the cause, I get different classes not found when executing. Compilation and packaging the application generate warning or error. They even get signed. Some of the classes are not exception I get:

    Java.lang.StringBuilder

    NET. RIM. Device.API.UI.UIApplication

    I'm guessing this has something to do with the size of the total image, since the size of each range image from 100 KB to 300 KB, and we talk about only 25 or 30 images in total. Adding image outside of the 'res' folder does not generate the error, but the image is not added to the final files.

    In addition, this application is not large, but when compiling and packaging of the app, it generates and signs 125 cod files. Is this normal?

    I use Eclipse 3.6 (Helios) and BB SDK 5.0.0.25 won win 7

    Any help will be appreciated. Thank you.

    Have you seen this?

    http://supportforums.BlackBerry.com/T5/testing-and-deployment/the-maximum-size-of-a-BlackBerry-smart...

    I would recommend that you download these kinds of resources and put them on the SD card if you take a storage capacity that users will want to keep available for email and others.

  • New Firefox doesn't let me make a new bookmark in a folder.

    Previously with Firefox I could drop a new bookmark directly into a new or existing folder. How can I do with the new Firefox? (without having to save it and then move it later, I don't see how to do anyway) And how do I organize and edit bookmarks and folders with new Firefox? It was so easy before with Firefox. It is a major step backward in the coldness of the user.

    The star that lights up blue when you're on a bookmark page acts like the old star in the address bar which yellowed on a bookmark page. You would have not used this one.

    I'm not aware of a way to change the behavior of this button.

    To display a dialog box add a bookmark that is by default in the Menu bookmark, you can use either:

    • CTRL + d
    • Right click on the page > bookmark this Page
    • (classic menu bar) Bookmarks > bookmark this Page
  • How free new subfolder to another folder, to which he has been mysteriously subordinated to creation?

    Problem is explicit.

    After creating a new storage folder it was - for some strange reason - placed under an existing folder in the file storage group...

    Hello

    Thanks for the post.

    Your message has not enough information to help you with the problem. Please answer the following questions, which help us to help you in the right direction.

    1. what version of Windows operating system do you use?

    2. which antivirus app do you use?

    3. don't you make changes to the computer before this problem?

    Suggestions for a question on the help forums

    http://support.Microsoft.com/kb/555375

    Send us more information to help you better, we will be happy to help you!

  • Windows 7 - upgrade Setup error we are unable to create or save new files in the folder in which this application was downloaded

    I just bought the Windows 7 Home Premium upgrade from the downloaded Microsoft store the installation files. I am currently on Windows XP 32-bit, and try to install Windows 7 Home Premium 64-bit.

    Now, whenever I try to run the executable from Windows 7, I get this error message:
    Now, I tried to make the folder I downloaded files is NOT unalterable, but every time I try to do it right, he returns to read-only. I can do all the files Windows 7 installation not in read-only, but the folder remains read-only. I moved the installation files in different locations, only to get the same results.
    Yes, I'm on an administrator account and I still have this problem.

    Hello

    32-bit to 64-bit is not a supported upgrade path. You must do a clean installation of 64-bit.

    In addition, upgrade is not possible from XP to Win7. It will be a custom installation.

    As a first step I suggest you back up the data before you do a custom installation. Check the link for more information.

    http://support.Microsoft.com/kb/320820

    Also check the following links:

    Upgrade Windows XP to Windows 7

    http://Windows.Microsoft.com/en-AU/Windows7/help/upgrading-from-Windows-XP-to-Windows-7
    http://Windows.Microsoft.com/upgrade
    http://TechNet.Microsoft.com/en-us/library/dd772579 (WS.10) .aspx

    I hope this helps.

  • New video + no Album folder name

    If I load 10 albums in my new Clip Plus, only about 3 appear after updating. The rest of the songs are in the Clip + but not under the name of the album. Just a list of names of the song.

    I use MSC, I drag-and - drop using windows Explorer. I used the older Clip for 9 months without problems now load / unload albums.

    I really want to navigate to an album by name.

    All photos are live concerts of bands friendly shopping. Downloaded as .flacs, converted to mp3 VBR VO using LAME in Traders Little Helper. Each concert is located in a folder such album that-->

    1977, 05 / 05 New Haven

    Albums appear on the player if the tags are in the songs. The titles of the songs are the title tag. The songs are properly labelled? If this isn't the case, you could use a free program like mp3Tag to edit tags.

    The Clip + also navigates by folders instead of tags. To do this, choose the music, records.

  • Import questions with 6.2.1 new update - incorrect destination folder

    Hello

    Since the upgrade to the new 6.2.1 update I could not import successfully of the images in the correct destination folder. Before, I was able to import the photos and they would go in a directory with the same name and location as my Windows Explorer, but now it seems to be entering a high plu main folder rather than the appropriate subfolder.

    Oddly, some of these pictures will not go into an appropriate folder and still says "already imported" and they are in a different location.

    Does anyone else have this problem and how can I solve it?

    Hannah

    Need to re - write:

    Since 6.2, the new import dialog does not import duplicates.

    You can rename the files, or you can roll back: http://www.lightroomqueen.com/how-do-i-roll-back-to-lightroom-2015-1-1-or-lightroom-6-1-1/

    You can also add your vote here: http://feedback.photoshop.com/photoshop_family/topics/new-update-6-2

  • Multipathing - addition of new paths

    I have multiple ESX 3.5 servers, all connected to a San.  The problem, it's when the SAN was originally installed, it was done with 1 single path controller, so each LUN has today only 2 channels per server, instead of 4 favorite.  I ran the wiring for my 2 additional paths and just set up the zoning - my question: is there something special I have to do for my servers ESX automatically pick up 2 new paths, and will be they will adjust automatically?  Should I do it live or in maintenance mode?

    Thank you.

    If zoning is all good, then on the ESX host you will need to do a new analysis for storage adapters in order to recognize the paths of the ESX host. I would recommend that you test this on a few servers not critics, and if the change configuration is successful it implement on others. Be sure to use politics of Multipathing recommended either fixed or MRU, check on VMware HCL to the Bay of storage for more information. However if you use policy fixed, you will need to manually set the path preferred by configuring > Datastore > properties > manage paths.

    I hope this information helps!

Maybe you are looking for