Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all 13334 articles
Browse latest View live

Remove Catalog?

$
0
0

Does anyone know of a remove catalog command?  I know there is a Get-Catalog cmdlet, but I don't see anything to remove one.

 

Thanks. -DB


vCloud: vShield Edge FW Rules

$
0
0

Hi all

 

I'm looking for a way to get and set firewall rules on a vShield Edge firewall in a vCloud environment.  My final target is to write two scripts; one that will export the firewall rules from a given vShield Edge firewall to CSV and another script that will import them from CSV into another vShield Edge firewall.  This is to help with a DR scenario where we'll shift a public IP block from a public facing vShield Edge in one vCloud environment to one in another environment.

 

I need to do this through the vCloud API or PowerCLI because, if I do it directly at the vShield Manager, vCloud won't know about the changes that have been made.  I'm not a Powershell expert by any means but I'm picking things up as I have a need for them.  I've looked through several blog posts people have written and it looks as though I need to dig down into ExtensionData as there aren't get and sets for the info I'm after.  I've found some info which is really close to what I'm after in this post:

Deepdive: vCloud vApp Networks | Geek after Five

 

This covers pulling the information from the GetNetworkConfigSection method in the Extensiondata of a vApp.  The issue I have is that the vShield Edge / network I'm after information from, isn't actually in a vApp.  It's a bit of a funny setup but I've got a vShield Edge firewall connected to the Internet and to an Org Network.  No VMs or vApps are connected to the Org Network.  Instead, I have about a dozen vApps, each with a vApp network and a vShield Edge connecting the vApp network to the Org Network.  This was a strategy recommended by VMware to overcome the limitation of 10 networks on the public facing vShield Edge and works brilliantly in that respect.  However... the public facing vShield Edge and Org Network are not in a vApp I can't use $vapp.ExtensionData.GetNetworkConfigSection()

Thinking about it while writing this, I guess one option would be to create another vApp and add the Org Network to it, then I might be able to get the info using GetNetworkConfigSection() but I wonder if there is a better/proper/prettier way to do it.

 

thanks in advance!

 

Dave

Export all vCloud Edge Gateway rules to CSV file

$
0
0

Hi,

 

For documenation purposes, I need to make a list of all vCloud firewall rules. Specifically, I am looking for Edge name, Rule ID, name, source, source port, destination, destination port, protocol, action, log, enabled/disabled

 

While I am terrible at any kind of scripting, I believe PowerCLI can accomplish this. Does anyone have a script or know where I can find one to obtain this info?

 

Thanks in advance!

Issue with Importing VM from vsphere into Vapp

$
0
0

I've the issue with importing vm from vsphere into existing vapp in vcloud director (8.0)

the following message error when i use import-civapp ...


Import-CIVApp, the vSphere server with UUID ...... is not found on this cloud Instance.

 

And yet I am sure that the vCenter I use is good

 

Any Idea ?

 

 

 

 

Code:

Connect-VIserver .... 
Connect-CIServer ... 
$vm=Get-VM test

Get-CIVapp $vappName | Import-CIVApp $vm

Listing vCloud Organization, Org VDCs, VMs, and a VM's Metadata field

$
0
0

How can I use PowerCLI to quickly list vCloud Organizations, Org VDCs, VMs, and a VM's Metadata field called "Location"?

 

I'd like to do this using views, but I can't find information on how to do this, especially the metadata part.

Any ideas?

Gather Edge information

$
0
0

Dear Community,

 

I'm in need of a script which can gather the following information:

 

- versions of all Edges (adminVAppNetwork, adminOrgNetwork and edgeGateway)

- type of Edge

- organizations they are located in

 

Looked pretty simple but it isn't, at least for me.

 

I am able to gather the versions in one script (Get-VM | Get-View). I can gather different types in another, using API, and of course I can gather the list or organizations but I am currently unable to match them.

 

Can you help me out please?

Thank you.

New-Org fails in new vCD 9.1 environment

$
0
0

Built out a nested vCD 9.1 environment on vSphere 6.5 with NSX 6.4.0

Manually created my first organization and getting ready to create a powershell script to build the second one, but I get an error when using New-Org.  I am able to connect to the cell with Connect-CiServer without error and I can run Get-Org successfully.

 

 

