Skip to content

Instantly share code, notes, and snippets.

@krymtkts
Last active October 23, 2022 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krymtkts/47f70697cbe006e81d7fd801e1e3b351 to your computer and use it in GitHub Desktop.
Save krymtkts/47f70697cbe006e81d7fd801e1e3b351 to your computer and use it in GitHub Desktop.
Scripts for VirtualBox. I am not currently using it, but for those who need it.
function Start-VBoxMachine() {
vboxmanage list vms | Select-Pocof -CaseSensitive | Out-String -Stream | Select-String -Pattern '\{(.+)\}' | ForEach-Object { vboxmanage startvm ($_.Matches[0].Groups['1'].Value) --type headless }
}
function Stop-VBoxMachine() {
vboxmanage list runningvms | Select-Pocof -CaseSensitive | Out-String -Stream | Select-String -Pattern '\{(.+)\}' | ForEach-Object { vboxmanage controlvm ($_.Matches[0].Groups['1'].Value) poweroff }
}
function Get-RunningVBoxMachines() {
vboxmanage list runningvms
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment