mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
Add files via upload
This commit is contained in:
parent
d0df086ea5
commit
cb732019d7
32
VIRTBOX/vbox-discover-vms.ps1
Normal file
32
VIRTBOX/vbox-discover-vms.ps1
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<# Discover virtualbox vms in dir and add them to gui #>
|
||||||
|
<# 2023.Nov kingneutron #>
|
||||||
|
<# Adapted from bash code #>
|
||||||
|
|
||||||
|
# TODO EDITME for where your VMs live
|
||||||
|
D:
|
||||||
|
cd virtbox-vms
|
||||||
|
|
||||||
|
$vbm="C:\Program Files\Oracle\VirtualBox\vboxmanage.exe"
|
||||||
|
$result=get-childitem -Recurse *.vbox
|
||||||
|
|
||||||
|
# $result.fullname
|
||||||
|
# D:\virtbox-vms\almalinux-test-centos-replacement-rhel8\almalinux-test-centos-replacement-rhel8.vbox
|
||||||
|
|
||||||
|
foreach ($thisvm in $result.fullname) {
|
||||||
|
Write-Output $thisvm
|
||||||
|
& $vbm registervm $thisvm
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
& $vbm list vms
|
||||||
|
get-date
|
||||||
|
Write-Output "Recommended to run vbox-registerISOs now"
|
||||||
|
|
||||||
|
<#
|
||||||
|
$result
|
||||||
|
Directory: D:\virtbox-vms\XPvm
|
||||||
|
|
||||||
|
Mode LastWriteTime Length Name
|
||||||
|
---- ------------- ------ ----
|
||||||
|
-a--- 4/6/2023 2:39 PM 11447 XPvm.vbox
|
||||||
|
#>
|
42
VIRTBOX/vbox-registerISOs-2dirs.ps1
Normal file
42
VIRTBOX/vbox-registerISOs-2dirs.ps1
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<# Register known ISOs to virtualbox media manager #>
|
||||||
|
<# 2023.Nov kingneutron #>
|
||||||
|
<# Adapted from bash code #>
|
||||||
|
<# dont know why, but the Samba mount dir currently doesnt work #>
|
||||||
|
|
||||||
|
$vmname="dummyisofinder"
|
||||||
|
|
||||||
|
# xxx TODO EDITME
|
||||||
|
$vmdir="D:\virtbox-vms"
|
||||||
|
$isodir="D:\ISO"
|
||||||
|
$isodir2="Z:\ISO" # NAS / network mount
|
||||||
|
|
||||||
|
$vbm="C:\Program Files\Oracle\VirtualBox\vboxmanage.exe"
|
||||||
|
|
||||||
|
& $vbm createvm --name "$vmname" --ostype 'Linux_64' --basefolder "$vmdir" --register
|
||||||
|
& $vbm modifyvm "$vmname" --description "NOTE this is just a temp VM used to conveniently register ISOs"
|
||||||
|
|
||||||
|
& $vbm storagectl "$vmname" --name IDE --add ide --controller piix3 --portcount 2 --bootable on
|
||||||
|
#VBoxManage storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium emptydrive #"X:\Folder\containing\the.iso"
|
||||||
|
#VBoxManage showvminfo "$vmname"
|
||||||
|
|
||||||
|
cd $isodir
|
||||||
|
|
||||||
|
# Define complex array
|
||||||
|
$result=[System.Collections.ArrayList]@()
|
||||||
|
|
||||||
|
$result=get-childitem -Recurse *.iso
|
||||||
|
|
||||||
|
cd $isodir2
|
||||||
|
$result+=get-childitem -Recurse *.iso
|
||||||
|
|
||||||
|
Write-Output $result.fullname
|
||||||
|
# brkpt
|
||||||
|
|
||||||
|
foreach ($thisiso in $result.FullName) {
|
||||||
|
Write-Output "$thisiso"
|
||||||
|
& $vbm storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium "$thisiso"
|
||||||
|
# VBoxManage modifyvm $vmname --dvd $PWD/${this}
|
||||||
|
}
|
||||||
|
|
||||||
|
# eject
|
||||||
|
& $vbm storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium emptydrive
|
30
VIRTBOX/vbox-registerISOs.ps1
Normal file
30
VIRTBOX/vbox-registerISOs.ps1
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<# Register known ISOs to virtualbox media manager #>
|
||||||
|
<# 2023.Nov kingneutron #>
|
||||||
|
<# Adapted from bash code #>
|
||||||
|
|
||||||
|
$vmname="dummyisofinder"
|
||||||
|
|
||||||
|
# xxx TODO EDITME
|
||||||
|
$vmdir="D:\virtbox-vms"
|
||||||
|
$isodir="D:\ISO"
|
||||||
|
|
||||||
|
$vbm="C:\Program Files\Oracle\VirtualBox\vboxmanage.exe"
|
||||||
|
|
||||||
|
& $vbm createvm --name "$vmname" --ostype 'Linux_64' --basefolder "$vmdir" --register
|
||||||
|
& $vbm modifyvm "$vmname" --description "NOTE this is just a temp VM used to conveniently register ISOs"
|
||||||
|
|
||||||
|
& $vbm storagectl "$vmname" --name IDE --add ide --controller piix3 --portcount 2 --bootable on
|
||||||
|
#VBoxManage storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium emptydrive #"X:\Folder\containing\the.iso"
|
||||||
|
#VBoxManage showvminfo "$vmname"
|
||||||
|
|
||||||
|
cd $isodir
|
||||||
|
$result=get-childitem -Recurse *.iso
|
||||||
|
|
||||||
|
foreach ($thisiso in $result.FullName) {
|
||||||
|
Write-Output $thisiso
|
||||||
|
& $vbm storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium $thisiso
|
||||||
|
# VBoxManage modifyvm $vmname --dvd $PWD/${this}
|
||||||
|
}
|
||||||
|
|
||||||
|
# eject
|
||||||
|
& $vbm storageattach "$vmname" --storagectl IDE --port 0 --device 0 --type dvddrive --medium emptydrive
|
Loading…
x
Reference in New Issue
Block a user