135531
Feb 22, 2018
1439
3
0
PowerShell GUI, PCI-Geräte in einer ComboBox ausgeben
Hi @all,
ich bin absoluter Neuling wenn es um die nutzung von PowerShell geht. Dennoch versuche ich im Moment eine PowerShell GUI zu bauen um das Discrete Device Assignment (DDA) zu vereinfachen.
Genauer gesagt will ich es so haben, dass ich in einer ComboBox alle PCI-Geräte des Lokalen Servers (PCs) zur Auswahl habe.
Also soll der Befehl Get-WmiObject cim_controller | fl c* ausgeführt werden und die Ausgabe in der ComboBox zur Auswahl stehen.
Aktuell sieht die Ausgabe dann so aus:
Das sind ja leider nicht die PCI-Geräte mit Namen Wenn möglich hätte ich auch gerne den LocationPath dazu...
Kann mir da jemand helfen ?
Mein PowerShell skript sieht aktuell wie folgt aus :
ich bin absoluter Neuling wenn es um die nutzung von PowerShell geht. Dennoch versuche ich im Moment eine PowerShell GUI zu bauen um das Discrete Device Assignment (DDA) zu vereinfachen.
Genauer gesagt will ich es so haben, dass ich in einer ComboBox alle PCI-Geräte des Lokalen Servers (PCs) zur Auswahl habe.
Also soll der Befehl Get-WmiObject cim_controller | fl c* ausgeführt werden und die Ausgabe in der ComboBox zur Auswahl stehen.
Aktuell sieht die Ausgabe dann so aus:
Das sind ja leider nicht die PCI-Geräte mit Namen Wenn möglich hätte ich auch gerne den LocationPath dazu...
Kann mir da jemand helfen ?
Mein PowerShell skript sieht aktuell wie folgt aus :
#PCI-Gerät Location Path angeben
$objForm.Add_Load({
$objComboBox2.Items.AddRange((Get-WmiObject cim_controller | fl c*))
})
$objComboBox.Add_SelectedIndexChanged({
[System.Windows.Forms.MessageBox]::Show((Get-WmiObject cim_controller | fl c*))
})
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(50,150)
$objLabel.Size = New-Object System.Drawing.Size(300,50)
$objLabel.Text = "Wählen sie ein PCI-Gerät aus:"
$objForm.Controls.Add($objLabel)
$objComboBox2 = New-Object System.Windows.Forms.Combobox
$objComboBox2.Location = New-Object System.Drawing.Size(50,200)
$objComboBox2.Size = New-Object System.Drawing.Size(300,50)
$objComboBox2.Height = 70
$objForm.Controls.Add($objComboBox2)
$objForm.TopMost = $True
$objComboBox2.Add_SelectedIndexChanged({ })
Please also mark the comments that contributed to the solution of the article
Content-Key: 365789
Url: https://administrator.de/contentid/365789
Printed on: April 25, 2024 at 04:04 o'clock
3 Comments
Latest comment
Hatte ich dir beim letzten mal eigentlich schon gezeigt ...Nutze select -Expand um ein Array aus reinen Strings zu bekommen ...
Format-List bietet nur Objekte als Ergebnis, kein reines Stringarray.
Gruß Snap
$objComboBox2.Items.AddRange((gwmi cim_controller | select -Expand Name))
Gruß Snap
Na dann, bitte beide Threads noch als gelöst markieren. Danke.