Quantcast
Channel: VMware Communities : Discussion List - VMware PowerCLI
Viewing all 14549 articles
Browse latest View live

PowerCLI 5.8 Release 1 throws an exception when starting

$
0
0

So I decided to upgrade my PowerCLI 5.5 R2 Patch 1 to the latest 5.8, released last week or so. (yeah, I know, I guess I decided to live dangerously, using brand new versions :-))  And the upgrade installation went fine. But when I start PowerCLI, I am getting:

 

Add-PSSnapin : The type initializer for 'VMware.VimAutomation.Storage.Interop.V1.Service.StorageServiceFactory' threw an exception.

At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:48 char:10

+          Add-PSSnapin $snapin

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

    + CategoryInfo          : NotSpecified: (:) [Add-PSSnapin], TypeInitializationException

    + FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

Anybody know why? I didn't update the vSphere CLI, just PowerCLI. I was still able to connect to my vCenter (I connect to my vCenter in my profile). But I don't know what won't work. I did a quick "Get-VMHost", "Get-VM" and a few others - they all worked fine.

 

Name                           Value

----                           -----

PSVersion                      4.0

WSManStackVersion              3.0

SerializationVersion           1.1.0.1

CLRVersion                     4.0.30319.18444

BuildVersion                   6.3.9600.16406

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}

PSRemotingProtocolVersion      2.2

 

PowerCLI Version

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

   VMware vSphere PowerCLI 5.8 Release 1 build 2057893

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

Snapin Versions

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

   VMWare AutoDeploy PowerCLI Component 5.5 build 1983942

   VMWare ImageBuilder PowerCLI Component 5.5 build 1983942

   VMware License PowerCLI Component 5.5 build 1265954

   VMware Storage PowerCLI Component 5.8 build 2057894

   VMware VDS PowerCLI Component 5.8 build 2031581

   VMware vSphere PowerCLI Component 5.8 build 2031581

   VMware vSphere Update Manager PowerCLI 5.1 build 782803

 

Ideas, anyone? Should I roll back to 5.5? Anyone else having any issues?


Error when trying to create multiple linked clones

$
0
0

Hello all,

 

I have another script question for this one which attempts to create multiple linked clones.  I am getting the error "Wait-Task : The object has no provider associated." (see below under results).  Just need to know why this is happening, but I am new to PowerCLI.

 

SCRIPT;

 

$vm = Get-VM "test" | Get-View

$clonePrefix = "testclone"

$numClones = 2

$concurrentClones = 2

 

$cloneFolder = $vm.parent

 

$cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec

$cloneSpec.Snapshot = $vm.Snapshot.CurrentSnapshot

 

$cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec

$cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]::createNewChildDiskBacking

 

#To power on each clone immediately after it is created:

#$cloneSpec.powerOn = $true

 

$i = 1