New-Org -Name 'MyOrg1' -FullName 'My Organization 1'

 

New-Org : 6/20/2018 9:37:45 AM New-Org The specified Href 'https://Cell01.lab.local/api/Internal errror: ComposeOperationHref() : serviceUrl is not prefix

of sourceHref' is not valid.

At line:1 char:1

+ New-Org -Name 'MyOrg1' -FullName 'My Organization 1'

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [New-Org], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Cloud.Commands.Cmdlets.NewOrg

 

 

 

I've tried two different vCD installs (following the same process) and two different client machines.  PowerCLI 10.0 and 10.1

Server is using a self-signed cert

 

Any ideas what it is hanging up on?

Set Mac address of vCloud VM

$
0
0

Hi

 

For a customer I need to regularly clone a production VM into vCloud for a test-environment. The VM needs to have an identical Mac Address because of some old-fashioned licenses. After cloning, the Is there a way I can easily set the Mac address of the VM to the original Mac Address? Even if the VMs is in the same vCenter environment, but different cluster of ESXi hosts.

 

Gabrie


Unable to connect to VCloud Director 5.1 build 5.1.1.868405

$
0
0

Hi.

 

We are not able to connect to a VCloud Director ver. 5.1.1 868405.  When we try a: connect-ciserver   we get the following error:

 

  Connect-CIServer        The underlying connection was closed: The connection was closed unexpectedly.

At line:1 char:17

+ Connect-CIServer <<<<  vclouddirector03.cloud.agesic.local

    + CategoryInfo          : NotSpecified: (:) [Connect-CIServer], CIException

    + FullyQualifiedErrorId : Cloud_ConnectivityServiceImpl_ConnectCloudServer_ConnectError,VMware.VimAutomation.Cloud.Commands.Cmdlets.ConnectCIServer

 

 

We are able to connect to a VCloud Director build  1.5 and also  the connect-viserver is working ok. The problem seems to be only with the VCloud Director 5.1.

 

We are using the latest version of PowerCLi 5.1 Release 2.

 

The error does not  give as much info.  Any one con give us some hints, were to start looking (logs etc.)

 

Thanks.

Connect-CIServer -Server vcloud.ourdomain.com Issues

$
0
0

Hi

 

I have now tried PowerCLI with ESX and vCenter, so far so good.

We have a vCLoud Area as well (v5.5)

 

So when i listed the VMs in vCenter, for area folder 'vCloud Director' this worked but the links to vApps and Notes were not there, not suprising.

 

So i went over to try

 

$Server =Connect-CIServer-Server'vcloud.ourdomain.com'-Userourdomain\me -Passwordxxxx -Org'DevTest'

 

which i have sys admin access to, no joy.

 

Connect-CIServer : 11/03/2014 8:53:04 PM    Connect-CIServer        The server returned 'Unauthorized' with the status code 401 - Unauthorized.  

 

Initially i used by local account, so i then added an lDAP account to me, same result.

 

>> So is there some special setting needed to enable "remote" / PowerCLI access to vCLoud ?

 

I looked around the vCloud web interface settings and saw nothing that stood out.

 

Thanks in advance

get-civm command piped to get-civapp | owner

$
0
0

Basically I've been researching to see how I might pull some reporting data from VCD. I ran across several sites that provide exactly what I am needing, but the problem is they all use the get-civm cmdlet which does not include the owner parameter which is what I need. The following script works great, but is there a way to pipe this to include the get-civapp | owner as well? I'm pretty new to Power CLI and I am hitting a wall. Initially I thought I could possibly run the script using the get-civapp cmdlet, but it errors out with a "Exception calling "GetVirtualHardwareSection" with "0" argument(s): "Access is forbidden" error message.

 

Any assistance or direction that you can provide would be greatly appreciated. Here is the script I copied from http://anthonyspiteri.net/?p=954 which references GeekAfterFive - Infrastructure as Code for credit.

 

# Get a list of vCloud Orgs

$ListOrg = Get-Org | Sort-Object -Property Name

 

 

# Write the list and prompt for input

write-host "$ListOrg"

write-host ""

$Org = read-host "Please Enter the Name of the Org"

 

 

