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

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


Creating new Organization with specific Storage Profile

$
0
0

Been working on this a few hours now, but just can't seem to get it to work. Creating an organization with the Any(*) storage profile works, but as soon as i remove that profile and leave only the ones I want, it stops working.

 

vCenter 5.5

vCD 5.5

PowerCLI 5.5 R1

 

Here's the error:

PowerCLI D:\DC-DEV\Powershell> .\test2.ps1

storageprofilename

https://url/api/admin/extension/pvdcStorageProfile/34599474-b8ad-4000-8b3a-ac2a7a08a49b

Organization vDC Creation failed! The provider vdc does not contain the any storage policy.

PowerCLI D:\DC-DEV\Powershell>

 

 

Here's the code:

 

#Create a new vDC in the new Organization

        $adminVdc = New-Object VMware.VimAutomation.Cloud.Views.AdminVdc

        $adminVdc.Name = $name

        $adminVdc.IsEnabled = $Enabled

      

#ProviderVDC
$providerVdc = Get-ProviderVdc $ProviderVDC

        $providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference

        $providerVdcRef.Href = $providerVdc.Href

        $adminVdc.ProviderVdcReference =$providerVdcRef

        $adminVdc.AllocationModel = $AllocationModel

#Storage Profile
$adminVdc.VdcStorageProfiles = New-Object VMware.VimAutomation.Cloud.Views.VdcStorageProfiles
$StorageProfileCIview = search-cloud ProviderVdcStorageProfile -name $StorageProfile | Get-CIView
$StorageVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
$StorageVdcRef.Href = $StorageProfileCIview.href
$StorageVdcRef.Name = $StorageProfile
write-host $StorageVdcRef.name
write-host $StorageVdcRef.href
$adminVdc.VdcStorageProfiles.VdcStorageProfile = $StorageVdcRef

        $adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity

        $adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.ComputeCapacity.Cpu.Units = "MHz"

        $adminVdc.ComputeCapacity.Cpu.Limit = $CPULimit

        $adminVdc.ComputeCapacity.Cpu.Allocated = $CPUAllocated

        $adminVdc.ComputeCapacity.Memory = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.ComputeCapacity.Memory.Units = "MB"

        $adminVdc.ComputeCapacity.Memory.Limit = $MEMLimit

        $adminVdc.ComputeCapacity.Memory.Allocated = $MEMAllocated

        $adminVdc.StorageCapacity = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.StorageCapacity.Units = "MB"

        $adminVdc.StorageCapacity.Limit = $StorageLimit

      

        $OrgED = (Get-Org $Org).ExtensionData

try {
$orgVdc = $orgED.CreateVdc($adminVdc)
}
catch [Exception] {
$Exception = $_.Exception.Message

}

How to find the storage of a VM in Cloud director

$
0
0

Hi All,

 

When I use the below command

 

Get-CIVM -OrgVdc "MyOrgVDC1", it lists all the VMs under the Organization VDC. And for each VM it gives the vCPU and Memory details.

 

I also want the storage of the VM, like each VM's storage, does any one have any idea how to get it ?

 

Thanks,

Deepak

Remove Storage Profile from vDC

$
0
0

Hello,

 

How to remove storage profile from Organization vDC in vCloud Director 5.1. To be exact, I want to remove *(Any) profile from all my vdcs. I know how to create it and how to enable / disable it, but I cannot find any info regarding its deletion / removing. Here are some hints on how to remove it via vcloud API, but I need it to be done by PowerCLI: http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FUpdateVdcStorageProfilesType.html

 

TIA

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?

Create and Revert Snapshot

$
0
0

Hi

 

 

Could someone please give  a professional touch to this script so that I could Revert snapshot with results and then take a snapshot again

I would really appreciate your response.

Thanks

 

 

 

 

 

 

if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) {

 

 

"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

 

 

}

 

 

$srv= connect-CIServer -Server vcloud.link-connect.com -user xx -Password xxx -Org xxx

 

 

$vm = Get-CIvm "xxxx"-

 

 

$vm.ExtensionData.RemoveAllSnapshots() ???? Need Revert Script please !!

 

 

 

 

 

$vm.ExtensionData.CreateSnapshot($null,$null,"$null","$null")

Snapshots with vCloud Director 5.1 & PowerCLI 5.1

$
0
0

(cross-post from vCloud forum)

 

Now that vCloud Director 5.1 supports snapshots, I am looking at the  PowerCLI 5.1 cmdlets and cannot find a way to create/manage/revert  snapshots.  I see it is there in the API, but don't see a way to  interface via PowerCLI.  Any ideas?

