Mostrando entradas con la etiqueta PowerCLI. Mostrar todas las entradas
Mostrando entradas con la etiqueta PowerCLI. Mostrar todas las entradas

27 abril 2015

vRealize Operations Manager 6 - Part V - Create Custom Groups with vSphere Tags


One of the best vROps (old vCOps) features is the option to create custom groups where you can define the criteria membership and apply a policy rule to them.

There is a lot of environments where the Virtual Machines are not properly configured and defined, with the vSphere Folders or inventory VM names, no naming convention, etc.... 
Is here where the "vSphere Tags" win the game! You can easily tag your VMs!  ..use PowerCLI!!!! (next post incoming)

Imagine that you need to create a policy rule and a Custom Group but your VMs in vSphere are not organized...  Are you thinking in add one-by-one to a Custom Group? and what if tomorrow you add new VMs? ...manually adding Vms is not a good idea, so try to tag your VMs when you create it on the vSphere environment and keep it updated with your CMDB database.

But, how to tag your environment properly?  First of all, you "must" have clear the tags you want to add and how to categorize it.  Just an example, filter you DDBB Vms  (SQL, Oracle, MongoDB, etc) or filter by App Vms, or Bckp environment, or AV environment... and so on.....

Once you have your VMs tagged, you can create a custom group as shown below:






See previous Part I    -vRealize Operations Manager 6 - Part I - OVA deployment
See previous Part II   - vRealize Operations Manager 6 - Part II - Express Installation
See previous Part III  - vRealize Operations Manager 6 - Part III - Manage Solution
See previous Part IV  - vRealize Operations Manager 6 - Part IV -  How import LDAP users

Related with:  VMware vSphere: how to create tags - Part I


20 abril 2015

VMware vSphere: how to create tags - Part II with PowerCLI

On the Part I post we learn how to add a Tag and a Category trough the GUI interface with vSphere Web Client, now, let´s take a look about how to do it with PowerCLI.


Remember that Tags are a new feature available from vSphere 5.1 and the cmdlets are available from PowerCLI 5.5, so, we need at least a vCenter on vSphere 5.1 and the PowerCLI 5.5 installed but much better use las version PowerCLI 6 (not all cmdlets are present in PowerCLI 5.5 initial release)

Use this to verify the version you have installed: 
PowerCLI C:\> Get-VIToolkitVersion


Now with the New-Tag we can review the Tags configured, and with "New-TagCategory" create a Category and after with "New-Tag" the Tag



Now, we are ready to assign Tags to objects, in this case to Virtual Machine:


It´s time to verify it trough Web Client:





Something i didn´t mention jet, is that you can assign multiple Tags to an objet in vSphere , in our case to a Virtual Machine. It means that you can for example tag a VM with the "DDBB_tag" because it´s a SQL DDBB, and Tag it with "Cluster_tag" because it´s a Microsoft Cluster, or with another tag like "Test_tag" because it´s a DDBB SQL Cluster from the Lab Environment.

Why multiple Tags? For vROps it will be useful to create custom groups using different Tags criteria and fix different policies if its a VM from DDBB servers, or if its a VM from Lan Environment..... one VM could be placed in different Custom Groups at the same time :-)


First Part of this post: VMware vSphere: how to create tags - Part I



15 abril 2015

VMware vSphere: how to create tags - Part I

What is a tag?

A tag is a label that you can apply to objects in the vSphere inventory. Tags allow you to attach metadata to objects to make them more sortable and searchable.

Tags are grouped into categories, which define how the tags can be applied to inventory objects.


What is a category?

A category groups together related tags in the vCenter Server inventory.
When you create a category, you specify whether multiple tags in that category can be assigned to a given object at one time, or whether only one tag can be assigned to an object at a time. For example, a category called Priority might contain the tags High, Medium, and Low, and be configured to allow only one tag in the category to be applied to an object at a time.

You also specify whether tags in a category can be applied to all objects, or only to specific object types, such as hosts or datastores.


...yes, this is just a Copy&Paste from the original explanation from tags and categories on the VMware documentation....but i´m sure that no one read it...or at least...just a few docu-addicts :-)

Once we have a crystal clear the idea about what Tags and Category are....let´s show how to create them:

continue reading....

05 septiembre 2013

Visual ESXTOP GUI for VMware

The VMware visualESXTOP is a tool from the VMware Labs to view in windows-mode (hehehe) the results of the cli command ESXTOP and with a friendly option to generate some graphics

1- Download it from: http://labs.vmware.com/flings/visualesxtop  and unzip files:



2- Change PATH on the System Properties - Advanced System Settings - Advanced - Environmet Variables - System Variables: "PATH=C:\Program Files (x86)\Java\jre6\bin;
(Be carefull with this changes , and backup all the the info you modify for a restore case)


3- Start from CMD or click on the "visualEsxtop.bat" and connect to a ESX host or to a vCenter Server from Menu; File - Connect to Live-server, or start it from powercli:




This will open a new window with the GUI:

Now, you can review al the metrics from the diferents tabs:

...And generate some graphics , for example de% CPU ready:





.

27 marzo 2013

Adding NTP server with POWERCLI


>Add NTP Server:
Get-VMHost -Name * | Add-VmHostNtpServer -NtpServer "ntp-server"

>Restart NTP service:
Get-VMHostService * | Where-Object {$_.key -eq "ntpd"} | Restart-VMHostService -Confirm:$false

>Set NTP to start and stop with the host (policy ON):
Get-VMHost * | Get-VMHostService |  where {$_.Key -eq "ntpd"} | Set-VMHostService -Policy On


25 marzo 2013

Disable VAAI with POWERCLI


Concept : "VMware vSphere® Storage APIs – Array Integration (VAAI), also referred to as hardware acceleration or hardware offload APIs, are a set of APIs to enable communication between VMware vSphere ESXi™ hosts and storage devices." kb.vmware.com/kb/1021976

VERIFY VAAI STATUS:
Get-VMHost * -Name | Get-VMHostAdvancedConfiguration -Name DataMover*, VMFS3.HardwareAcc*

DISABLE VAAI (3 parameters)
Set-VMHostAdvancedConfiguration -VMHost * -Name DataMover.HardwareAcceleratedMove -Value 0 
Set-VMHostAdvancedConfiguration -VMHost * -Name DataMover.HardwareAcceleratedInit -Value 0
Set-VMHostAdvancedConfiguration -VMHost * -Name VMFS3.HardwareAcceleratedLocking -Value 0

Enable SSH with POWERCLI


VERIFY SSH STATUS:
Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } |select VMHost, Label, Running

ENABLE SSH:
Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} )}

DISABLE WARNING SSH:
Get-VMhost * | Set-VMHostAdvancedConfiguration UserVars.SuppressShellWarning 1


Image by http://vninja.net/

15 enero 2013

VMware Powercli: obtener info de maquinas virtuales desde una lista en txt


En ocasiones necesitamos obtener información de algunas maquinas virtuales de uno o varios vCenter (o ESXi) desde una lista en un simple fichero de texto.
Para esto, podemos declarar primero una variable que lista esas maquinas virtuales desde el fichero de texto y luego lanzar el comando (cmdlet) con el que obtener la info. En este ejemplo, obtenemos las direcciones
 ip´s  de una serie de maquinas virtuales:

Pirmero, declaramos la variable vms listando el contenido de un txt:

$vms = Get-Content lista_de_maquinas.txt  

Ahora, lanzamos el comando con un get-vm de la variable declarada antes:

get-vm $vms | select Name,@{N="IP Address";E={@($_.guest.IPAddress)}}

.

25 enero 2012

#VMware #vSphere #PowerCLI: consultar si las VM sincronizan con el host #ESXi (Synchronize guest time with host)


Para consultar si las VM de nuestro vCenter o Host tienen el check marcado para sincronicen la hora con el propio host donde esten inventariadas, podemos consultarlo en modo grafico a traves de las propias tools de la mv, o desde las settings de la VM (Synchronize guest time with host)


Pero cuando tenemos muchas mv´s, el mejor modo es realizarlo es mediante PowerCLI y estos sencillos scripts:

Con este listas las VM que No tiene el check marcado para sincronizar con el host:

get-vm |where { ( %{ get-view $_.Id } | where { $_.Config.Tools.SyncTimeWithHost -ne "True" } ) } | select name


Con este otro listas lasVM que SI tienen el check marcado para sincronizar con el host:

get-vm |where { ( %{ get-view $_.Id } | where { $_.Config.Tools.SyncTimeWithHost } ) } | select name




14 enero 2012