$vms = Get-Org -Name $Org | get-civm

$objects = @()

 

 

# Jakes Smarts

foreach($vm in $vms)

{

$hardware = $vm.ExtensionData.GetVirtualHardwareSection()

$diskMB = (($hardware.Item | where {$_.resourcetype.value -eq "17"}) | %{$_.hostresource[0].anyattr[0]."#text"} | Measure-Object -Sum).sum

$row = New-Object PSObject -Property @{"vapp"=$vm.vapp;"Name"=$vm.Name;"Status"=$vm.Status;"cpuCount"=$vm.CpuCount;"memoryGB"=$vm.MemoryGB;"storageGB"=($diskMB/1024)}

$objects += $row

}

 

 

# Use select object to get the column order right. Sort by vApp. Force table formatting and auto-width.

$objects | select-Object name,vapp,cpuCount,memoryGB,storageGB | get-CIVApp owner| Sort-Object -Property vapp | Format-Table -AutoSize

 

 

Thanks,

Blind

Vcloud powerCLi - VM inventory report

$
0
0

HI all,

 

So i wrote this quick script to generate a report of VMs info and more specifically, who owns them.

 

The issue is that I am getting some rows with nothing but the Owner, and all the other colemns are empty.

 

Connect-Ciserver -Server VCDserver -User Username -Password Password


$report = @()


$Vapp = "*"


foreach($Vapp in Get-CiVapp -Name $vapp){

$vm = $vapp | get-civm

$row = "" | Select "Name", "VApp", "Org", "Status", "Operating System", "CpuCount", "Memory (GB)", Owner

$row."Name" = $vm.Name

$row."Vapp" = $vm.vapp

$row."Org" = $vm.Org

$row."Status" = $vm.Status

$row."Operating System" = $vm.GuestOSFullName

$row."CpuCount" = $vm.CpuCount

$row."Memory (GB)" = ($VM | Measure-Object -Property MemoryMB -Sum).Sum/1024

$row.Owner = $vapp.Owner

$report += $row

}

$report | export-csv "C:\VcloudVMsNEW.csv" -NoTypeInformation -UseCulture

 

Any ideas?

The remote server returned an error: (406) Not Acceptable

$
0
0

Hi all,

 

I'm new with Cloud Director and PowerCLI and I would like connect my vCD to create some stuffs.  But when I try to connect my vCD, I receive the following error:

Connect-CisServer The remote server returned an error: (406) Not Acceptable.. vmware

 

Executed command :

Connect-CIsServer -server xyz.com

 

Any idea is welcome...

 

Thx

Get-CIRole/Get-CIUser not working?

$
0
0

Hi,

 

I have a problem with some scripts, that used to work and now stop functioning. While investigating I found that Get-CIRole and/or Get-CIUser are no longer working as expected, and I do not know why.

 

I try and get the "organization administrators" of some VDC and inform them by e-Mail about some non-optimum VMs (no VMware tools, wrong NIC ...). This used to work that way:

 

$ORG=$VDC.Org

$ORGADMINROLE=(Get-CIRole -Name "Organization Administrator")

$ORGADMINs=(Get-CIUser -Org $ORG -Role $ORGADMINROLE | sort | Get-Unique)

 

But now in any case $ORGADMINs is empty. If I query an administrator directly, I get an error (though documentation says it should work that way):

 

PowerCLI C:\> Get-CIUser -Org $ORG -Name "myadminname"

 

Name                           External Locked DeployedVMCount StoredVMCount   Org

----                           -------- ------ --------------- -------------   ---

myadminname                    False    False  1               4               managedhosting

 

 

PowerCLI C:\> Get-CIUser -Org $ORG -Name "myadminname" | Get-CIRole

Get-CIRole : 17.09.2018 14:35:27    Get-CIRole        Object reference not set to an instance of an object.

At line:1 char:46

+ Get-CIUser -Org $ORG -Name "myadminname" | Get-CIRole

+                                              ~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-CIRole], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetCIRole

 

 

We use vCloud Director 8.20. Any help is really appreciated, since I am quite lost.

 

Regards, Tom.

Get All external IP's of all Edge-GW's

$
0
0

Hello!