while ($i -le $numClones) {

   $taskViewArray = @()

   foreach ($j in 1..$concurrentClones) {

      $taskViewArray += $vm.CloneVM_Task( $cloneFolder, $clonePrefix+$i, $cloneSpec )

      $i++

   }

   $taskArray = $taskViewArray | Get-VIObjectByVIView

   Wait-Task $taskArray

 

 

 

RESULT;

 

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> .\hinomu

ltipleclones.ps1

Wait-Task : The object has no provider associated.

At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\HinoMultipleCl

ones.ps1:25 char:13

+    Wait-Task <<<<  $taskArray

    + CategoryInfo          : NotSpecified: (:) [Wait-Task], InvalidOperationE

   xception

    + FullyQualifiedErrorId : System.InvalidOperationException,VMware.VimAutom

   ation.ViCore.Cmdlets.Commands.WaitTask

 

 

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>

Set HA Restart Priority from a csv file

$
0
0

Hello

 

I have a Problem with set HA Restart Priority from a csv file on VMs.

My script part is like that:

 

if ($Export)

{

# Export to csv

$mycluster = Get-Cluster -Name $Cluster

$mycluster.ExtensionData.Configuration.DasVmConfig |

Select @{N="VM";E={Get-View $_.Key -Property Name | Select -ExpandProperty Name}},

@{N="RestartPriority";E={$_.RestartPriority}} |

Export-Csv $Path\HARestartPrio.csv -NoTypeInformation -UseCulture }

 

if ($Set)

{

# Set from csv

$Import = Import-Csv $Path\HARestartPrio.csv

foreach ($line in $Import)

{ set-vm -vm $line."VM" -HARestartPriority $line."RestartPriority" -Confirm:$false } }

 

When I will set the priority, the CLI give an error back:

The HARestartPriority Parameter can not check. The Argument is Null or empty

 

What is wrong in my script? Have you any ideas?

how to build a new vm based on cluster with powercli?

$
0
0

when you create a new vm on cluster in the GUI, you can't select host, it is decided by the cluster.

Now I want to create a new vm on cluster by powerCli. I haven't found any parameter to specify the cluster.

Only the 'VMHost' to specify the host.

 

why they are so different?

Any one can help me to understand it and how to create a new VM on cluster?

 

 

Thank you in advance!

Invoke-VMScript Enable-PSRemoting Access Denied

$
0
0

I have been doing a lot of work with the Invoke-VMScript command and most commands run fine on the target VM as long as you are doing it as a domain admin. However, today I came across a command that will not run through Invoke-VMScript. I am trying to remotely enable PowerShell Remoting using the "Enable-PSRemoting -Force" command and I keep getting an access denied.

 

Does anyone know a trick to get this command to run without getting access denied? This is the first time I have come across a command I could not get to run as domain admin?

migrating vms from vss to vds

$
0
0

I need to migrate all my vms from vss to vds

 

basically all the vms are on vswitch3

 

I need to move them to dvs3

 

I dont need to move any nics, both vss and vds already have nics available so I just need to loop though the vms per host and change the portgroup

 

so I have something like this...

 

$vss_vlan50

$vss_vlan60

$vss = vswitch3

$dvs = dvs3

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

 

$vms_vss_vlan50 = Get-VMHost $vmhost_array | Get-VirtualSwitch -Name $vss | Get-VirtualPortGroup -Name $vss_vlan50 | Get-VM

 

foreach ($vm in $vms_vss_vlan50) {

 

Get-NetworkAdapter $vm | %{

  

  $_ | Set-NetworkAdapter -PortGroup $dvs -Confirm:$false

 

}

}

 

 

Is there a better way to do this? I will have to do a for loop for each portgroup? I have tons of portgroups

 

thanks

Get-ESXTop, VM counters

$
0
0

Hello all

 

I need a script that return some performance counters of a VM. I found in Luc'd Hitchhiker's Guide to Get-EsxTop a possible way. But i need it with a VM name input.

Thats my script:

 

param    (    [String]$vCenter,    [String]$VM   )
#    Connect to vCenter with the current user
Connect-VIServer $vCenter
$VMHost = Get-VMHost -VM $VM
Connect-VIServer $VMHost
$esxtopInterval = 5
$conversion = 100 / (1e6 * $esxtopInterval)
$group = Get-EsxTop -CounterName SchedGroup | where {$_.VMName -eq $VM}
$gr = Get-EsxTop -TopologyInfo -Topology SchedGroup | %{$_.Entries} | where {$_.GroupId -eq $group.GroupID}
$cpuIds = @()
$gr.CpuClient | %{$cpuIds += $_.CPUClientID}
$first = $true
$result = @()
for($i = 0; $i -lt 5;$i++){    $cpuStats = Get-EsxTop -CounterName VCPU | where {$cpuIds -contains $_.VCPUID}        if (!$first){        $row = "" | select VCPUID, Used, Ready, CSTP;        $row.VCPUID = $cpustats.VCPUID;        $row.Used = "{0:p1}" -f (($cpustats.UsedTimeInUsec - $used) * $conversion)        $row.Ready =  "{0:p1}" -f (($cpustats.ReadyTimeInUsec - $ready) * $conversion)        $row.CSTP = "{0:p1}" -f (($cpustats.CoStopTimeInUsec - $CSTP) * $conversion)        $result += $row        }        else{        $first = $false        }        $used = $cpustats.UsedTimeInUsec        $ready = $cpustats.ReadyTimeInUsec        $CSTP = $cpustats.CoStopTimeInUsec        sleep $esxtopInterval    }
$result | ft –AutoSize

 

It's run without an error but the counters are empty.

Counters.JPG

Can you see what's wrong in this script?

Can someone provide me a powercli script to retrieve Service Tag Details of HP ESXI Hosts

$
0
0

Can someone provide me a powercli script to retrieve Service Tag Details of HP ESXI Hosts in a cluster.


Migrating VMkernel virtual adapters from VDS1 to VDS2

$
0
0

What is the best way to add VMkernel virtual adapters when migrating a host using VDS from vCenter1 to vCenter2? I've attached a sample script I'm using for the process. The last Add-VDSwitchPhysicalNetworkAdapter command fails with a "Value cannot be null" error.

 

For background, I have a source vCenter Server (version 5.0) and a target vCenter Server (version 5.5). I would like to do a hot migration of a host that uses VDS from vCenter1 to vCenter2. If I run the script step by step, everything works as expected until the Add-VDSwitchPhysicalNetworkAdapter command. I can then complete the process manually using the following process in the vSphere Client:

 

Hosts and Clusters -> Select host -> Configuration -> Networking -> vSphere Distributed Switch -> Manage Virtual Adapters (for the appropriate VDS) -> Add -> Migrate existing virtual adapters

 

After completing the manual steps above, I can then remap the VMs and then remove the old VDS (which no longer exists).

VMware View Powercli Get-EventReport return no data

$
0
0

Hello here,

 

I try to make an error reported script from the event of a Horizon VMware VIew.

So, first i tried to retrieve the event log with this PowerCli command

Get-EventReport -ViewName user_events -StartDate ((Get-Date).Adddays(-1))

But this command return no output object.

It seems the command cannot retreive the event from database , how can i debug this please ?

 

I use Powercli for VMwareVIEW horizon 5.2.

The cmdlet was tested directely from the connection server.

 

Thank you.

Question how to use powercli to unclaim, load and run new claimrules

$
0
0

Hi,

 

I'm with a customer where I'm changing the claim rule for their datastores.  Theres a lot of hosts and rebooting each and every host is not wanted (but if I have to, I'll do it).  Anyway, I don't want to log in to every host eighter to run the commands in shell to unclaim datastore/device, load and run the new rules.  So, I want to automate this with powercli, but I don't find any good examples how to - could anyone help ?

 

Claim rule added to hosts:

$esxcli.storage.nmp.satp.rule.add($null,"tpgs_on","HP 3PAR Custom iSCSI/FC/FCoE ALUA Rule",$null,$null,$null,"VV",$null,"VMW_PSP_RR","iops=1","VMW_SATP_ALUA",$null,$null,"3PARdata")

 

Unclaiming:

in esxi shell it's done like this: esxcli storage core claiming unclaim --type device  --device naa.xxxxxxxxxxxxxxxxxxxx

 

How to transform this into a powercli command ?

$esxcli.storage.core.claiming.unclaim(string adapter, long channel, string claimruleclass, string device, string driver, long lun, string model, string path, string plugin, long target, string type, string vendor)

 

Load and run:

$esxcli.storage.core.claimrule.load(string claimruleclass)

$esxcli.storage.core.claimrule.run(string adapter, long channel, string claimruleclass, string device, long lun, string path, long target, string type, boolean wait)

 

Thanks!

 

/BKiil

how to get information Vmware view 5.1 desktop pool running seesion.

$
0
0

Hello,

 

Currently we are running 4 desktop pool on  two connection server in our infrastructure. in the desktop poll setting we have not any Connection Server restrictions.

so is there anyway that i can identify my pool live session running on which connection server ?

Thank you

How to use PowerCLI to automate snapshot creation / deletion

$
0
0

I am trying to use PowerCLI to automate snapshot creation and deletion so I have a quick & dirty safety net to protect against user error.

 

Using this command I am able to create a snapshot for all VMs:

get-vm | new-snapshot -Name "DailySnap" -Description "Daily Snapshot" -Quiesce -Memory

One problem I have with this is that even though I'm not using the -RunAsync switch, a bunch of snapshots all try to process at the same time, which isn't what I want.  I want one snapshot to run at a time so I don't kill the storage performance.

 

Also, ideally I would like to have more than one snapshot, i.e. one snapshot per day for the past 5 days, and continually delete the oldest snapshot.  So for example on days 1-5 a snapshot gets created and on day 6 a new snapshot gets created and snapshot 1 gets deleted, on day 7 a new snapshot gets created and snapshot 2 gets deleted, etc.  The problem is that subsequent snapshots seem to be treated as children of any existing snapshots, like this:


VM

-Snap1

--Snap2

---Snap3

----Snap4


Is it possible to prevent new snapshots from being children so it would look like this?


VM

-Snap1

-Snap2

-Snap3

-Snap4

VM Created on date export csv - get-vm testvm works but get-vmcreationdate says testvm could not be found.

$
0
0

Hello

 

I have input the following two functions in to my powercli shell

 

Two functions that i have installed

function Get-VMEvents {

<#

   .Synopsis

 

    Get events for an entity or for query all events.

 

   .Description

 

    This function returns events for entities. It's very similar to

    get-vievent cmdlet.Note that get-VMEvent can handle 1 vm at a time.

    You can not send array of vms in this version of the script.

 

    .Example

 

    Get-VMEvents 0All -types "VmCreatedEvent","VmDeployedEvent","VmClonedEvent"

 

    This will receive ALL events of types "VmCreatedEvent","VmDeployedEvent",

    "VmClonedEvent".

   

   .Example

 

    Get-VMEvents -name 'vm1' -types "VmCreatedEvent"

 

    Will ouput creation events for vm : 'vm1'. This was is faster than piping vms from

    get-vm result. There is no need to use get-vm to pass names to get-vmevents.

    Still, it is ok when you will do it, it will make it just a little bit slower <span class="wp-smiley wp-emoji wp-emoji-wink" title=";)">;)</span>

   

   .Example

 

    Get-VMEvents -name 'vm1' -category 'warning'

 

    Will ouput all events for vm : 'vm1'. This was is faster than piping names from

    get-vm cmdlet. Category will make get-vmevent to search only defined category

    events.

   

   .Example

 

    get-vm 'vm1' | Get-VMEvents -types "VmCreatedEvent","VmMacAssignedEvent"

 

    Will display events from vm1 which will be regarding creation events,

    and events when when/which mac address was assigned

 

 

    .Parameter VM

 

    This parameter is a single string representing vm name. It expects single vm name that

    exists in virtual center. At this moment in early script version it will handle only a case

    where there is 1 instance of vm of selected name. In future it will handle multiple as

    well.

   

   .Parameter types

 

    If none specified it will return all events. If specified will return

    only events with selected types. For example : "VmCreatedEvent",

    "VmDeployedEvent", "VmMacAssignedEvent" "VmClonedEvent" , etc...

   

    .Parameter category

 

    Possible categories are : warning, info, error. Please use this parameter if you

    want to filter events.

   

    .Parameter All

 

    If you will set this parameter, as a result command will query all events from

    virtual center server regarding virtual machines.

 

   .Notes

 

    NAME:  VMEvents

 

    AUTHOR: Grzegorz Kulikowski

 

    LASTEDIT: 11/09/2012

   

    NOT WORKING ? #powercli @ irc.freenode.net

 

   .Link

 

http://psvmware.wordpress.com

 

#>

 

param(

[Parameter(ValueFromPipeline=$true)]

[ValidatenotNullOrEmpty()]

$VM,

[String[]]$types,

[string]$category,

[switch]$All

)

    $si=get-view ServiceInstance

    $em= get-view $si.Content.EventManager

    $EventFilterSpec = New-Object VMware.Vim.EventFilterSpec

    $EventFilterSpec.Type = $types

    if($category){

    $EventFilterSpec.Category = $category

    }

   

    if ($VM){

    $EventFilterSpec.Entity = New-Object VMware.Vim.EventFilterSpecByEntity

    switch ($VM) {

    {$_ -is [VMware.Vim.VirtualMachine]} {$VMmoref=$vm.moref}

    {$_ -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl]}{$VMmoref=$vm.Extensiondata.moref}

    default {$vmmoref=(get-view -ViewType virtualmachine -Filter @{'name'=$VM}).moref }

    }

    $EventFilterSpec.Entity.Entity = $vmmoref

        $em.QueryEvents($EventFilterSpec)

    }

    if ($All) {

    $em.QueryEvents($EventFilterSpec)

    }

}

function get-vmcreationdate {

<#

   .Synopsis

 

    Gets where possible vm creation date.

 

   .Description

 

    This function will return object with information about  creation time, method, month,

    creator for particular vm.

    VMname         : SomeVM12

    CreatedTime    : 8/10/2012 11:48:18 AM

    CreatedMonth   : August

    CreationMethod : Cloned

    Creator         : office\greg

   

    This function will display NoEvent value in properties in case when your VC does no

    longer have information about those particular events, or your vm events no longer have

    entries about being created. If your VC database has longer retension date it is more possible

    that you will find this event.

 

    .Example

 

    Get-VMCreationdate -VMnames "my_vm1","My_otherVM"

 

    This will return objects that contain creation date information for vms with names

    myvm1 and myvm2

   

   .Example

 

    Get-VM -Location 'Cluster1' |Get-VMCreationdate

 

    This will return objects that contain creation date information for vms that are

    located in Cluster1

   

   .Example

 

    Get-view -viewtype virtualmachine -SearchRoot (get-datacenter 'mydc').id|Get-VMCreationDate

 

    This will return objects that contain creation date information for vms that are

    located in datacenter container 'mydc'. If you are using this function within existing loop where you

    have vms from get-view cmdlet, you can pass them via pipe or as VMnames parameter.

 

    .Example

 

    $report=get-cluster 'cl-01'|Get-VMCreationdate

    $report | export-csv c:\myreport.csv

    Will store all reported creationtimes object in $report array variable and export report to csv file.

    You can also filter the report before writing it to csv file using select

    $report | Where-Object {$_.CreatedMonth -eq "October"} | Select VMName,CreatedMonth

    So that you will see only vms that were created in October.

 

 

    .Example

    get-vmcreationdate -VMnames "my_vm1",testvm55

    WARNING: my_vm1 could not be found, typo?

    VMname         : testvm55

    CreatedTime    : 10/5/2012 2:24:03 PM

    CreatedMonth   : October

    CreationMethod : NewVM

    Creator        : home\greg

    In case when you privided vm that does not exists in yor infrastructure, a warning will be displayed.

    You can still store the whole report in $report variable, but it will not include any information about

    missing vm creation dates. A warning will be still displayed only for your information that there was

    probably a typo in the vm name.

   

    .Parameter VMnames

 

    This parameter should contain virtual machine objects or strings that represents vm

    names. It is possible to feed this function wiith VM objects that come from get-vm or

    from get-view.

 

 

   .Notes

 

    NAME:  Get-VMCreationdate

 

    AUTHOR: Grzegorz Kulikowski

 

    LASTEDIT: 27/11/2012

   

    NOT WORKING ? #powercli @ irc.freenode.net

 

   .Link

 

http://psvmware.wordpress.com

 

#>

 

param(

[Parameter(ValueFromPipeline=$true,Mandatory = $true)]

[ValidateNotNullOrEmpty()]

[Object[]]$VMnames

)

process {

foreach ($vm in $VMnames){

$ReportedVM = ""|Select VMname,CreatedTime,CreatedMonth,CreationMethod,Creator

if ($CollectedEvent=$vm|Get-VMEvents -types 'VmBeingDeployedEvent','VmRegisteredEvent','VmClonedEvent','VmBeingCreatedEvent' -ErrorAction SilentlyContinue)

    {

    if($CollectedEvent.gettype().isArray){$CollectedEvent=$CollectedEvent|?{$_ -is [vmware.vim.VmRegisteredEvent]}}

    $CollectedEventType=$CollectedEvent.gettype().name

    $CollectedEventMonth = "{0:MMMM}" -f $CollectedEvent.CreatedTime

    $CollectedEventCreationDate=$CollectedEvent.CreatedTime

    $CollectedEventCreator=$CollectedEvent.Username

        switch ($CollectedEventType)

        {

        'VmClonedEvent' {$CreationMethod = 'Cloned'}

        'VmRegisteredEvent' {$CreationMethod = 'RegisteredFromVMX'}

        'VmBeingDeployedEvent' {$CreationMethod = 'VmFromTemplate'}

        'VmBeingCreatedEvent'  {$CreationMethod = 'NewVM'}

        default {$CreationMethod='Error'}

        }

    $ReportedVM.VMname=$CollectedEvent.vm.Name

    $ReportedVM.CreatedTime=$CollectedEventCreationDate

    $ReportedVM.CreatedMonth=$CollectedEventMonth

    $ReportedVM.CreationMethod=$CreationMethod

    $ReportedVM.Creator=$CollectedEventCreator

    }else {

        if ($?) {

            if($vm -is [VMware.Vim.VirtualMachine]){$ReportedVM.VMname=$vm.name} else {$ReportedVM.VMname=$vm.ToString()}

            $ReportedVM.CreatedTime = 'NoEvent'

            $ReportedVM.CreatedMonth = 'NoEvent'

            $ReportedVM.CreationMethod = 'NoEvent'

            $ReportedVM.Creator = 'NoEvent'

           

        } else {

            $ReportedVM = $null

            Write-Warning "$VM could not be found, typo?"

        }

    }

    $ReportedVM

}

}

}

 

 