Creating new Organization with specific Storage Profile

$
0
0

Been working on this a few hours now, but just can't seem to get it to work. Creating an organization with the Any(*) storage profile works, but as soon as i remove that profile and leave only the ones I want, it stops working.

 

vCenter 5.5

vCD 5.5

PowerCLI 5.5 R1

 

Here's the error:

PowerCLI D:\DC-DEV\Powershell> .\test2.ps1

storageprofilename

https://url/api/admin/extension/pvdcStorageProfile/34599474-b8ad-4000-8b3a-ac2a7a08a49b

Organization vDC Creation failed! The provider vdc does not contain the any storage policy.

PowerCLI D:\DC-DEV\Powershell>

 

 

Here's the code:

 

#Create a new vDC in the new Organization

        $adminVdc = New-Object VMware.VimAutomation.Cloud.Views.AdminVdc

        $adminVdc.Name = $name

        $adminVdc.IsEnabled = $Enabled

      

#ProviderVDC
$providerVdc = Get-ProviderVdc $ProviderVDC

        $providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference

        $providerVdcRef.Href = $providerVdc.Href

        $adminVdc.ProviderVdcReference =$providerVdcRef

        $adminVdc.AllocationModel = $AllocationModel

#Storage Profile
$adminVdc.VdcStorageProfiles = New-Object VMware.VimAutomation.Cloud.Views.VdcStorageProfiles
$StorageProfileCIview = search-cloud ProviderVdcStorageProfile -name $StorageProfile | Get-CIView
$StorageVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
$StorageVdcRef.Href = $StorageProfileCIview.href
$StorageVdcRef.Name = $StorageProfile
write-host $StorageVdcRef.name
write-host $StorageVdcRef.href
$adminVdc.VdcStorageProfiles.VdcStorageProfile = $StorageVdcRef

        $adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity

        $adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.ComputeCapacity.Cpu.Units = "MHz"

        $adminVdc.ComputeCapacity.Cpu.Limit = $CPULimit

        $adminVdc.ComputeCapacity.Cpu.Allocated = $CPUAllocated

        $adminVdc.ComputeCapacity.Memory = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.ComputeCapacity.Memory.Units = "MB"

        $adminVdc.ComputeCapacity.Memory.Limit = $MEMLimit

        $adminVdc.ComputeCapacity.Memory.Allocated = $MEMAllocated

        $adminVdc.StorageCapacity = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage

        $adminVdc.StorageCapacity.Units = "MB"

        $adminVdc.StorageCapacity.Limit = $StorageLimit

      

        $OrgED = (Get-Org $Org).ExtensionData

try {
$orgVdc = $orgED.CreateVdc($adminVdc)
}
catch [Exception] {
$Exception = $_.Exception.Message

}


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

Searching : Horizon Client SDK

$
0
0

Hi guys. I need some help.

    Anything or any information related to Horizon Client SDK is needed . Thanks for your help!

Snapshots with vCloud Director 5.1 & PowerCLI 5.1

$
0
0

(cross-post from vCloud forum)

 

Now that vCloud Director 5.1 supports snapshots, I am looking at the  PowerCLI 5.1 cmdlets and cannot find a way to create/manage/revert  snapshots.  I see it is there in the API, but don't see a way to  interface via PowerCLI.  Any ideas?

All vCloud VMs in a provider vDC

$
0
0

Trying to get all VMs use a provider. The issue is making the call from the provider to then get all the vApps - it cannot be made this way

 