I stucked at creating PShell to get all External IP's that are stored into vCloud Director properties of EdgeGW Sub-Allocate IP Pools:

vCloud Edge GW.png

 

or in EdgeGW properties in NSX Manager in Settings - Interfaces (on vmnic0 - Uplink):

 

NSX.png

And there is a lot of Edge GW's on Node. The main goal is to get all Sub-Allocate IP Pools that on External Network with name ClientsExternalNetwork in format:

 

Org Name | IP's

 

Thanks in advance.


vCloud Director change organization limits

$
0
0

Hi,

 

I have been able to find most organization settings, but cannot find where to set these using PowerCLI:

 

Number of resource intensive operations per user

Number of resource intensive operations per organization

Number of simultaneous connections per VM

 

Thanks,

 

Jim

Modify vApp network - set all to "Retain IP / MAC Resources"

$
0
0

vCloud Director 5.1.3

 

having a power outage, and looking to modify all vApp networks and set "Reatin IP / MAC Resources" to true so the NAT addresses are retained while vApps are down. 

 

Anyone have a sample script for something like this.

 

TIA

Get-View -RelatedObject returns error Unable to retrieve related object: vCenter server

$
0
0

Hello,

I'm having a very strange issue with a bit of code that grabs information on VMs in out vCloud environment. This segment feeds in the names of the Org vDC, a vApp within that Org vDC, and a VM within that vApp in order to return the full name of the VM in vCenter, which is usually the vCloud VM name followed by the cloud.uuid. This is the code in question:

$getCIVMinfo = Get-OrgVdc $CurrentOrgvDC | Get-CIVApp -Name $currentCIVApp | Get-CIVM -Name $currentCIVM

$vsphereVMView = Get-View –RelatedObject $getCIVMinfo.ExtensionData

 

In four of our five vCenters, this works without issue. However, in the fifth vCenter, the second line returns this error:

$vsphereVMView = Get-View -RelatedObject $getCIVMinfo.ExtensionData

Get-View : 08-Oct-18 08:48:00   Get-View                Unable to retrieve related object: vCenter server

'https://fqdn-of-vcenter-redacted:443' could not be found. Please make sure you are connected..

At line:1 char:18

+ $vsphereVMView = Get-View -RelatedObject $getCIVMinfo.ExtensionData

+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (VMware.VimAutomation.Cloud.Views.Vm:Vm) [Get-View], VimException

    + FullyQualifiedErrorId : Core_GetView_RelatedObject_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetIn

   terop.GetVIView

 

I'm definitely connected to the vCenter, and I can run other cmdlets against it without issue. I've also tried connecting to this vCenter by IP rather than FQDN to see if that would make a difference, but I still get the same error. I also had a colleague try from his computer to make sure it wasn't just me, but he ran into the same issue. All five vCenters are on the current version of 6.5 and we're both running the current PowerCLI modules. The only difference between this vCenter and the rest is that this one is on a Windows VM whereas the other four are VCSAs - but I don't see why that would matter.

 

Thanks in advance.

How to Transfer File to guest in vcloud director sdk

$
0
0

Hi,

 

I'm using vcloud director .net sdk 5.5 to automate the vcloud director operations.I want to transfer a file from my physical machine to the vm and execute it on the vm.

In vsphere .net sdk, InitiateFileTransferToGuest method of GuestFileManager and StartProgramInGuest method of GuestProcessManagercan be used to perform these actions.

is there any equivalent api method in vcloud sdk to accomplish this ?

 

 

 

please suggest something to resolve this.

 

 

 

Thanks.

List Edge Gateways and their version - PowerCLI

$
0
0

I am looking for a way to list all Edge Gateways deployed in all my ORG VDCs within my vCD 5.6.4 instance.

 

Does anyone have any documentation or examples of how I can find these Edge Gateways and their versions using PowerCLI?

 

vCD 5.6.4 doesn't really make it easy to know if the Edge Gateway is out of date.  I know I can look through vShield Manager, but that interface is not the most appealing to use when there are a few hundred Edge Gateways in existence.  A way to find this information using PowerCLI would allow me to list, sort and notify customers.

 

It makes it far easier to upgrade as well if we have up to date Edge Gateways.

 

Has anyone done this before?

Viewing all 13334 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>