$DropDownArray1= @("No","Yes")
$DropDownArray2= @("TA","JE","HO","HA","NT","LP")
$DropDownArray3= @("NE","HB","PT","AY")
$OSDcomputerName="computername"
# Form building
Add-Type-AssemblyNameSystem.Windows.Forms
Add-Type-AssemblyNameSystem.Drawing
$Form=New-ObjectSystem.Windows.Forms.Form
$Form.width =500
$Form.height =400
$Form.Text =”Computer Name”
$Form.StartPosition ="CenterScreen"
##############################################################################
foreach ($itemin$DropDownArray1)
{
$ComboBox1.Items.Add($item)
}
$Form.Controls.Add($ComboBox1)
$Labal1=New-ObjectSystem.Windows.Forms.Label
$Labal1.Location =New-ObjectSystem.Drawing.Size(10,10)
$Labal1.Size =New-ObjectSystem.Drawing.Size(100,40)
$Labal1.Text ="Citrix ?"
$Form.Controls.Add($Labal1)
$ComboBox1=New-ObjectSystem.Windows.Forms.ComboBox
$ComboBox1.Location =New-ObjectSystem.Drawing.Size(140,10)
$ComboBox1.Size =New-ObjectSystem.Drawing.Size(130,30)
$ComboBox1.DropDownStyle =[System.Windows.Forms.ComboBoxStyle]::DropDownList;
$ComboBox1.Items.Clear();
##############################################################################
ForEach ($Itemin$DropDownArray2) {
$ComboBox2.Items.Add($Item) |Out-Null
}
$Form.Controls.Add($ComboBox2)
$Labal2=new-objectSystem.Windows.Forms.Label
$Labal2.Location =new-objectSystem.Drawing.Size(10,50)
$Labal2.size =new-objectSystem.Drawing.Size(100,40)
$Labal2.Text ="Computer Location ?"
$Form.Controls.Add($Labal2)
$ComboBox2=New-ObjectSystem.Windows.Forms.ComboBox
$ComboBox2.Location =New-ObjectSystem.Drawing.Size(140,50)
$ComboBox2.Size =New-ObjectSystem.Drawing.Size(130,30)
$ComboBox2.DropDownStyle =[System.Windows.Forms.ComboBoxStyle]::DropDownList;
$ComboBox2.Items.Clear();
##############################################################################
ForEach ($Itemin$DropDownArray3) {
$ComboBox3.Items.Add($Item) |Out-Null
}
$Form.Controls.Add($ComboBox3)
$Labal3=new-objectSystem.Windows.Forms.Label
$Labal3.Location =new-objectSystem.Drawing.Size(10,100)
$Labal3.size =new-objectSystem.Drawing.Size(100,60)
$Labal3.Text ="Company?"
$Form.Controls.Add($Labal3)
$ComboBox3=New-ObjectSystem.Windows.Forms.ComboBox
$ComboBox3.Location =New-ObjectSystem.Drawing.Size(140,90)
$ComboBox3.Size =New-ObjectSystem.Drawing.Size(130,30)
$ComboBox3.DropDownStyle =[System.Windows.Forms.ComboBoxStyle]::DropDownList;
$ComboBox3.Items.Clear();
######################################################################################
$label4=New-ObjectSystem.Windows.Forms.Label
$label4.Location =New-ObjectSystem.Drawing.Point(10,160)
$label4.Size =New-ObjectSystem.Drawing.Size(100,90)
$label4.Text ="Insert 6 Numbers:"
$form.Controls.Add($label4)
$textBox=New-ObjectSystem.Windows.Forms.TextBox
$textBox.Location =New-ObjectSystem.Drawing.Point(140,160)
$textBox.Size =New-ObjectSystem.Drawing.Size(130,30)
$textBox.MaxLength =6
$form.Controls.Add($textBox)
$textBox.Add_TextChanged({
$this.Text =$this.Text -replace'\D'
})
######################################################################################
$OKButton=new-objectSystem.Windows.Forms.Button
$OKButton.Location =new-objectSystem.Drawing.Size(200,250)
$OKButton.Size =new-objectSystem.Drawing.Size(100,20)
$OKButton.Text ="OK"
$OKButton.Add_Click({
$Form.DialogResult ="OK"
$Form.close()
})
$form.Controls.Add($OKButton)
$CancelButton=New-ObjectSystem.Windows.Forms.Button
$CancelButton.Location =New-ObjectSystem.Drawing.Size(200,300)
$CancelButton.Size =New-ObjectSystem.Drawing.Size(100,20)
$CancelButton.Text ="Cancel"
$CancelButton.Add_Click({
$Form.DialogResult ="Cancel"
$Form.close()
})
$Form.Controls.Add($CancelButton)
$Form.Add_Shown({$Form.Activate()})
$result=$Form.ShowDialog()
i am trying to get from this one "combobox1" selection = x, combobox 2 = y and on and on so at the end i would be able to build a computer name from the user selection
so x+y+z+m = computername
please i am trying for a long time to solve it i am not the best at powershell
thank you all