This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Script de Powershell para cambiar el Computer Name de un host Windows ## | |
| ## De acuerdo al archivo YML, este archivo debe de encontrarse en la ruta "/etc/ansible/posh/" ## | |
| param( | |
| [string]$user, | |
| [string]$password, | |
| [string]$hostname | |
| ) | |
| $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force | |
| $cred = New-Object System.Management.Automation.PSCredential ($user, $secpasswd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - name: Nueva VM, instala Apache y envia notificacion a Slack | |
| hosts: localhost | |
| user: root | |
| sudo: true | |
| ## Prompt que nos pregunta como queremos llamar a la nueva maquina virtual | |
| vars_prompt: | |
| - name: "guest" | |
| prompt: "Nombre VM?" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - name: Configurar Loggly rsyslog | |
| hosts: loggly | |
| remote_user: root | |
| sudo: true | |
| vars_prompt: | |
| - name: "account" | |
| prompt: "Loggly account?" | |
| private: no |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Auditoria de versiones de VMware Tools (KB2115997) ## | |
| ## Script crea archivo CSV que deposita en la ruta c:\temp\ ## | |
| ## Debe de estar creada previamente la carpeta c:\temp ## | |
| ## Audita solo las VMs ENCENDIDAS con SO Windows ## | |
| ## Buscamos estas versiones de VMware Tools | |
| # 8.6.15 | |
| # 9.0.15 | |
| # 9.4.11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $datastores = Get-Datastore | |
| foreach ($ds in $datastores) { | |
| Get-Datastore $ds | Get-Stat -Stat disk.used.latest -Start (Get-Date).adddays(-90) -Finish (Get-Date) | Export-Csv "c:\temp\datastores\$ds.csv" | |
| } | |
| Get-Datastore | Export-Csv "c:\temp\datastores\TODOS.csv" | |
| $hosts = Get-VMHost | |
| foreach ($esx in $hosts) { | |
| Get-VMHost $esx | Get-Stat -Stat cpu.usage.average -Start (Get-Date).adddays(-90) -Finish (Get-Date) -IntervalMins 1440 | Where{$_.instance -eq ""} | Export-Csv "c:\temp\hosts\CPU-$esx.csv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################## | |
| ## Reporte Alarmas generadas en vCenter ## | |
| ########################################## | |
| ## Nota 1: Necesita existir previamente la ruta "c:\temp\" | |
| ## Nota 2: Unicamente reporta errores y warnings | |
| ## Nota 3: Las variables preconfiguradas del script suponen la creacion | |
| ## de un reporte con las alarmas de "1" día previo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######################################### | |
| ## Reporte utilización VMs por horario ## | |
| ######################################### | |
| ## Nota 1: Los contadores "virtualDisk.numberReadAveraged.average" y | |
| ## "virtualDisk.numberWriteAveraged.average" requieren tener configurado | |
| ## el nivel "2" del Statistics Level en vCenter Server. | |
| ## Nota 2: Necesita existir previamente la ruta "c:\temp\" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## vSphere 5.5 + Veeam 8 | |
| ## Aqui y ahora =) | |
| $tiempo = Get-Date | |
| ## Buscamos en las ultimas 24 horas todas las VM creadas u OVA/OVF "deployed" | |
| $nuevasVM1 = Get-VIEvent -Start $tiempo.AddDays(-1) | where {$_.FullFormattedMessage -like "*created virtual machine*"} | |
| $nuevas1 = $nuevasVM1.Vm.Name | |
| ## Agregamos al job de respaldo $MiJob las VMs encontradas | |
| foreach ($vm1 in $nuevas1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Variables de columna "Estado" ## | |
| $on = "Encendida" | |
| $off = "Apagada" | |
| ## Genera una lista de VM en todos los Jobs de respaldo (backup) ## | |
| $jobs = get-vbrjob | where {$_.jobtargettype -eq "backup"} | |
| $protected = $jobs.getobjectsinjob() | |
| $vmresp = $protected.name | |
| ## Crea la tabla con las VMs que no aparecen en la lista de VMs protegidas en alguno de los Jobs ## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $MyVMs = Get-VM | |
| foreach($VM in $MyVMs){ | |
| Get-VM $VM |Get-HardDisk | | |
| Format-Table @{Name="VM";Expression={$_.Parent};a="left"}, | |
| @{Name="Disco";Expression={$_.name};a="left"}, | |
| @{Name="Capacidad GB";Expression={"{0:N1}" -f $_.CapacityGB};a="right"}, | |
| @{Name="Formato";Expression={if ($_.StorageFormat -eq 'Thin') { "Thin" } else { "Thick" }};a="center"}, | |
| @{Name="RDM";Expression={if ($_.ExtensionData.backing.LunUuid -ne $null) { "Si" } else { "No" }};a="center"}, | |
| @{Name="Independiente";Expression={if ($_.Persistence -eq 'Persistent') { "No" } else { "Si" }};a="center"}, | |
| @{Name="Persistente";Expression={if ($_.Persistence -eq 'IndependentPersistent' -or 'Persistent') { "Si" } else { "No" }};a="center"}, |