Now if i use the first command

 

get-vm testvm

 

i get a response of

 

 

 

Name                 PowerState Num CPUs MemoryGB

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

testvm          PoweredOn  4        4.000

 

 

But if i do

 

get-vmcreationdate testvm

 

it responds with

 

Warning: testvm could not be found. typo?

 

 

I cant seem to figure out why it is saying this?

 

What the eventual goal will be to query the entire vcenter server and export a CSV of each VM's creation date -is their a easier way of doing this?

 

i was planning to use

 

get-vm | Get-VMCreationDate | Export-Csv -path “d:\\reports\vmcreationinventory.csv

 

But at the moment every single VM is stating "could not be found"

 

Attached is a example with a Vm called gbvls

Lockdown Script

$
0
0

Hi All,

 

 

Sorry a script newbie here. I am trying to create a lockdown change script. It was working fine till i tried to pass the action in (enable or disable). I am pretty sure the if statement is working correctly but i don't think the $lockdown is being processed correctly in the  "(get-vmhost $ESXhost | get-view).$lockdown" line. Do i need to convert $lockdown from a string?

 

 

Thanks

 

 

# Check to make sure both arguments exist

if ($args.count -ne 3) {

Write-Host "Usage: lockdown.ps1 <vCenter> <Clustername> <enable/disable>"

exit

}

 

 

 

 

$vCenter = $args[0]

$cluster = $args[1]

$action = $args[2]

 

 

 

 

write-host $action

If ($action -eq "enable") {

$lockdown="EnterLockdownMode()"

}

ElseIf ($action -eq "disable") {

$lockdown="ExitLockdownMode()"

}

Else {

write-Host "This action specified does not exist, use either enable or disable"

}

write-host "$lockdown"

 

 

Connect-VIServer $vCenter

$Scope = Get-VMHost -location $cluster #This will change the Lockdown Mode on all hosts managed by vCenter, amend this if you need to

foreach ($ESXhost in $Scope) {

(get-vmhost $ESXhost | get-view).$lockdown

}

Disconnect-VIServer -Server $vCenter -Confirm:$false


Moving a hard disk with PowerCLI

$
0
0

I have a vm with several disks. I create a new vm, than attach one disk from the first vm to this new one by using New-HardDisk and passing the path to the vmdk.

 

The final bit I need is to remove the disk from the first vm so that I can power on the second. I can't work out how to do this with powerCLI, although obviously it's fairly easy using the GUI.

 

Any ideas?

PowerCLI to change network adapter type

$
0
0

Hi all,

very new to PowerCLI..First off, I'm using the vCenter Server Appliance 5.5.0.10300 Build 1945271.. against 5.0 hosts, should I be using the latest PowerCLI? 5.8 I believe, or does it have to match your vc/esx version? I have v5.0 installed of powerCLI

 

I've been trying to find a nice way to change from using the e1000 network adapter to vmxnet3 on various VM's (windows xp/7/2003/2008 and SLES)

 

Stumbled upon a few scripts from here and other sites and did one VM manually.. but I got an error. the Command I used:

Get-VM -name "DCB" | Get-VMGuestNetworkInterface | Set-VMGuestNetworkInterface -ip 172.16.1.21 -Netmask 255.255.248.0 -Gateway 172.16.0.1

 

This part worked, but then an error:

"Error occured while configuring the network:'Failed to configure the DHCP service. The interface may be disconnected. The system cannot find the file specified. At line:1 Char:79"

These are servers with static IP's, but I imagine when the controller is replaced, its doing a DHCP request before I can issue the Set- command, maybe thats why..

 

If there's a better way than what I'm doing, please enlighten.. Thanks! Trying to do this the cleanest way without too much manual intervention on my part.

vmhost/prot-group name/vlan id /Swicth name

$
0
0

get-vmhost xxx |Get-VirtualPortGroup gives me more or less what i need

 

But i am looking for format like this

 

vmhost/prot-group name/vlan id /Swicth name

 

I need this o/p to have include the VMhost name as 1st column & also run for all vmhost in a cluster. Can someone help get this

Why beow script going in infine loop

$
0
0

Hi,

 

Can someone suggest ,Why beow script going in infinite loop

 

$vmhost = get-vmhost -location XXX |foreach

foreach

{

Get-VmhostFirewallException -VMHost $VMHost -Name “VCenter Update Manager“ | Set-VMHostFirewallException -enabled:$true

}

Direct Path VM List

$
0
0

Does anyone know of a way to get a list of VMs that have PCI devices configured on them, or can point me to a tread where it was already talked about?  I searched around and haven't been able to find anything.

Viewing all 14549 articles
Browse latest View live


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