Skip to content

Instantly share code, notes, and snippets.

View arr2036's full-sized avatar

Arran Cudbard-Bell arr2036

View GitHub Profile
@jpluimers
jpluimers / esxi-suspend-all-VMs.sh
Last active November 16, 2023 01:36
vmware console command to suspend all VMs that are not yet suspended and waits until they all are suspended
#!/bin/sh
# https://wiert.me/2021/04/30/vmware-esxi-console-viewing-all-vms-suspending-and-waking-them-up-part-5/
RUNNING=0
vmids=`vim-cmd vmsvc/getallvms | sed -n -E -e "s/^([[:digit:]]+)\s+((\S.+\S)?)\s+(\[\S+\])\s+(.+\.vmx)\s+(\S+)\s+(vmx-[[:digit:]]+)\s*?((\S.+)?)$/\1/p"`
for vmid in ${vmids} ; do
# echo "Probing VM with id: $vmid."
powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`
name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/\(vim.vm.ConfigInfo\) \{/,/files = \(vim.vm.FileInfo\) \{/ s/^ +name = "(.*)",.*?/\1/p'`
vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = \(vim.vm.FileInfo\) \{/,/tools = \(vim.vm.ToolsConfigInfo\) \{/ s/^ +vmPathName = "(.*)",.*?/\1/p'`
# echo "VM with id ${vmid} has power state ${powerState} (name = ${name}; vmPathName = ${vmPathName})."
@jaseg
jaseg / README.md
Last active March 26, 2024 14:21
Convert openldap .schema files to .ldif files

This is old!

Hey there,

occassionally, people still seem to stumble across this script because it seems it shows up in some search results. Please be aware that I made this script ten years ago, and by now, there is probably a better way to achieve the same result.

Have a nice day!