Does anyone have a clean way of perfroming this action? ( A whole cluster (One of the many provider vDCs we have ) is going down, so i would like to generate a list.

 

Every Org has anywhere from 1-5 organization vDCs, so parsing it that way is a last resort in my book.

 

Thoughts? Suggestions?

 

 

$report = @()

$list = Get-ProviderVdc "Provider vDC" | get-civapp

foreach ($Vapp in $list){    $vms = $vapp | get-civm        foreach($vm in $vms){        if($vm) {            $vm | %{    $row = "" | select "name", "owner", "Email"    $row."name" = $_.name    $row."owner" = $vapp.Owner.FullName    $row."Email" = $vapp.Owner.Email        }    }    $report += $row    }    }        $report = $report | Sort-Object -Property Owner        $report | export-csv "C:\Vcloud-cluster-VMs.csv" -NoTypeInformation -UseCulture

Setting Guest Customization Section Fails in 5.5

$
0
0

Hi,

 

Since migrating to vCloud 5.5 the following script fails which worked in 5.1:

 

$CIVMs = get-CIvApp $CIvAppName | get-civm
Foreach ($vm in $CIVMs) {
write-host "Customizing" $vm.name
$GuestCustomization = $vm.ExtensionData.GetGuestCustomizationSection()
$GuestCustomization.Enabled = $true
$GuestCustomization.ChangeSid = $false
$GuestCustomization.ComputerName = $vm.name
$GuestCustomization.ResetPasswordRequired = $false
$GuestCustomization.AdminPasswordEnabled = $false
$GuestCustomization.UpdateServerData()
}

 

The error is the following:

 

Exception calling "UpdateServerData" with "0" argument(s): "Bad request  - Unexpected JAXB Exception  -

cvc-complex-type.2.4.a: Invalid content was found starting with element 'AdminAutoLogonEnabled'. One of

'{"http://www.vmware.com/vcloud/v1.5":Link, WC[##other:"http://www.vmware.com/vcloud/v1.5"]}' is expected."

At line:10 char:1

+ $GuestCustomization.UpdateServerData()

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

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : CloudException

 

 

Any ideas?

 

Thanks!

Get vDC Storage Policy quota

$
0
0

Hello.

 

I want to retrieve the storage policies quota assigned to an Org vDC using PowerCLI.

 

I initially tried to retrieve this information using $orgvDC.StorageLimitGB but this gives me the sum of the storage profiles quotas (I want the information per storage profile).

 

I managed to retrieve the vDC's storage profiles this way:

 

foreach ($vDCStorageProfilein$orgvDC.ExtensionData.VdcStorageProfiles) {

 

  }

 

I assume it is possible as there is a "limit" element in the API documentation but I can't find how to retrieve this limit for each storage profile.

 

Any idea?

Command for listing all vm's within a vApp ?

$
0
0

This is seemingly simple, however I have yet to find success with this. How do I list all of the vm's in within a vApp along with all of the information about these vm's, namely thier IP, Ram, Compute, etc


VMware.VimAutomation.Logging.SoapInterceptor not found

$
0
0

Hi,

 

I'm trying to reboot a VM with PowerCli and then wait until the vm is running. I user this command for this:

 

Get-CIVM -VApp $VCloudVappName -Name $VCloudVmName | Restart-CIVMGuest -Confirm:$false -WhatIf | Wait-Tools

 

This works at least the last command. Wait-Tools every time gets an error

 

Connect-VIServer : Die Datei oder Assembly "VMware.VimAutomation.Logging.SoapInterceptor, Version=1.0.0.646, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
In C:\tmp\reboot.ps1:13 Zeichen:1
+ Connect-VIServer -Server $VCloudHost -Credential $mycredsVCloud
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], FileNotFoundException    + FullyQualifiedErrorId : System.IO.FileNotFoundException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

Wait-Tools : Die Datei oder Assembly "VMware.VimAutomation.Logging.SoapInterceptor, Version=1.0.0.646, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
In C:\tmp\reboot.ps1:15 Zeichen:104
+ ... VCloudVmName | Restart-CIVMGuest -Confirm:$false -WhatIf | Wait-Tools
+                                                                ~~~~~~~~~~    + CategoryInfo          : NotSpecified: (:) [Wait-Tools], FileNotFoundException    + FullyQualifiedErrorId : System.IO.FileNotFoundException,VMware.VimAutomation.ViCore.Cmdlets.Commands.WaitTools

It's a german error message, but it says something like "File or assembly ... or a dependency not found. The system can not find the specified file.

 

I have PowerCli Version 6.5.1, the latest VIX Tools, and I already restarted my Computer

Can someone help me?

Creating Routed Org Network in vCD 9.0.0.2

$
0
0

Hi guys.

 

I can't create Routed Org Network by PowerCLI.

 

PowerCLI version is 6.5.0.234 and vCD for SP version is 8.20.0.2.

 

I'm connected to vCD server and all objects are exists: Org "Test", OrgVDC "Test-VDC" and EdgeGW "Test-EdgeGW".

But last one (EdgeGW) isn't using in script and it's strange because in process of creation routed org network in GUI we are choosing existing Edge Gateway... (see pic).

I suppose that script is out of date...

RoutedOrgNetwork.png

 

PowerCLI C:\> $OrgName = "Test"

PowerCLI C:\> $Org = Get-Org -Name $OrgName

PowerCLI C:\> $OrgVDCName = "$OrgName-VDC"

PowerCLI C:\> $OrgVDC = Get-OrgVdc -Name $OrgVDCName

 

