Skip to content

Instantly share code, notes, and snippets.

View lrivallain's full-sized avatar
🏠
Working from home

Ludovic Rivallain lrivallain

🏠
Working from home
View GitHub Profile
@lrivallain
lrivallain / TemplatesVmxUpdater.ps1
Created May 12, 2014 12:55
PowerCli - Mise à jour du VMX de templates de machines virtuelles
# load PowerCli Snapin
if ((Get-PSSnapin -Name VMware.Vimautomation.Core -ErrorAction SilentlyContinue) -eq $null ) {
Add-PsSnapin VMware.Vimautomation.Core
}
# vCenter server
$VC = "monvcenter.domain.tld"
$Username = "domain\monuser"
# connecting vCenter
@lrivallain
lrivallain / .bash_profile
Last active August 29, 2015 14:01
My custom dotfiles (⇨ ~/)
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
# Bash completion
@lrivallain
lrivallain / dockersshrc.sh
Last active January 16, 2017 16:31
dockerssh (easy ssh to a docker container)
##################################################
## Add the following lines to your .bashrc file ##
##################################################
# change terminal title (usefull for graphical ones)
# Usage:
# settitle "my beautifull title"
settitle(){
echo -n -e "\033]0;$1\007"
}
@lrivallain
lrivallain / extend.sh
Last active August 29, 2015 14:03
Extend a logical volume (LVM/Ext3)
lvextend -L8G /dev/mapper/rootvg-opt_lv
umount /opt/
e2fsck -f /dev/mapper/rootvg-opt_lv
resize2fs /dev/mapper/rootvg-opt_lv
mount -a
@lrivallain
lrivallain / addDatastoreToESXiCluster.ps1
Last active August 29, 2015 14:04
Add a new datastore to a set of ESXi based on cluster membership
Add-PSSnapin VMware.VimAutomation.Core
$vcenter='127.0.0.1'
$cluster='A_cluster_name'
$datastorename='A_datastore_name'
$nfshost='10.0.0.1'
$nfspath='/vol/a_vol_name/a_qtree'
Connect-VIServer $vcenter
Get-Cluster -Name $cluster | Get-VMHost | New-Datastore -Nfs -Name $datastorename -Path $nfspath -NfsHost $nfshost
@lrivallain
lrivallain / GuestInfoCustomization.ps1
Last active August 8, 2016 03:13
This script inserts guestinfo to a VM configuration parameters. "guestinfo" settings can be read from Guest OS in order to customize network settings for example.
# load PowerCli Snapin
if ((Get-PSSnapin -Name VMware.Vimautomation.Core -ErrorAction SilentlyContinue) -eq $null ) {
Add-PsSnapin VMware.Vimautomation.Core
}
# vCenter server
$VC = "vcenter.domain"
$Username = "domain\user"
# connecting vCenter
@lrivallain
lrivallain / ics-notifier.conf.json
Last active August 27, 2015 16:38
A simple ICS events notifier by email
{
"url": "http://an/ics/file/uri.ics",
"mailfile": "/tmp/ics-notifier.email.txt",
"subject": "Évènement",
"tzone": "Europe/Paris",
"mails": [
"email1@example.com",
"email2@example.com"
]
}
@lrivallain
lrivallain / 5.5_resetInventoryServiceDb.sh
Last active August 19, 2016 09:56
VMware | vcenter appliance - reset inventory service database
#### Configure
VCIP="10.0.0.1"
####
# stop IS service
service vmware-inventoryservice stop
# remove old DB
rm -rf /storage/db/inventoryservice/data
# create new DB
/usr/lib/vmware-vpx/inventoryservice/scripts/ds-invoke.sh -Dvim.logdir=/var/log/vmware/vpx/inventoryservice com.vmware.vim.dataservices.CreateDb /storage/db/inventoryservice/data changeme default changeme
<#
.SYNOPSIS
Windows 8 and Windows 2012 Server or later virtual machines fail upon reboot (2092807)
https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2092807
Resolution: To _work around_ this issue, update the VM advanced configuration to add monitor_control.enable_softResetClearTSC = TRUE
.NOTES
Author : Ludovic Rivallain
Version : 1.0
### Keybase proof
I hereby claim:
* I am lrivallain on github.
* I am lrivallain (https://keybase.io/lrivallain) on keybase.
* I have a public key whose fingerprint is CBF2 D0FF 5BDF 1CF8 5094 4C05 C6BE 80D9 44DB 4587
To claim this, I am signing this object: