Removing parameters from multiple VMX files

Had a customer who wanted to remove parameters from multiple VMX files. The parameters were added in by vShield and we were unable to power on the VM Wrote the following script to search and remove the parameter for all the VMs registered on each ESXi host: vmlist=`hostname`.vmlist grep -i vmx /etc/vmware/hostd/vmInventory.xml | sed 's///g' | sed 's/<\/vmxCfgPath>//g' > $vmlist for i in `cat $vmlist` do echo " " echo Filename:$i echo Backing up VMX....

April 5, 2012 · 1 min · Jahnin Rajamoni

Adding the same annotations to multiple vmx files?

Here is a script you can run on the ESXi host to add an annotation into multiple vmx files: SAVEIFS=$IFS IFS=$(echo -en "\\n\\b") for i in \`find /vmfs/volumes/ -name \*.vmx\` do echo Filename:$i echo Backing up VMX... cp $i $i.bak echo Backup complete... echo adding the annotation: echo "annotation = \\"<Fill the annotation text here without the angle braces>\\"" >> $i echo Update done... read -p "Hit any key to continue....

October 18, 2011 · 1 min · Jahnin Rajamoni

Script to modify a parameter in multiple files

I had to change the svga.vramsize paramter across multiple vmx files on multiple datastores. So here is how i got it done: SAVEIFS=$IFS IFS=$(echo -en "\n\b") for i in `grep -l -i ‘svga.vramSize = "40968192"’ /vmfs/volumes/*/*/*.vmx` do echo Filename:$i echo Backing up VMX... cp $i $i.bak echo Backup complete... echo Current Parameter: grep -i svga.vramsize $i echo Updating VMX... sed -i 's/svga.vramSize = "40968192"/svga.vramSize = "31457280"/g' $i echo Update done... echo New Parameter: grep -i svga....

October 18, 2011 · 1 min · Jahnin Rajamoni

System information in Linux?

What is the equivalent of msinfo32 in Linux? lshw For PCI devices? lspci For USB devices? lsusb For listing files :D ls To find whether you are running on a 64 bit or 32 bit kernel? uname -m "x86\_64" is returned for a 64bit OS

July 23, 2011 · 1 min · Jahnin Rajamoni

Secure Copy

Secure Copy or scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. Syntax to copy a file from one linux host to another host that has ssh enabled: scp -v [path to local file] [remote server username]@[hostname/IP]:/[Destination Folder Path] ``` For e.g.: ``` scp -v /tmp/test.txt root@192.168.1.2:/root/ ```

May 11, 2011 · 1 min · Jahnin Rajamoni