PowerCLI C:\> $edgeGateway = Search-Cloud -QueryType EdgeGateway -Name $orgName | Get-CIView | where {$_.name -like "$orgName*"}

PowerCLI C:\> $ExNetnetwork = New-Object VMware.VimAutomation.Cloud.Views.OrgVdcNetwork

PowerCLI C:\> $ExNetnetwork.EdgeGateway = $edgeGateway.Id

PowerCLI C:\> $ExNetnetwork.isShared = $false

PowerCLI C:\> $ExNetnetwork.Configuration = New-Object VMware.VimAutomation.Cloud.Views.NetworkConfiguration

PowerCLI C:\> $ExNetnetwork.Name = "$OrgName-Org-Net01"

PowerCLI C:\> $ExNetnetwork.Configuration.IpScopes = New-Object VMware.VimAutomation.Cloud.Views.IpScopes

PowerCLI C:\> $ExNetnetwork.Configuration.FenceMode = "natRouted"

PowerCLI C:\> $IpScope = New-Object VMware.VimAutomation.Cloud.Views.IpScope

PowerCLI C:\> $IpScope.Gateway = "192.168.100.1"

PowerCLI C:\> $IpScope.Netmask = "255.255.255.0"

PowerCLI C:\> $IpScope.Dns1 = "8.8.8.8"

PowerCLI C:\> $IpScope.IpRanges = New-Object VMware.VimAutomation.Cloud.Views.IpRanges

PowerCLI C:\> $IpScope.IpRanges.IpRange = New-Object VMware.VimAutomation.Cloud.Views.IpRange

PowerCLI C:\> $IpScope.IpRanges.IpRange[0].StartAddress = "192.168.100.2"

PowerCLI C:\> $IpScope.IpRanges.IpRange[0].EndAddress = "192.168.100.50"

PowerCLI C:\> $ExNetnetwork.Configuration.IpScopes.IpScope += $IpScope

PowerCLI C:\> $orgVdc.ExtensionData.CreateNetwork($ExNetnetwork)

 

Exception calling "CreateNetwork" with "1" argument(s): "The server returned 'Server Error' with the status code 500 - InternalServerError."

At line:1 char:1

+ $orgVdc.ExtensionData.CreateNetwork($ExNetnetwork)

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

  + CategoryInfo : NotSpecified: (:) [], MethodInvocationException

  + FullyQualifiedErrorId : CloudException

 

What's wrong? Can anybody give me working example of creating Routed Org Network by PowerCLI?

VM Snapshot with Power shell cli

$
0
0

Hello All

 

I do not have much knowledge of Powershell but I'm trying to create a snapshot in vcloud.link-connect.com with below script but I'm getting an error as term "Connect-CIServer is not recognized.

I would really appreciate if you could help me fix this issue. please find my script below.

 

if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) {

"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

}

$srv= connect-CIServer -Server vcloud.link-connect.com -user xx -Password xxx -Org xxx

$vm10 = Get-CIvm "xxxx"-

$vm10.ExtensionData.RemoveAllSnapshots()

 

$vm10.ExtensionData.CreateSnapshot($null,$null,"$null","$null")

 

Many Thanks

Dan

Create and Revert Snapshot

$
0
0

Hi

 

 

Could someone please give  a professional touch to this script so that I could Revert snapshot with results and then take a snapshot again

I would really appreciate your response.

Thanks

 

 

 

 

 

 

if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) {

 

 

"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

 

 

}

 

 

$srv= connect-CIServer -Server vcloud.link-connect.com -user xx -Password xxx -Org xxx

 

 

$vm = Get-CIvm "xxxx"-

 

 

$vm.ExtensionData.RemoveAllSnapshots() ???? Need Revert Script please !!

 

 

 

 

 

$vm.ExtensionData.CreateSnapshot($null,$null,"$null","$null")

Import template/VM to vCloud Director catalog with PowerCLI

$
0
0

This is a 2 part question:

 

Part 1: I have about 24 virtual machines/templates in VC and would like to automate the import of these into the vCD catalog instead of doing it though the gui. I don't need the entire script just a sample function/method to use and the parameters needed

 

I'm thinking I would need the Import-CIVApp and then use another method to convert those vApps to catelog items, just want to confirm:

 

http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Import-CIVApp.html

 

 

Part 2: Once I have the VM's in a catalog, is it possible to create a  vApp, add the VM's to it and customize it (Network Settings, IP settings etc..) and then add the networking to that vApp.

 

 

Thanks!

Viewing all 13334 articles
Browse latest View live


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