OBXMAN007's Posts

LucD, once again, a work of art.   Took your code, added saved creds - runs great - hello from years ago.  Yes, LucD is a legend.
Luc - it was very strange - ran without $spec and it ran successfully - latest codes snippet supplied previously seems to be working - you can mark/I will mark as answered - the process of gettin... See more...
Luc - it was very strange - ran without $spec and it ran successfully - latest codes snippet supplied previously seems to be working - you can mark/I will mark as answered - the process of getting the script to work was resulting in inconsistent failures/successes - seems to be working now
Luc - running out of time today - will report back tomorrow - thanks!!
Luc - more info I found an old blurb from you.....see BOTTOM of page/thread  (adding the one line $spec ) http://communities.vmware.com/thread/267514 ........and implemented it on anoth... See more...
Luc - more info I found an old blurb from you.....see BOTTOM of page/thread  (adding the one line $spec ) http://communities.vmware.com/thread/267514 ........and implemented it on another "rev" of a script I had  - added the one line  "$spec"   as shown below........... $tgtDS = $datastore $tgtHost = $vmhost $vm = Get-VM $vmname | Get-View $esx = Get-VMHost $tgtHost | Get-View $parent = $esx.Parent while($parent.Type -ne "Datacenter"){ $parent = (Get-View $parent).Parent } $dc = Get-View $parent $spec = New-Object VMware.Vim.VirtualMachineRelocateSpec $spec.datastore = (Get-Datastore $tgtDS | Get-View).MoRef $spec.host = $esx.MoRef $spec.Pool = (Get-Datacenter $dc.Name | Get-ResourcePool -Name "rpl01_High" | Get-View).MoRef $spec $vm.RelocateVM($spec,"defaultPriority") it is now "working" - yippy!!   - I will test and let you know if I am getting consistent success
re: connectivity - it will work sometimes and fails on other times, even going to same host, so there shouldn't be a port block issue, otherwise it would never work re: ISO - n/a - no connecti... See more...
re: connectivity - it will work sometimes and fails on other times, even going to same host, so there shouldn't be a port block issue, otherwise it would never work re: ISO - n/a - no connection to ISO, etc. re: 64 bit - non-issue - these are 32 bit vms in question re:  using move-vm, do you have any new snazzy code ?  using below I get the error  "a specified parameter was not correct. datastore" import-csv c:\maint.csv | %{ get-vm -name $_.ServerName -Location (get-datacenter "dtc001") | move-vm -Datastore (get-datastore -name "DATASTORE_008") -RunAsync -Confirm:$false } maint.csv contents: ServerName SERVER001 re: using move-vm - I'm getting the old "must be in same datacenter" error: PowerCLI C:\> Move-VM -VM 'SERVER001' -Destination $myhost -Datastore $myds -DiskStorageFormat "Thin" Move-VM : 10/1/2012 1:27:59 PM    Move-VM       Destination container must be in the same Datacenter. At line:1 char:8 + Move-VM <<<<  -VM 'BSS11WP-OPTI' -Destination $myhost -Datastore $myds -DiskStorageFormat "Thin"     + CategoryInfo          : InvalidArgument: (esx07vp.mc.vanderbilt.edu:VMHostImpl) [Move-VM], VimException     + FullyQualifiedErrorId : Client20_VmHostServiceImpl_CheckMoveVmParameters_InvalidDatacenter,VMware.VimAutomation.    ViCore.Cmdlets.Commands.MoveVM
Hi Luc, datastores are separate in the separate datacenters. so I would say they are "not" shared between datacenters vcenter version:  4.1   build:   491557 typical host versions: ... See more...
Hi Luc, datastores are separate in the separate datacenters. so I would say they are "not" shared between datacenters vcenter version:  4.1   build:   491557 typical host versions: Server Name : esx001 Name        : VMware ESXi Version     : 4.1.0 Build       : 800380 FullName    : VMware ESXi 4.1.0 build-800380 ApiVersion  : 4.1 Server Name : esx002 Name        : VMware ESXi Version     : 4.1.0 Build       : 800380 FullName    : VMware ESXi 4.1.0 build-800380 ApiVersion  : 4.1
problem defined: trying to cold migrate vms from one datacenter to another datacenter within same vcenter - no matter what code i try to use, i get an error or "half baked" results - i.e. some vm... See more...
problem defined: trying to cold migrate vms from one datacenter to another datacenter within same vcenter - no matter what code i try to use, i get an error or "half baked" results - i.e. some vms cold migrate, others do not with an error example001: PowerCLI C:\> import-csv c:\maint.csv | %{ get-vm -name $_.ServerName -Location (get-datacenter "dtc001") | move-vm -Datastore (get-datastore -name "DATASTORE_008") -RunAsync -Confirm:$false } maint.csv contents: ServerName SERVER001 error in vcenter: "a specified parameter was not correct. datastore" example002 - using Lucd's relocatevm method: foreach($row in (Import-Csv c:\serverlistmigrate.csv -UseCulture)){ $vm = '' $esx = '' $spec = '' $spec.datastore = '' $spec.host = '' $spec.resourcepool = '' CLS $vmname = $row.vmname $vmhost = $row.vmhost $datastore = $row.datastore $vm = Get-VM -Name $vmname $spec = New-Object VMware.Vim.VirtualMachineRelocateSpec   $spec.datastore = (Get-Datastore -Name $datastore).ExtensionData.MoRef   $spec.pool = (Get-ResourcePool -Name $resourcepool).ExtensionData.MoRef   $spec.host = (Get-VMHost -Name $vmhost).ExtensionData.MoRef   $vmObj = Get-VM -Name $vmname | Get-View   $vmObj.RelocateVM_Task($spec, "defaultPriority") } c:\serverlistmigrate.csv contents: vmname,vmhost,resourcepool,datastore "SERVER001,esxhost07,rpl01_High,DATASTORE_008 error in vcenter: "a specified parameter was not correct. host" **** USING above method, I will get some to migrate, but some fail with same error as above. NEEDED:  All I want is to cold migrate multiple vms from one datacenter to another datacenter (different datastore)  within same vcenter with 100% success - I don't care what method is used - I just need solid, reliable, consistent success. Many thanks in advance!!!! NOTES - POWERCLI VERSION, etc. PowerCLI Version ----------------    VMware vSphere PowerCLI 5.1 Release 1 build 793510 --------------- Snapin Versions ---------------    VMWare AutoDeploy PowerCLI Component 5.1 build 768137    VMWare ImageBuilder PowerCLI Component 5.1 build 768137    VMware License PowerCLI Component 5.1 build 669840    VMware vSphere PowerCLI Component 5.1 build 793489
Does anyone have any nice powercli code that will acknowledge any/all host alarms, thereby negating the admin from having to manually acknowledge alarms, especially when admin knows what is going... See more...
Does anyone have any nice powercli code that will acknowledge any/all host alarms, thereby negating the admin from having to manually acknowledge alarms, especially when admin knows what is going on such as storage changes, etc. ??? Much thanks in advance!!
Thanks Franck - I will check these out Michael
Hello! Thanks to Luc (LucD), I have some starter code that will create vms en masse (see below). In addition though, I need to be able to successfully perform a SYSPREP on the vms once crea... See more...
Hello! Thanks to Luc (LucD), I have some starter code that will create vms en masse (see below). In addition though, I need to be able to successfully perform a SYSPREP on the vms once created (re-SID, etc.. We currently use some xml code in our OScustomizationSpec setup, but I don't know how to make SYSPREP work for server 2008 R2 once the vm has been created. Thanks in advance for any and all assistance: Luc's modified code: $ErrorActionPreference = "SilentlyContinue" $vmhost = Get-vmHost esxhost001.mc.vanderbilt.edu $esxName = $vmhost $modelVm = "WINDOWS_SERVER_2008_R2_X64_THIN" $newVmList = "NEWVM001","NEWVM002","NEWVM003" $taskTab = @{} Create all the VMs specified in $newVmList foreach($Name in $newVmList){ $taskTab = $Name }
Luc, Once again, you solved it - below is my script - worked like a charm - now I can answer the question en masse: script: Get-VM | ` ForEach ( $_ ) { $vm = $_ Write-Host "Answ... See more...
Luc, Once again, you solved it - below is my script - worked like a charm - now I can answer the question en masse: script: Get-VM | ` ForEach ( $_ ) { $vm = $_ Write-Host "Answering Question for VM..." $vm.Name -ForegroundColor Yellow Get-VMQuestion -QuestionText "you move this" | Set-VMQuestion -Option "moved" -Confirm:$False } Thanks!!!
Hi Luc, I will give that a try - haven't used that before - it might work - thanks again.
Thanks for the response - I used your code and the vms remained in virtualcenter with orphaned in italics.
Hi! Below is the simple script I use to power on all vms on a specific host. I am using this script currently after migrating vms from 3.x to 4.x. After running script, I am prompted on ... See more...
Hi! Below is the simple script I use to power on all vms on a specific host. I am using this script currently after migrating vms from 3.x to 4.x. After running script, I am prompted on each vm to verify what happened to vm, etc.(in vcenter) which forces me to have to manually answer the question for each vm. Is there a way to programmatically answer the prompt by powering on with a certain command line switch or parameter, etc. ? Specifically, I always want to select the response "I_moved it". script: $allvms = Get-VM $allvms | Start-VM -RunAsync -Confirm:$false | Out-Null Write-Host "COMPLETE: All Servers Are Powered ON" -ForegroundColor Yellow
Thanks for the response. However: a) I should be able to remove from inventory while connected to a host - any changes should be communicated to vcenter in background just as all other scrip... See more...
Thanks for the response. However: a) I should be able to remove from inventory while connected to a host - any changes should be communicated to vcenter in background just as all other scripts that I run do and work fine and changes are reflected in vcenter. b) I simply want to remove from inventory, not delete the vm from disk. Again, thanks for the response, but I would like a clean method for removing vms from a host without them showing up as orphaned.
Hi! I use the following script to remove vms from inventory from a currently connected host - after running script, all vms show up as ORPHANED in virtual center. host is 3.5x - I think th... See more...
Hi! I use the following script to remove vms from inventory from a currently connected host - after running script, all vms show up as ORPHANED in virtual center. host is 3.5x - I think this happens on 4.x U1 as well anyone know how to fix ? Thanks in advance!! script: cls c: cd \ $ErrorActionPreference = "SilentlyContinue" $allvms = Get-VM $host = Get-VMHost foreach ($vm in $allvms) { Write-Host "Removing VM" $vm "from Host Inventory" -ForegroundColor Yellow #Remove-VM -VM $vm -Server $host -Confirm:$false Remove-Inventory -Item $vm -Confirm:$false }
Hi Luc, Your code worked beautifully and perfectly the first time. I found bits of code here and there but nothing definitive and concise as you provided. I don't say it lightly when I s... See more...
Hi Luc, Your code worked beautifully and perfectly the first time. I found bits of code here and there but nothing definitive and concise as you provided. I don't say it lightly when I say........Luc ROCKS THE PLANET!!!! Thanks a million. M.
Hello, I am trying to accomplish TWO things:: vswitch: vSwitch0 portgroups: pgvVMOTION, Service Console I have two vmnics on vSwitch0: vmnic0 and vmnic2 FIRST: I need... See more...
Hello, I am trying to accomplish TWO things:: vswitch: vSwitch0 portgroups: pgvVMOTION, Service Console I have two vmnics on vSwitch0: vmnic0 and vmnic2 FIRST: I need to use powercli to set both of the vmnics as ACTIVE. SECOND: I need to be able to select "Override switch failover order" ...AND... for port group pgvVMOTION set priority of vmnics as: vmnic0 first, vmnic2 as second, in that order ...and then flip it for port group "Service Console" ... I need to set vmnic2 as first and vmnic0 as second , in that order. I have found bits of code out there related to this, but couldn't put it all together. Many thanks in advance!!!
Hi Luc, Luc you ROCK THE PLANET. The code worked perfectly. Thanks very much!!!! OBXMAN007
Does anyone know how to "Enable NFS" using powercli? This is found in vcenter under Configuration - Security Profile Thanks in advance!!