Nuevo update de PowerCLI 5.0.1 con cmdlets para vCloud Director

Esta nueva release contiene por primera vez, cmdlets para automatizar operaciones de VMware vCloud Director 1.5





El clásico error al iniciar PowerCLI se produce por no tener habilitada la política para habilitar scripts como en el pantallazo siguiente que se soluciona ejecutando "set-ExecutionPolicy RemoteSigned"



"No se puede cargar el archivo C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1 porque en el sistema está deshabilitada la ejecución de scripts. Vea "get-help about_signing" para obtener más información.
En línea: 1 Carácter: 2+ . <<<<  "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Script
s\Initialize-PowerCLIEnvironment.ps1"
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
PS C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> set-ExecutionPolicy RemoteSigned
Cambio de directiva de ejecución
La directiva de ejecución le ayuda a protegerse de scripts en los que no confía. Si cambia dicha directiva podría exponerse a los riesgos de seguridad descritos en el tema de la Ayuda about_Execution_Policies. ¿Desea cambiar la directiva de ejecución?
[S] Sí  [N] No  [U] Suspender  [?] Ayuda (el valor predeterminado es "S"): s
PS C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>











09 enero 2012

Cambiar "Network Adapter Type" en #vSphere con PowerCLI

Una vez creada una mv no se puede cambiar el tipo de adaptador a las tarjetas de red mediante el entorno grafico. Para hacer esta operacion primero debemos apagar la mv y luego cambiar por PowerCLI el tipo de adaptador. Eso si, es mas que probable que perdamos la configuracion de las tarjetas de red, con lo que sera necesario anotar las ip´s de estas antes de hacer cualquier cambio.

Estos serian los pasos para cambiar varias tarjetas E1000 a VMXNET3, primero nos conectamos al vCenter, listamos las tarjetas de red y despues lanzamos el cambio del tipo de adaptador, nos preguntara tarjeta por tarjeta si que queremos cambirlar...y voila!!!

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

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> 
get-vm MVTEST01 | get-networkadapter

Name                 Type       NetworkName  MacAddress         WakeOnLan
                                                                  Enabled
----                 ----       -----------  ----------         ---------
Network adapter 1    e1000      RED_VLAN1 -... 00:50:56:93:75:11       True
Network adapter 2    e1000      RED_VLAN2... 00:50:56:93:75:22       True
Network adapter 3    e1000     RED_VLAN13... 00:50:56:93:75:33    True


PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>
get-vm MVTEST01 | get-networkadapter | set-networkadapter -type "vmxnet3"

Confirmar
¿Está seguro de que desea realizar esta acción?
Se está realizando la operación "Setting Type: Vmxnet3" en el destino "Network
adapter 1".
[S] Sí  [O] Sí a todo  [N] No  [T] No a todo  [U] Suspender  [?] Ayuda
(el valor predeterminado es "S"):s

Confirmar
¿Está seguro de que desea realizar esta acción?
Se está realizando la operación "Setting Type: Vmxnet3" en el destino "Network
adapter 2".
[S] Sí  [O] Sí a todo  [N] No  [T] No a todo  [U] Suspender  [?] Ayuda
(el valor predeterminado es "S"):s

Confirmar
¿Está seguro de que desea realizar esta acción?
Se está realizando la operación "Setting Type: Vmxnet3" en el destino "Network
adapter 3".
[S] Sí  [O] Sí a todo  [N] No  [T] No a todo  [U] Suspender  [?] Ayuda
(el valor predeterminado es "S"):s

Name                 Type       NetworkName  MacAddress         WakeOnLan
                                                                  Enabled
----                 ----       -----------  ----------         ---------
Network adapter 1    Vmxnet3    RED_VLAN1-... 00:50:56:93:75:11       True
Network adapter 2    Vmxnet3    RED_VLAN2... 00:50:56:93:75:22       True
Network adapter 3    Vmxnet3    RED_VLAN3... 00:50:56:93:75:33       True


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


11 marzo 2011

VMware vSphere PowerCLI 4.1.1 ...corregido!!!

Pues si, el famoso porster del PowerCLI por fin corregido y actualizado: VMware vSphere PowerCLI 4.1.1
 


Pero si os quedais con ganas....en breve estar disponible el Powerclibook:   "The book will be releasing from our warehouses on March 28th which means that books should reach stores/resellers a week later."