Skip to content

Instantly share code, notes, and snippets.

@kewalaka
Created June 20, 2020 21:35
Show Gist options
  • Save kewalaka/84f7137ee4ed8b83e53ab0a886235e53 to your computer and use it in GitHub Desktop.
Save kewalaka/84f7137ee4ed8b83e53ab0a886235e53 to your computer and use it in GitHub Desktop.
This is an example of how to change the output of poshgui to also work on PS7 (maintaining compatibility with earlier versions of PS)
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
VMWare VM Create
.SYNOPSIS
Create VMWare VM's quickly and easily with this great GUI
.DESCRIPTION
Create VMWare VM's quickly and easily with this great GUI
#>
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$VMCreator = New-Object system.Windows.Forms.Form
$VMCreator.ClientSize = New-Object System.Drawing.Point(645,727)
$VMCreator.text = "VMWare VM Creator"
$VMCreator.TopMost = $false
$VMNameTextBox = New-Object system.Windows.Forms.TextBox
$VMNameTextBox.multiline = $false
$VMNameTextBox.width = 197
$VMNameTextBox.height = 20
$VMNameTextBox.location = New-Object System.Drawing.Point(126,238)
$VMNameTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMNameLabel = New-Object system.Windows.Forms.Label
$VMNameLabel.text = "VM Name"
$VMNameLabel.AutoSize = $true
$VMNameLabel.width = 200
$VMNameLabel.height = 10
$VMNameLabel.location = New-Object System.Drawing.Point(50,241)
$VMNameTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RAMinGBTextBox = New-Object system.Windows.Forms.TextBox
$RAMinGBTextBox.multiline = $false
$RAMinGBTextBox.text = "4"
$RAMinGBTextBox.width = 100
$RAMinGBTextBox.height = 20
$RAMinGBTextBox.location = New-Object System.Drawing.Point(127,328)
$RAMinGBTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMRAMinGBLabel = New-Object system.Windows.Forms.Label
$VMRAMinGBLabel.text = "Ram In GB"
$VMRAMinGBLabel.AutoSize = $true
$VMRAMinGBLabel.width = 30
$VMRAMinGBLabel.height = 10
$VMRAMinGBLabel.location = New-Object System.Drawing.Point(44,328)
$VMRAMinGBLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$CPUCountTextBox = New-Object system.Windows.Forms.TextBox
$CPUCountTextBox.multiline = $false
$CPUCountTextBox.text = "2"
$CPUCountTextBox.width = 100
$CPUCountTextBox.height = 20
$CPUCountTextBox.location = New-Object System.Drawing.Point(126,299)
$CPUCountTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$CPUCountLabel = New-Object system.Windows.Forms.Label
$CPUCountLabel.text = "CPU Count"
$CPUCountLabel.AutoSize = $true
$CPUCountLabel.width = 30
$CPUCountLabel.height = 10
$CPUCountLabel.location = New-Object System.Drawing.Point(43,299)
$CPUCountLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HardwareVersionComboBox = New-Object system.Windows.Forms.ComboBox
$HardwareVersionComboBox.text = "v8 (ESX 5.0)"
$HardwareVersionComboBox.width = 131
$HardwareVersionComboBox.height = 20
@('v4 (ESX 3)','v7 (ESX 4)','v8 (ESX 5.0)','v9 (ESX 5.1)','v10 (ESX 5.5)','v11 (ESX 6.0)','v13 (ESX 6.5)','v14 (ESX 6.7)') | ForEach-Object {[void] $HardwareVersionComboBox.Items.Add($_)}
$HardwareVersionComboBox.location = New-Object System.Drawing.Point(392,338)
$HardwareVersionComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HardwareVersionLabel = New-Object system.Windows.Forms.Label
$HardwareVersionLabel.text = "Hardware Version"
$HardwareVersionLabel.AutoSize = $true
$HardwareVersionLabel.width = 25
$HardwareVersionLabel.height = 10
$HardwareVersionLabel.location = New-Object System.Drawing.Point(273,342)
$HardwareVersionLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMHostComboBox = New-Object system.Windows.Forms.ComboBox
$VMHostComboBox.text = "Please connect first to populate list"
$VMHostComboBox.width = 370
$VMHostComboBox.height = 20
$VMHostComboBox.location = New-Object System.Drawing.Point(250,140)
$VMHostComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$UserNameTextBox = New-Object system.Windows.Forms.TextBox
$UserNameTextBox.multiline = $false
$UserNameTextBox.text = "username@vsphere.local"
$UserNameTextBox.width = 180
$UserNameTextBox.height = 20
$UserNameTextBox.location = New-Object System.Drawing.Point(100,20)
$UserNameTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$UsreNameLabel = New-Object system.Windows.Forms.Label
$UsreNameLabel.text = "UserName"
$UsreNameLabel.AutoSize = $true
$UsreNameLabel.width = 25
$UsreNameLabel.height = 10
$UsreNameLabel.location = New-Object System.Drawing.Point(25,20)
$UsreNameLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordLabel = New-Object system.Windows.Forms.Label
$PasswordLabel.text = "Password"
$PasswordLabel.AutoSize = $true
$PasswordLabel.width = 25
$PasswordLabel.height = 10
$PasswordLabel.location = New-Object System.Drawing.Point(25,50)
$PasswordLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ServerTextBox = New-Object system.Windows.Forms.TextBox
$ServerTextBox.multiline = $false
$ServerTextBox.text = "192.168.1.11"
$ServerTextBox.width = 238
$ServerTextBox.height = 20
$ServerTextBox.location = New-Object System.Drawing.Point(380,20)
$ServerTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ServerLabel = New-Object system.Windows.Forms.Label
$ServerLabel.text = "Server"
$ServerLabel.AutoSize = $true
$ServerLabel.width = 25
$ServerLabel.height = 10
$ServerLabel.location = New-Object System.Drawing.Point(317,20)
$ServerLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ConnectButton = New-Object system.Windows.Forms.Button
$ConnectButton.text = "Connect to vCenter or Host"
$ConnectButton.width = 297
$ConnectButton.height = 32
$ConnectButton.location = New-Object System.Drawing.Point(321,48)
$ConnectButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$LastResultLabel = New-Object system.Windows.Forms.Label
$LastResultLabel.text = "Please Connect to Host or vCenter"
$LastResultLabel.BackColor = [System.Drawing.Color]::FromArgb(0xb8,0xe9,0x86)
$LastResultLabel.AutoSize = $true
$LastResultLabel.width = 450
$LastResultLabel.height = 40
$LastResultLabel.location = New-Object System.Drawing.Point(101,94)
$LastResultLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',18)
$ResultHeadingLabel = New-Object system.Windows.Forms.Label
$ResultHeadingLabel.text = "Last Result"
$ResultHeadingLabel.AutoSize = $true
$ResultHeadingLabel.width = 25
$ResultHeadingLabel.height = 10
$ResultHeadingLabel.location = New-Object System.Drawing.Point(9,100)
$ResultHeadingLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10, [System.Drawing.FontStyle]::bold)
$SelectDataStoreLabel = New-Object system.Windows.Forms.Label
$SelectDataStoreLabel.text = "Select Datastore for VM Creation"
$SelectDataStoreLabel.AutoSize = $true
$SelectDataStoreLabel.width = 25
$SelectDataStoreLabel.height = 10
$SelectDataStoreLabel.location = New-Object System.Drawing.Point(34,170)
$SelectDataStoreLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RunChecks = New-Object system.Windows.Forms.Button
$RunChecks.BackColor = [System.Drawing.Color]::FromArgb(0xb8,0xe9,0x86)
$RunChecks.text = "Run Checks"
$RunChecks.width = 312
$RunChecks.height = 75
$RunChecks.location = New-Object System.Drawing.Point(302,409)
$RunChecks.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10, [System.Drawing.FontStyle]::bold)
$XLabel = New-Object system.Windows.Forms.Label
$XLabel.text = "X"
$XLabel.AutoSize = $true
$XLabel.width = 25
$XLabel.height = 10
$XLabel.location = New-Object System.Drawing.Point(209,522)
$XLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$XTextBox = New-Object system.Windows.Forms.TextBox
$XTextBox.multiline = $false
$XTextBox.width = 50
$XTextBox.height = 20
$XTextBox.location = New-Object System.Drawing.Point(229,522)
$XTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$VLabel = New-Object system.Windows.Forms.Label
$VLabel.text = "V"
$VLabel.AutoSize = $true
$VLabel.width = 25
$VLabel.height = 10
$VLabel.location = New-Object System.Drawing.Point(209,482)
$VLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VTextBox = New-Object system.Windows.Forms.TextBox
$VTextBox.multiline = $false
$VTextBox.width = 50
$VTextBox.height = 20
$VTextBox.location = New-Object System.Drawing.Point(229,482)
$VTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$WLabel = New-Object system.Windows.Forms.Label
$WLabel.text = "W"
$WLabel.AutoSize = $true
$WLabel.width = 25
$WLabel.height = 10
$WLabel.location = New-Object System.Drawing.Point(209,502)
$WLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$WTextBox = New-Object system.Windows.Forms.TextBox
$WTextBox.multiline = $false
$WTextBox.width = 50
$WTextBox.height = 20
$WTextBox.location = New-Object System.Drawing.Point(229,502)
$WTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$ULabel = New-Object system.Windows.Forms.Label
$ULabel.text = "U"
$ULabel.AutoSize = $true
$ULabel.width = 25
$ULabel.height = 10
$ULabel.location = New-Object System.Drawing.Point(209,462)
$ULabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$UTextBox = New-Object system.Windows.Forms.TextBox
$UTextBox.multiline = $false
$UTextBox.width = 50
$UTextBox.height = 20
$UTextBox.location = New-Object System.Drawing.Point(229,462)
$UTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$SLabel = New-Object system.Windows.Forms.Label
$SLabel.text = "S"
$SLabel.AutoSize = $true
$SLabel.width = 25
$SLabel.height = 10
$SLabel.location = New-Object System.Drawing.Point(209,422)
$SLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$STextBox = New-Object system.Windows.Forms.TextBox
$STextBox.multiline = $false
$STextBox.width = 50
$STextBox.height = 20
$STextBox.location = New-Object System.Drawing.Point(229,422)
$STextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$TLabel = New-Object system.Windows.Forms.Label
$TLabel.text = "T"
$TLabel.AutoSize = $true
$TLabel.width = 25
$TLabel.height = 10
$TLabel.location = New-Object System.Drawing.Point(209,442)
$TLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$TTextBox = New-Object system.Windows.Forms.TextBox
$TTextBox.multiline = $false
$TTextBox.width = 50
$TTextBox.height = 20
$TTextBox.location = New-Object System.Drawing.Point(229,442)
$TTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$ZLabel = New-Object system.Windows.Forms.Label
$ZLabel.text = "Z"
$ZLabel.AutoSize = $true
$ZLabel.width = 25
$ZLabel.height = 10
$ZLabel.location = New-Object System.Drawing.Point(209,562)
$ZLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ZTextBox = New-Object system.Windows.Forms.TextBox
$ZTextBox.multiline = $false
$ZTextBox.width = 50
$ZTextBox.height = 20
$ZTextBox.location = New-Object System.Drawing.Point(229,562)
$ZTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$YLabel = New-Object system.Windows.Forms.Label
$YLabel.text = "Y"
$YLabel.AutoSize = $true
$YLabel.width = 25
$YLabel.height = 10
$YLabel.location = New-Object System.Drawing.Point(209,542)
$YLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$YTextBox = New-Object system.Windows.Forms.TextBox
$YTextBox.multiline = $false
$YTextBox.width = 50
$YTextBox.height = 20
$YTextBox.location = New-Object System.Drawing.Point(229,542)
$YTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$HLabel = New-Object system.Windows.Forms.Label
$HLabel.text = "H"
$HLabel.AutoSize = $true
$HLabel.width = 25
$HLabel.height = 10
$HLabel.location = New-Object System.Drawing.Point(29,522)
$HLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HTextBox = New-Object system.Windows.Forms.TextBox
$HTextBox.multiline = $false
$HTextBox.width = 50
$HTextBox.height = 20
$HTextBox.location = New-Object System.Drawing.Point(49,522)
$HTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$FLabel = New-Object system.Windows.Forms.Label
$FLabel.text = "F"
$FLabel.AutoSize = $true
$FLabel.width = 25
$FLabel.height = 10
$FLabel.location = New-Object System.Drawing.Point(29,482)
$FLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$FTextBox = New-Object system.Windows.Forms.TextBox
$FTextBox.multiline = $false
$FTextBox.width = 50
$FTextBox.height = 20
$FTextBox.location = New-Object System.Drawing.Point(49,482)
$FTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$GLabel = New-Object system.Windows.Forms.Label
$GLabel.text = "G"
$GLabel.AutoSize = $true
$GLabel.width = 25
$GLabel.height = 10
$GLabel.location = New-Object System.Drawing.Point(29,502)
$GLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$GTextBox = New-Object system.Windows.Forms.TextBox
$GTextBox.multiline = $false
$GTextBox.width = 50
$GTextBox.height = 20
$GTextBox.location = New-Object System.Drawing.Point(49,502)
$GTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$ELabel = New-Object system.Windows.Forms.Label
$ELabel.text = "E"
$ELabel.AutoSize = $true
$ELabel.width = 25
$ELabel.height = 10
$ELabel.location = New-Object System.Drawing.Point(29,462)
$ELabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ETextBox = New-Object system.Windows.Forms.TextBox
$ETextBox.multiline = $false
$ETextBox.width = 50
$ETextBox.height = 20
$ETextBox.location = New-Object System.Drawing.Point(49,462)
$ETextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$CLabel = New-Object system.Windows.Forms.Label
$CLabel.text = "C"
$CLabel.AutoSize = $true
$CLabel.width = 25
$CLabel.height = 10
$CLabel.location = New-Object System.Drawing.Point(29,422)
$CLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$CTextBox = New-Object system.Windows.Forms.TextBox
$CTextBox.multiline = $false
$CTextBox.text = "85"
$CTextBox.width = 50
$CTextBox.height = 20
$CTextBox.location = New-Object System.Drawing.Point(49,422)
$CTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$DLabel = New-Object system.Windows.Forms.Label
$DLabel.text = "D"
$DLabel.AutoSize = $true
$DLabel.width = 25
$DLabel.height = 10
$DLabel.location = New-Object System.Drawing.Point(29,442)
$DLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DTextBox = New-Object system.Windows.Forms.TextBox
$DTextBox.multiline = $false
$DTextBox.width = 50
$DTextBox.height = 20
$DTextBox.location = New-Object System.Drawing.Point(49,442)
$DTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$JLabel = New-Object system.Windows.Forms.Label
$JLabel.text = "J"
$JLabel.AutoSize = $true
$JLabel.width = 25
$JLabel.height = 10
$JLabel.location = New-Object System.Drawing.Point(29,562)
$JLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$JTextBox = New-Object system.Windows.Forms.TextBox
$JTextBox.multiline = $false
$JTextBox.width = 50
$JTextBox.height = 20
$JTextBox.location = New-Object System.Drawing.Point(49,562)
$JTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$ILabel = New-Object system.Windows.Forms.Label
$ILabel.text = "I"
$ILabel.AutoSize = $true
$ILabel.width = 25
$ILabel.height = 10
$ILabel.location = New-Object System.Drawing.Point(29,542)
$ILabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ITextBox = New-Object system.Windows.Forms.TextBox
$ITextBox.multiline = $false
$ITextBox.width = 50
$ITextBox.height = 20
$ITextBox.location = New-Object System.Drawing.Point(49,542)
$ITextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$QLabel = New-Object system.Windows.Forms.Label
$QLabel.text = "Q"
$QLabel.AutoSize = $true
$QLabel.width = 25
$QLabel.height = 10
$QLabel.location = New-Object System.Drawing.Point(119,542)
$QLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$QTextBox = New-Object system.Windows.Forms.TextBox
$QTextBox.multiline = $false
$QTextBox.width = 50
$QTextBox.height = 20
$QTextBox.location = New-Object System.Drawing.Point(139,542)
$QTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$OLabel = New-Object system.Windows.Forms.Label
$OLabel.text = "O"
$OLabel.AutoSize = $true
$OLabel.width = 25
$OLabel.height = 10
$OLabel.location = New-Object System.Drawing.Point(119,502)
$OLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$OTextBox = New-Object system.Windows.Forms.TextBox
$OTextBox.multiline = $false
$OTextBox.width = 50
$OTextBox.height = 20
$OTextBox.location = New-Object System.Drawing.Point(139,502)
$OTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$PLabel = New-Object system.Windows.Forms.Label
$PLabel.text = "P"
$PLabel.AutoSize = $true
$PLabel.width = 25
$PLabel.height = 10
$PLabel.location = New-Object System.Drawing.Point(119,522)
$PLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PTextBox = New-Object system.Windows.Forms.TextBox
$PTextBox.multiline = $false
$PTextBox.width = 50
$PTextBox.height = 20
$PTextBox.location = New-Object System.Drawing.Point(139,522)
$PTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$MLabel = New-Object system.Windows.Forms.Label
$MLabel.text = "M"
$MLabel.AutoSize = $true
$MLabel.width = 25
$MLabel.height = 10
$MLabel.location = New-Object System.Drawing.Point(119,462)
$MLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$MTextBox = New-Object system.Windows.Forms.TextBox
$MTextBox.multiline = $false
$MTextBox.width = 50
$MTextBox.height = 20
$MTextBox.location = New-Object System.Drawing.Point(139,462)
$MTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$KLabel = New-Object system.Windows.Forms.Label
$KLabel.text = "K"
$KLabel.AutoSize = $true
$KLabel.width = 25
$KLabel.height = 10
$KLabel.location = New-Object System.Drawing.Point(119,422)
$KLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$KTextBox = New-Object system.Windows.Forms.TextBox
$KTextBox.multiline = $false
$KTextBox.width = 50
$KTextBox.height = 20
$KTextBox.location = New-Object System.Drawing.Point(139,422)
$KTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$LLabel = New-Object system.Windows.Forms.Label
$LLabel.text = "L"
$LLabel.AutoSize = $true
$LLabel.width = 25
$LLabel.height = 10
$LLabel.location = New-Object System.Drawing.Point(119,442)
$LLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$LTextBox = New-Object system.Windows.Forms.TextBox
$LTextBox.multiline = $false
$LTextBox.width = 50
$LTextBox.height = 20
$LTextBox.location = New-Object System.Drawing.Point(139,442)
$LTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$NLabel = New-Object system.Windows.Forms.Label
$NLabel.text = "N"
$NLabel.AutoSize = $true
$NLabel.width = 25
$NLabel.height = 10
$NLabel.location = New-Object System.Drawing.Point(119,482)
$NLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$NTextBox = New-Object system.Windows.Forms.TextBox
$NTextBox.multiline = $false
$NTextBox.width = 50
$NTextBox.height = 20
$NTextBox.location = New-Object System.Drawing.Point(139,482)
$NTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$RLabel = New-Object system.Windows.Forms.Label
$RLabel.text = "R"
$RLabel.AutoSize = $true
$RLabel.width = 25
$RLabel.height = 10
$RLabel.location = New-Object System.Drawing.Point(119,562)
$RLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RTextBox = New-Object system.Windows.Forms.TextBox
$RTextBox.multiline = $false
$RTextBox.width = 50
$RTextBox.height = 20
$RTextBox.location = New-Object System.Drawing.Point(139,562)
$RTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',7)
$CreateVMButton = New-Object system.Windows.Forms.Button
$CreateVMButton.BackColor = [System.Drawing.Color]::FromArgb(0xb8,0xe9,0x86)
$CreateVMButton.text = "Create VM"
$CreateVMButton.width = 312
$CreateVMButton.height = 75
$CreateVMButton.location = New-Object System.Drawing.Point(302,494)
$CreateVMButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10, [System.Drawing.FontStyle]::bold)
$BootISOLabel = New-Object system.Windows.Forms.Label
$BootISOLabel.text = "Boot ISO"
$BootISOLabel.AutoSize = $true
$BootISOLabel.visible = $true
$BootISOLabel.width = 25
$BootISOLabel.height = 10
$BootISOLabel.location = New-Object System.Drawing.Point(40,374)
$BootISOLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordTextBox = New-Object system.Windows.Forms.MaskedTextBox
$PasswordTextBox.multiline = $false
$PasswordTextBox.width = 180
$PasswordTextBox.height = 20
$PasswordTextBox.location = New-Object System.Drawing.Point(100,50)
$PasswordTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DataStoreComboBox = New-Object system.Windows.Forms.ComboBox
$DataStoreComboBox.text = "Please select host above first"
$DataStoreComboBox.width = 370
$DataStoreComboBox.height = 20
$DataStoreComboBox.location = New-Object System.Drawing.Point(250,170)
$DataStoreComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Label1 = New-Object system.Windows.Forms.Label
$Label1.text = "Select Host for VM Creation"
$Label1.AutoSize = $true
$Label1.width = 25
$Label1.height = 10
$Label1.location = New-Object System.Drawing.Point(34,140)
$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMNetworkLabel = New-Object system.Windows.Forms.Label
$VMNetworkLabel.text = "VM Network"
$VMNetworkLabel.AutoSize = $true
$VMNetworkLabel.width = 25
$VMNetworkLabel.height = 10
$VMNetworkLabel.location = New-Object System.Drawing.Point(305,284)
$VMNetworkLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$NetworkComboBox = New-Object system.Windows.Forms.ComboBox
$NetworkComboBox.text = "Please select a host first"
$NetworkComboBox.width = 225
$NetworkComboBox.height = 20
$NetworkComboBox.location = New-Object System.Drawing.Point(392,281)
$NetworkComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$BootISOComboBox = New-Object system.Windows.Forms.ComboBox
$BootISOComboBox.width = 279
$BootISOComboBox.height = 20
$BootISOComboBox.location = New-Object System.Drawing.Point(109,374)
$BootISOComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PowerOnCheckBox = New-Object system.Windows.Forms.CheckBox
$PowerOnCheckBox.text = "Power on VM after Creation?"
$PowerOnCheckBox.AutoSize = $false
$PowerOnCheckBox.width = 207
$PowerOnCheckBox.height = 26
$PowerOnCheckBox.location = New-Object System.Drawing.Point(412,376)
$PowerOnCheckBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasteButton = New-Object system.Windows.Forms.Button
$PasteButton.BackColor = [System.Drawing.Color]::FromArgb(0xf8,0xe7,0x1c)
$PasteButton.text = "Paste Info From CSI - UnGrouped Report Use Chrome Please"
$PasteButton.width = 272
$PasteButton.height = 53
$PasteButton.location = New-Object System.Drawing.Point(347,203)
$PasteButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$OSArchitectureLabel = New-Object system.Windows.Forms.Label
$OSArchitectureLabel.text = "OS Architecture"
$OSArchitectureLabel.AutoSize = $true
$OSArchitectureLabel.width = 25
$OSArchitectureLabel.height = 10
$OSArchitectureLabel.location = New-Object System.Drawing.Point(21,269)
$OSArchitectureLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$OSArchitectureLabelComboBox = New-Object system.Windows.Forms.ComboBox
$OSArchitectureLabelComboBox.text = "64Bit"
$OSArchitectureLabelComboBox.width = 100
$OSArchitectureLabelComboBox.height = 20
@('64Bit','32Bit') | ForEach-Object {[void] $OSArchitectureLabelComboBox.Items.Add($_)}
$OSArchitectureLabelComboBox.location = New-Object System.Drawing.Point(126,269)
$OSArchitectureLabelComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$OSComboBox = New-Object system.Windows.Forms.ComboBox
$OSComboBox.text = "Please select a host first"
$OSComboBox.width = 225
$OSComboBox.height = 20
$OSComboBox.location = New-Object System.Drawing.Point(391,310)
$OSComboBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$OSLabel = New-Object system.Windows.Forms.Label
$OSLabel.text = "Operating System"
$OSLabel.AutoSize = $true
$OSLabel.width = 25
$OSLabel.height = 10
$OSLabel.location = New-Object System.Drawing.Point(271,313)
$OSLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMNamePrefixLabel = New-Object system.Windows.Forms.Label
$VMNamePrefixLabel.text = "VM Name Prefix"
$VMNamePrefixLabel.AutoSize = $true
$VMNamePrefixLabel.width = 200
$VMNamePrefixLabel.height = 10
$VMNamePrefixLabel.location = New-Object System.Drawing.Point(13,207)
$VMNamePrefixLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMNamePreFixTextBox = New-Object system.Windows.Forms.TextBox
$VMNamePreFixTextBox.multiline = $false
$VMNamePreFixTextBox.width = 196
$VMNamePreFixTextBox.height = 20
$VMNamePreFixTextBox.location = New-Object System.Drawing.Point(127,205)
$VMNamePreFixTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DrivesToAttachInGBLabel = New-Object system.Windows.Forms.Label
$DrivesToAttachInGBLabel.text = "Drives To Attach In GB"
$DrivesToAttachInGBLabel.AutoSize = $true
$DrivesToAttachInGBLabel.width = 25
$DrivesToAttachInGBLabel.height = 10
$DrivesToAttachInGBLabel.location = New-Object System.Drawing.Point(95,404)
$DrivesToAttachInGBLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostVer = New-Object system.Windows.Forms.Label
$HostVer.text = "Select Host"
$HostVer.AutoSize = $true
$HostVer.width = 25
$HostVer.height = 10
$HostVer.location = New-Object System.Drawing.Point(330,599)
$HostVer.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostRam = New-Object system.Windows.Forms.Label
$HostRam.text = "Select Host"
$HostRam.AutoSize = $true
$HostRam.width = 25
$HostRam.height = 10
$HostRam.location = New-Object System.Drawing.Point(110,601)
$HostRam.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostRamLabel = New-Object system.Windows.Forms.Label
$HostRamLabel.text = "Host Ram"
$HostRamLabel.AutoSize = $true
$HostRamLabel.width = 25
$HostRamLabel.height = 10
$HostRamLabel.location = New-Object System.Drawing.Point(37,601)
$HostRamLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostVerLabel = New-Object system.Windows.Forms.Label
$HostVerLabel.text = "Host Version"
$HostVerLabel.AutoSize = $true
$HostVerLabel.width = 25
$HostVerLabel.height = 10
$HostVerLabel.location = New-Object System.Drawing.Point(239,599)
$HostVerLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$NumCPULabel = New-Object system.Windows.Forms.Label
$NumCPULabel.text = "Number of CPU"
$NumCPULabel.AutoSize = $true
$NumCPULabel.width = 25
$NumCPULabel.height = 10
$NumCPULabel.location = New-Object System.Drawing.Point(239,627)
$NumCPULabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$NumCPU = New-Object system.Windows.Forms.Label
$NumCPU.text = "Select Host"
$NumCPU.AutoSize = $true
$NumCPU.width = 25
$NumCPU.height = 10
$NumCPU.location = New-Object System.Drawing.Point(340,627)
$NumCPU.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostModelLabel = New-Object system.Windows.Forms.Label
$HostModelLabel.text = "Host Model"
$HostModelLabel.AutoSize = $true
$HostModelLabel.width = 25
$HostModelLabel.height = 10
$HostModelLabel.location = New-Object System.Drawing.Point(39,632)
$HostModelLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HostModel = New-Object system.Windows.Forms.Label
$HostModel.text = "Select Host"
$HostModel.AutoSize = $true
$HostModel.width = 25
$HostModel.height = 10
$HostModel.location = New-Object System.Drawing.Point(129,632)
$HostModel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$SetCPUBasedonDrivesButton = New-Object system.Windows.Forms.Button
$SetCPUBasedonDrivesButton.text = "Set CPU Based on Drives"
$SetCPUBasedonDrivesButton.width = 110
$SetCPUBasedonDrivesButton.height = 48
$SetCPUBasedonDrivesButton.location = New-Object System.Drawing.Point(427,593)
$SetCPUBasedonDrivesButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$HWVERLabel2 = New-Object system.Windows.Forms.Label
$HWVERLabel2.text = "HWVERLabel2"
$HWVERLabel2.AutoSize = $true
$HWVERLabel2.width = 25
$HWVERLabel2.height = 10
$HWVERLabel2.location = New-Object System.Drawing.Point(293,664)
$HWVERLabel2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$VMCreator.controls.AddRange(@($VMNameTextBox,$VMNameLabel,$RAMinGBTextBox,$VMRAMinGBLabel,$CPUCountTextBox,$CPUCountLabel,$HardwareVersionComboBox,$HardwareVersionLabel,$VMHostComboBox,$UserNameTextBox,$UsreNameLabel,$PasswordLabel,$ServerTextBox,$ServerLabel,$ConnectButton,$LastResultLabel,$ResultHeadingLabel,$SelectDataStoreLabel,$RunChecks,$XLabel,$XTextBox,$VLabel,$VTextBox,$WLabel,$WTextBox,$ULabel,$UTextBox,$SLabel,$STextBox,$TLabel,$TTextBox,$ZLabel,$ZTextBox,$YLabel,$YTextBox,$HLabel,$HTextBox,$FLabel,$FTextBox,$GLabel,$GTextBox,$ELabel,$ETextBox,$CLabel,$CTextBox,$DLabel,$DTextBox,$JLabel,$JTextBox,$ILabel,$ITextBox,$QLabel,$QTextBox,$OLabel,$OTextBox,$PLabel,$PTextBox,$MLabel,$MTextBox,$KLabel,$KTextBox,$LLabel,$LTextBox,$NLabel,$NTextBox,$RLabel,$RTextBox,$CreateVMButton,$BootISOLabel,$PasswordTextBox,$DataStoreComboBox,$Label1,$VMNetworkLabel,$NetworkComboBox,$BootISOComboBox,$PowerOnCheckBox,$PasteButton,$OSArchitectureLabel,$OSArchitectureLabelComboBox,$OSComboBox,$OSLabel,$VMNamePrefixLabel,$VMNamePreFixTextBox,$DrivesToAttachInGBLabel,$HostVer,$HostRam,$HostRamLabel,$HostVerLabel,$NumCPULabel,$NumCPU,$HostModelLabel,$HostModel,$SetCPUBasedonDrivesButton,$HWVERLabel2))
$ConnectButton.Add_Click({ ConnectNow })
$VMHostComboBox.Add_SelectedValueChanged({ VMHostSelectChanged })
$RunChecks.Add_Click({ RunChecks $global:MaxMem })
$CPUCountTextBox.Add_TextChanged({ remove-letters })
$RAMinGBTextBox.Add_TextChanged({ remove-letters })
$VMNameTextBox.Add_TextChanged({ Remove-Characters })
$CTextBox.Add_TextChanged({ remove-letters })
$XLabel.Add_TextChanged({ remove-letters })
$ZTextBox.Add_TextChanged({ remove-letters })
$YTextBox.Add_TextChanged({ remove-letters })
$XTextBox.Add_TextChanged({ remove-letters })
$WTextBox.Add_TextChanged({ remove-letters })
$VTextBox.Add_TextChanged({ remove-letters })
$UTextBox.Add_TextChanged({ remove-letters })
$TTextBox.Add_TextChanged({ remove-letters })
$STextBox.Add_TextChanged({ remove-letters })
$RTextBox.Add_TextChanged({ remove-letters })
$QTextBox.Add_TextChanged({ remove-letters })
$PTextBox.Add_TextChanged({ remove-letters })
$OTextBox.Add_TextChanged({ remove-letters })
$NTextBox.Add_TextChanged({ remove-letters })
$MTextBox.Add_TextChanged({ remove-letters })
$LTextBox.Add_TextChanged({ remove-letters })
$KTextBox.Add_TextChanged({ remove-letters })
$JTextBox.Add_TextChanged({ remove-letters })
$ITextBox.Add_TextChanged({ remove-letters })
$HTextBox.Add_TextChanged({ remove-letters })
$GTextBox.Add_TextChanged({ remove-letters })
$ETextBox.Add_TextChanged({ remove-letters })
$DTextBox.Add_TextChanged({ remove-letters })
$FTextBox.Add_TextChanged({ remove-letters })
$CreateVMButton.Add_Click({ CreateVM })
$DataStoreComboBox.Add_SelectedValueChanged({ VMDatastoreChanged })
$BootISOComboBox.Add_SelectedValueChanged({ DVDISOSelect })
$PasteButton.Add_Click({ PasteButton_Click })
$OSArchitectureLabelComboBox.Add_SelectedValueChanged({ OSArchitectureSelect })
$NetworkComboBox.Add_SelectedValueChanged({ VMNetworkChanged })
$OSComboBox.Add_SelectedValueChanged({ OSChanged })
$SetCPUBasedonDrivesButton.Add_Click({ SetCPUBasedOnDrivesClick })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment