mrjohndo
Goto Top

Powershell Abfrage über Graphischer Oberfläche

Hallo an alle,

da ich relativ neu in Powershell bin bräuchte ich mal eure Hilfe bzw Tipps.

Ich erstelle gerade ein Tool mit Graphischer Oberfläche, was soll es machen:
1. Tool wird als ADM geöffnet
2. Button sind mit Programmen belegt die sofort als ADM sich öffnen
3. Wenn man Rechnername oder Username eingibt soll eine Abfrage stattfinden Eingabe in Textbox - Ausgabe in Label

Button Abfrage funktioniert soweit habe noch 2 kleine Probleme mit SCCM und MSRA/offerRa aber das bekomme ich hin.

SO und jetzt meine Problem ich versuche ein Skript das ich gefunden habe mit einzubinden siehe ab <# Param.

Wenn jemand das Skript möchte kann sich gerne alles kopieren.

Wer kann mir helfen bzw Tipps geben wie ich das erstellen kann, möchte ja weiterlernen Powershell

Danke im voraus

Skript

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
Add-Type -AssemblyName System.Drawing
[Windows.Forms.Application]::EnableVisualStyles()


#Als Administrator ausführen
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
    {   
        $arguments = "& '" + $myinvocation.mycommand.definition + "'"  
        Start-Process powershell -Verb runAs -ArgumentList $arguments
        Break
    }

$Form                            = New-Object system.Windows.Forms.Form
$Form.ClientSize                 = New-Object System.Drawing.Point(1100,600)
$Form.text                       = "Foits Start"  
$Form.TopMost                    = $false
$Form.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#07326c")  

#Klick Button FileEx
$FileEx                          = New-Object system.Windows.Forms.Button
$FileEx.text                     = "FileEx"  
$FileEx.width                    = 110
$FileEx.height                   = 23
$FileEx.location                 = New-Object System.Drawing.Point(10,10)
$FileEx.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$FileEx.BackColor                = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$FileEx.Add_Click({start-process C:\OPT-Kopie\FreeCommander\FreeCommander.exe})

#Klick Button Explorer++
$Explorer                        = New-Object system.Windows.Forms.Button
$Explorer.text                   = "Explorer++"  
$Explorer.width                  = 110
$Explorer.height                 = 23
$Explorer.location               = New-Object System.Drawing.Point(10,40)
$Explorer.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Explorer.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Explorer.Add_Click({start-process C:\OPT-Kopie\Explorer++\Explorer++.exe})

#Klick Button MMC
$MMC                             = New-Object system.Windows.Forms.Button
$MMC.text                        = "MMC"  
$MMC.width                       = 110
$MMC.height                      = 23
$MMC.location                    = New-Object System.Drawing.Point(10,70)
$MMC.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$MMC.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$MMC.Add_Click({start-process C:\Windows\System32\mmc.exe})

#Klick Button CCfCC
$CCfCC                           = New-Object system.Windows.Forms.Button
$CCfCC.text                      = "CCfCC"  
$CCfCC.width                     = 110
$CCfCC.height                    = 23
$CCfCC.location                  = New-Object System.Drawing.Point(10,100)
$CCfCC.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$CCfCC.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$CCfCC.Add_Click({start-process C:\OPT-Kopie\CCfCC.cmd})

#Klick Button SCCM
$SCCM                            = New-Object system.Windows.Forms.Button
$SCCM.text                       = "SCCM"  
$SCCM.width                      = 110
$SCCM.height                     = 23
$SCCM.location                   = New-Object System.Drawing.Point(10,130)
$SCCM.Font                       = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$SCCM.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$SCCM.Add_Click({start-process -FilePath C:\Program Files x86\Microsoft Configuration Manager\AdminConsole\bin\Microsoft.ConfigurationManagement.exe})

#Klick Button MSRA
$MSRA                            = New-Object system.Windows.Forms.Button
$MSRA.text                       = "MSRA"  
$MSRA.width                      = 110
$MSRA.height                     = 23
$MSRA.location                   = New-Object System.Drawing.Point(10,160)
$MSRA.Font                       = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$MSRA.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$MSRA.Add_Click({start-process cmd.exe -ArgumentList "/C msra /offerra $Computer" -NoNewWindow})  

#Klick ISE
$ISE                             = New-Object system.Windows.Forms.Button
$ISE.text                        = "ISE"  
$ISE.width                       = 110
$ISE.height                      = 25
$ISE.location                    = New-Object System.Drawing.Point(10,190)
$ISE.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$ISE.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$ISE.Add_Click({start-process C:\OPT-Kopie\ISE.RDP})

#Klick Button8
$Button8                         = New-Object system.Windows.Forms.Button
$Button8.text                    = "Button8"  
$Button8.width                   = 110
$Button8.height                  = 23
$Button8.location                = New-Object System.Drawing.Point(10,220)
$Button8.Font                    = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button8.BackColor               = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button8.Add_Click({start-process })

#Klick Button9
$Button9                         = New-Object system.Windows.Forms.Button
$Button9.text                    = "Button9"  
$Button9.width                   = 110
$Button9.height                  = 23
$Button9.location                = New-Object System.Drawing.Point(10,250)
$Button9.Font                    = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button9.BackColor               = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button9.Add_Click({start-process })

#Klick Button10
$Button10                        = New-Object system.Windows.Forms.Button
$Button10.text                   = "Button10"  
$Button10.width                  = 110
$Button10.height                 = 23
$Button10.location               = New-Object System.Drawing.Point(10,280)
$Button10.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button10.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button10.Add_Click({start-process })

#Klick Button11
$Button11                        = New-Object system.Windows.Forms.Button
$Button11.text                   = "Button11"  
$Button11.width                  = 110
$Button11.height                 = 23
$Button11.location               = New-Object System.Drawing.Point(10,310)
$Button11.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button11.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button11.Add_Click({start-process })

#Klick Button12
$Button12                        = New-Object system.Windows.Forms.Button
$Button12.text                   = "Button12"  
$Button12.width                  = 110
$Button12.height                 = 23
$Button12.location               = New-Object System.Drawing.Point(10,340)
$Button12.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button12.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button12.Add_Click({start-process })

#Klick Button13
$Button13                        = New-Object system.Windows.Forms.Button
$Button13.text                   = "Button13"  
$Button13.width                  = 110
$Button13.height                 = 23
$Button13.location               = New-Object System.Drawing.Point(10,370)
$Button13.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button13.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button13.Add_Click({start-process })


#Klick Button14
$Button14                        = New-Object system.Windows.Forms.Button
$Button14.text                   = "Button14"  
$Button14.width                  = 110
$Button14.height                 = 23
$Button14.location               = New-Object System.Drawing.Point(10,400)
$Button14.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button14.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button14.Add_Click({start-process })

#Klick Button15
$Button15                        = New-Object system.Windows.Forms.Button
$Button15.text                   = "Button15"  
$Button15.width                  = 110
$Button15.height                 = 23
$Button15.location               = New-Object System.Drawing.Point(10,430)
$Button15.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button15.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button15.Add_Click({start-process })

#Klick CMD
$CMD                             = New-Object system.Windows.Forms.Button
$CMD.text                        = "CMD"  
$CMD.width                       = 110
$CMD.height                      = 23
$CMD.location                    = New-Object System.Drawing.Point(120,10)
$CMD.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$CMD.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$CMD.Add_Click({start-process C:\Windows\System32\cmd.exe})

#Klick Powershell ISE
$PWISE                           = New-Object system.Windows.Forms.Button
$PWISE.text                      = "Powershell ISE"  
$PWISE.width                     = 110
$PWISE.height                    = 23
$PWISE.location                  = New-Object System.Drawing.Point(120,40)
$PWISE.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$PWISE.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$PWISE.Add_Click({start-process C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell_ise.exe})

#Klick Powershell
$Powershell                      = New-Object system.Windows.Forms.Button
$Powershell.text                 = "Powershell"  
$Powershell.width                = 110
$Powershell.height               = 23
$Powershell.location             = New-Object System.Drawing.Point(120,70)
$Powershell.Font                 = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Powershell.BackColor            = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Powershell.Add_Click({start-process C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe})

#Klick Foits DB
$Foits                           = New-Object system.Windows.Forms.Button
$Foits.text                      = "Foits DB"  
$Foits.width                     = 110
$Foits.height                    = 23
$Foits.location                  = New-Object System.Drawing.Point(120,100)
$Foits.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Foits.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Foits.Add_Click({start-process C:\OPT-Kopie\startFoitsDBneu.bat})

#Klick Button20
$Button20                        = New-Object system.Windows.Forms.Button
$Button20.text                   = "Button20"  
$Button20.width                  = 110
$Button20.height                 = 23
$Button20.location               = New-Object System.Drawing.Point(120,130)
$Button20.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button20.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button20.Add_Click({start-process })

#Klick Button21
$Button21                        = New-Object system.Windows.Forms.Button
$Button21.text                   = "Button21"  
$Button21.width                  = 110
$Button21.height                 = 23
$Button21.location               = New-Object System.Drawing.Point(120,160)
$Button21.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button21.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button21.Add_Click({start-process })

#Klick Button22
$Button22                        = New-Object system.Windows.Forms.Button
$Button22.text                   = "Button22"  
$Button22.width                  = 110
$Button22.height                 = 23
$Button22.location               = New-Object System.Drawing.Point(120,190)
$Button22.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button22.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button22.Add_Click({start-process })

#Klick Button23
$Button23                        = New-Object system.Windows.Forms.Button
$Button23.text                   = "Button23"  
$Button23.width                  = 110
$Button23.height                 = 23
$Button23.location               = New-Object System.Drawing.Point(120,220)
$Button23.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button23.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button23.Add_Click({start-process })

#Klick Button24
$Button24                        = New-Object system.Windows.Forms.Button
$Button24.text                   = "Button24"  
$Button24.width                  = 110
$Button24.height                 = 23
$Button24.location               = New-Object System.Drawing.Point(120,250)
$Button24.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button24.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button24.Add_Click({start-process })

#Klick Button25
$Button25                        = New-Object system.Windows.Forms.Button
$Button25.text                   = "Button25"  
$Button25.width                  = 110
$Button25.height                 = 23
$Button25.location               = New-Object System.Drawing.Point(120,280)
$Button25.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button25.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button25.Add_Click({start-process })

#Klick Button26
$Button26                        = New-Object system.Windows.Forms.Button
$Button26.text                   = "Button26"  
$Button26.width                  = 110
$Button26.height                 = 23
$Button26.location               = New-Object System.Drawing.Point(120,310)
$Button26.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button26.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button26.Add_Click({start-process })

#Klick Button27
$Button27                        = New-Object system.Windows.Forms.Button
$Button27.text                   = "Button27"  
$Button27.width                  = 110
$Button27.height                 = 23
$Button27.location               = New-Object System.Drawing.Point(120,340)
$Button27.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button27.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button27.Add_Click({start-process })

#Klick Button28
$Button28                        = New-Object system.Windows.Forms.Button
$Button28.text                   = "Button28"  
$Button28.width                  = 110
$Button28.height                 = 23
$Button28.location               = New-Object System.Drawing.Point(120,370)
$Button28.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button28.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button28.Add_Click({start-process })

#Klick Button29
$Button29                        = New-Object system.Windows.Forms.Button
$Button29.text                   = "Button29"  
$Button29.width                  = 110
$Button29.height                 = 23
$Button29.location               = New-Object System.Drawing.Point(120,400)
$Button29.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button29.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button29.Add_Click({start-process })

#Klick User Account
$Button30                        = New-Object system.Windows.Forms.Button
$Button30.text                   = "User Account"  
$Button30.width                  = 110
$Button30.height                 = 23
$Button30.location               = New-Object System.Drawing.Point(120,430)
$Button30.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button30.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Button30.Add_Click({& '.C:\OPT-Kopie\Powershell\UserAccount.ps1'})  

#####################################################################################################################################
#Eingabe Rechnername oder Username


$Label1                          = New-Object system.Windows.Forms.Label
$Label1.text                     = "Eingabe Rechnername"  
$Label1.AutoSize                 = $true
$Label1.width                    = 110
$Label1.height                   = 23
$Label1.location                 = New-Object System.Drawing.Point(10,5)
$Label1.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Label1.ForeColor                = [System.Drawing.ColorTranslator]::FromHtml("#0C0C0C")  

$Label2                          = New-Object system.Windows.Forms.Label
$Label2.text                     = "Eingabe Username"  
$Label2.AutoSize                 = $true
$Label2.width                    = 110
$Label2.height                   = 23
$Label2.location                 = New-Object System.Drawing.Point(300,5)
$Label2.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Label2.ForeColor                = [System.Drawing.ColorTranslator]::FromHtml("#0C0C0C")  

$Groupbox2                       = New-Object system.Windows.Forms.Groupbox
$Groupbox2.height                = 510
$Groupbox2.width                 = 820
$Groupbox2.location              = New-Object System.Drawing.Point(250,10)
$Groupbox2.BackColor             = [System.Drawing.ColorTranslator]::FromHtml("#dff9f2")  

$TextBox1                       = New-Object system.Windows.Forms.TextBox
$TextBox1.width                 = 200
$TextBox1.height                = 23
$TextBox1.location              = New-Object System.Drawing.Point(10,30)
$TextBox1.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$TextBox2                       = New-Object system.Windows.Forms.TextBox
$TextBox2.width                 = 200
$TextBox2.height                = 23
$TextBox2.location              = New-Object System.Drawing.Point(300,30)
$TextBox2.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$Listbox1                       = New-Object system.Windows.Forms.Listbox
$Listbox1.width                 = 800
$Listbox1.height                = 450
$Listbox1.location              = New-Object System.Drawing.Point(10,60)
$Listbox1.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$Reset                           = New-Object system.Windows.Forms.Button
$Reset.text                      = "Reset"  
$Reset.width                     = 110
$Reset.height                    = 23
$Reset.location                  = New-Object System.Drawing.Point(550,30)
$Reset.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Reset.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  

$Form.controls.AddRange(@($FileEx,$Explorer,$MMC,$CCfCC,$SCCM,$MSRA,$ISE,$Button8,$Button9,$Button10,$Button11,$Button12,$Button13,$Button14,$Button15,$CMD,$PWISE,$Powershell,$Foits,$Button20,$Button21,$Button22,$Button23,$Button24,$Button25,$Button26,$Button27,$Button28,$Button29,$Button30,$Label7,$Groupbox2))
$Groupbox2.controls.AddRange(@($Label1,$Label2,$TextBox1,$TextBox2,$Listbox1,$Reset))

[void]$Form.ShowDialog()
################################################################################################
#Abfrage
################################################################################################



<#
Param
(
[String]$Computer = "LocalHost"  # entspricht $Computer = "."  
)

$Line = "`n" # Zeilenumbruch schreiben  

Function Get-ComputerInfo
{
$Line + "COMPUTER:"  
"---------"  
# collect computer data:
$colItems = Get-WmiObject -class win32_ComputerSystem -Computername $Computer

Foreach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Model                : " + $objItem.Model  
"Name                 : " + $objItem.Name  
"Domain               : " + $objItem.Domain  
"Number of processors : " + $objItem.NumberOfProcessors  
"Physical memory      : " + [Math]::Round($objItem.TotalPhysicalMemory/1GB, 2) + " GB"  
"System type          : " + $objItem.SystemType  
$Line
} #ForEach
} #Function


Function Get-DiskInfo
{
$Line + "DISK:"  
"-----"  
# collect disk data:
$colItems = Get-WmiObject -class win32_DiskDrive -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Model                : " + $objItem.Model  
"Disk name            : " + $objItem.Name  
"Mediatype            : " + $objItem.MediaType  
"Partitions           : " + $objItem.Partitions  
"Size                 : " + [Math]::Round($objItem.Size/1GB,2) + " GB"  
$Line
} #ForEach
} #Function


Function Get-GraphicsInfo
{
$Line + "GRAPHICS:"  
"---------"  
# collect grafics data:
$colItems = Get-WmiObject -class cim_PCVideoController -Computername $Computer

ForEach($objItem in $colItems)
{
"Name                 : " + $objItem.Name  
"Resolution horizontal: " + $objItem.CurrentHorizontalResolution + " pixels"  
"Resolution vertical  : " + $objItem.CurrentVerticalResolution + " pixels"  
"Refresh rate         : " + $objItem.CurrentRefreshRate + " Hz"  
$Line
} #ForEach
} #Function


Function Get-ProcessorInfo
{
$line + "PROCESSOR:"  
"----------"  
# collect processor data
$colItems = Get-WmiObject -class win32_Processor -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name.Trim()  
"Version              : " + $objItem.Version  
"Clock speed          : " + $objItem.CurrentClockSpeed + " Hz"  
"Voltage              : " + $objItem.CurrentVoltage + " V"  
"Data width           : " + $objItem.Datawidth + " bit"  
"Number of cores      : " + $objItem.NumberOfCores  
"Logical Processors   : " + $objItem.NumberOfLogicalProcessors  
$Line
} #ForEach
} #Function


Function Get-OSInfo
{
$Line + "OPERATING SYSTEM:"  
"-----------------"  
# collect OS data
$colItems = Get-WmiObject -class win32_OperatingSystem -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name  
"Version              : " + $objItem.Version  
"Build number         : " + $objItem.BuildNumber  
"Build type           : " + $objItem.BuildType  
"Code set             : " + $objItem.CodeSet  
"System directory     : " + $objItem.SystemDirectory  
"Total virtual memory : " + [Math]::Round($objItem.TotalVirtualMemorySize/1MB,2) + " MB"  
"Serial number        : " + $objItem.SerialNumber  
$Line
} #ForEach
} #Function


Function Get-BiosInfo
{
$Line + "BIOS:"  
"-----"  
# collect BIOS data
$colItems = Get-WmiObject -class win32_Bios -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name  
"Serial number        : " + $objItem.SerialNumber  
$Line
} #ForEach
} #Function


Function Get-NetworkInfo
{
$Line + "NETWORK:"  
"--------"  
# collect network data (only if available)
$colItems = Get-WmiObject Win32_NetworkAdapterConfiguration -Computername $Computer | where{$_.IPEnabled -eq "True"}  

ForEach($objItem in $colItems)
{
"Description         :" + $objItem.Description  
"DHCP enabled        :" + $objItem.DHCPEnabled  
"DHCP server         :" + $objItem.DHCPServer  
"IP address          :" + $objItem.IPAddress  
"Sub net mask        :" + $objItem.IPSubnet  
"Dafault gateway     :" + $objItem.DefaultIPGateway  
"DNS domain          :" + $objItem.DNSDomain  
"DNS host            :" + $objItem.DNSHostName  
"MAC address         :" + $objItem.MACAddress  
$Line
} #ForEach
} #Function


# and here we go
Get-ComputerInfo
Get-DiskInfo
Get-GraphicsInfo
Get-ProcessorInfo
Get-OSInfo
Get-BiosInfo
Get-NetworkInfo

#>

Content-Key: 1460338979

Url: https://administrator.de/contentid/1460338979

Printed on: April 19, 2024 at 23:04 o'clock

Member: Lochkartenstanzer
Lochkartenstanzer Nov 03, 2021 updated at 07:29:51 (UTC)
Goto Top
Member: chkdsk
chkdsk Nov 03, 2021 at 07:47:01 (UTC)
Goto Top
Wie LKS schon angemerkt hat bitte Code Tags verwenden. Da sieht ja sonst keiner durch.

Bzgl. deines Problems...was möchtest du denn genau? Soll das Skript unter Angabe des PC Namens/IP auf dem remote PC ausgeführt werden oder lokal.
Member: aqui
aqui Nov 03, 2021 updated at 08:13:55 (UTC)
Goto Top
FAQs mal zu lesen wir heutzutage überbewertet ! Rubrik Batch & Shell wäre sicher auch zielführender gewesen...aber für beides gibts ja glücklicherweise den "Bearbeiten" Knopf hier !!
Member: mrjohndo
mrjohndo Nov 03, 2021 at 11:14:26 (UTC)
Goto Top
Zitat von @chkdsk:

Wie LKS schon angemerkt hat bitte Code Tags verwenden. Da sieht ja sonst keiner durch.

Bzgl. deines Problems...was möchtest du denn genau? Soll das Skript unter Angabe des PC Namens/IP auf dem remote PC ausgeführt werden oder lokal.

Wenn ich Rechnername oder Username eingebe sollen remote PC ausgelesen werden
z.b. IP, MAC, SN usw das kann ich mir anpassen, ab PARAM steht schon einiges das ich gerne verwenden möchte, nur wie stelle ich das an ich weiß mit einer abfrage aber welche
Member: mrjohndo
mrjohndo Nov 03, 2021 at 11:22:21 (UTC)
Goto Top
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
Add-Type -AssemblyName System.Drawing
[Windows.Forms.Application]::EnableVisualStyles()

#Als Administrator ausführen
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
    {   
        $arguments = "& '" + $myinvocation.mycommand.definition + "'"  
        Start-Process powershell -Verb runAs -ArgumentList $arguments
        Break
    }

$Form                            = New-Object system.Windows.Forms.Form
$Form.ClientSize                 = New-Object System.Drawing.Point(1100,600)
$Form.text                       = "Foits Start"  
$Form.TopMost                    = $false
$Form.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#07326c")  

#Klick Button FileEx
$FileEx                          = New-Object system.Windows.Forms.Button
$FileEx.text                     = "FileEx"  
$FileEx.width                    = 110
$FileEx.height                   = 23
$FileEx.location                 = New-Object System.Drawing.Point(10,10)
$FileEx.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$FileEx.BackColor                = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$FileEx.Add_Click({start-process C:\OPT-Kopie\FreeCommander\FreeCommander.exe})

#Klick Button Explorer++
$Explorer                        = New-Object system.Windows.Forms.Button
$Explorer.text                   = "Explorer++"  
$Explorer.width                  = 110
$Explorer.height                 = 23
$Explorer.location               = New-Object System.Drawing.Point(10,40)
$Explorer.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Explorer.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Explorer.Add_Click({start-process C:\OPT-Kopie\Explorer++\Explorer++.exe})

#Klick Button MMC
$MMC                             = New-Object system.Windows.Forms.Button
$MMC.text                        = "MMC"  
$MMC.width                       = 110
$MMC.height                      = 23
$MMC.location                    = New-Object System.Drawing.Point(10,70)
$MMC.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$MMC.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$MMC.Add_Click({start-process C:\Windows\System32\mmc.exe})

#Klick Button CCfCC
$CCfCC                           = New-Object system.Windows.Forms.Button
$CCfCC.text                      = "CCfCC"  
$CCfCC.width                     = 110
$CCfCC.height                    = 23
$CCfCC.location                  = New-Object System.Drawing.Point(10,100)
$CCfCC.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$CCfCC.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$CCfCC.Add_Click({start-process C:\OPT-Kopie\CCfCC.cmd})

#Klick Button SCCM
$SCCM                            = New-Object system.Windows.Forms.Button
$SCCM.text                       = "SCCM"  
$SCCM.width                      = 110
$SCCM.height                     = 23
$SCCM.location                   = New-Object System.Drawing.Point(10,130)
$SCCM.Font                       = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$SCCM.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$SCCM.Add_Click({start-process -FilePath C:\Programme x86\Microsoft Configuration Manager\AdminConsole\bin\Microsoft.ConfigurationManagement.exe})

#Klick Button MSRA
$MSRA                            = New-Object system.Windows.Forms.Button
$MSRA.text                       = "MSRA"  
$MSRA.width                      = 110
$MSRA.height                     = 23
$MSRA.location                   = New-Object System.Drawing.Point(10,160)
$MSRA.Font                       = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$MSRA.BackColor                  = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$MSRA.Add_Click({start-process cmd.exe -ArgumentList "/C msra /offerra $Computer" -NoNewWindow})  

#Klick ISE
$ISE                             = New-Object system.Windows.Forms.Button
$ISE.text                        = "ISE"  
$ISE.width                       = 110
$ISE.height                      = 25
$ISE.location                    = New-Object System.Drawing.Point(10,190)
$ISE.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$ISE.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$ISE.Add_Click({start-process C:\OPT-Kopie\ISE.RDP})

#Klick Button8
$Button8                         = New-Object system.Windows.Forms.Button
$Button8.text                    = "Button8"  
$Button8.width                   = 110
$Button8.height                  = 23
$Button8.location                = New-Object System.Drawing.Point(10,220)
$Button8.Font                    = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button8.BackColor               = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button8.Add_Click({start-process })

#Klick Button9
$Button9                         = New-Object system.Windows.Forms.Button
$Button9.text                    = "Button9"  
$Button9.width                   = 110
$Button9.height                  = 23
$Button9.location                = New-Object System.Drawing.Point(10,250)
$Button9.Font                    = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button9.BackColor               = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button9.Add_Click({start-process })

#Klick Button10
$Button10                        = New-Object system.Windows.Forms.Button
$Button10.text                   = "Button10"  
$Button10.width                  = 110
$Button10.height                 = 23
$Button10.location               = New-Object System.Drawing.Point(10,280)
$Button10.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button10.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button10.Add_Click({start-process })

#Klick Button11
$Button11                        = New-Object system.Windows.Forms.Button
$Button11.text                   = "Button11"  
$Button11.width                  = 110
$Button11.height                 = 23
$Button11.location               = New-Object System.Drawing.Point(10,310)
$Button11.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button11.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button11.Add_Click({start-process })

#Klick Button12
$Button12                        = New-Object system.Windows.Forms.Button
$Button12.text                   = "Button12"  
$Button12.width                  = 110
$Button12.height                 = 23
$Button12.location               = New-Object System.Drawing.Point(10,340)
$Button12.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button12.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button12.Add_Click({start-process })

#Klick Button13
$Button13                        = New-Object system.Windows.Forms.Button
$Button13.text                   = "Button13"  
$Button13.width                  = 110
$Button13.height                 = 23
$Button13.location               = New-Object System.Drawing.Point(10,370)
$Button13.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button13.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button13.Add_Click({start-process })

#Klick Button14
$Button14                        = New-Object system.Windows.Forms.Button
$Button14.text                   = "Button14"  
$Button14.width                  = 110
$Button14.height                 = 23
$Button14.location               = New-Object System.Drawing.Point(10,400)
$Button14.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button14.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button14.Add_Click({start-process })

#Klick Button15
$Button15                        = New-Object system.Windows.Forms.Button
$Button15.text                   = "Button15"  
$Button15.width                  = 110
$Button15.height                 = 23
$Button15.location               = New-Object System.Drawing.Point(10,430)
$Button15.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button15.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button15.Add_Click({start-process })

#Klick CMD
$CMD                             = New-Object system.Windows.Forms.Button
$CMD.text                        = "CMD"  
$CMD.width                       = 110
$CMD.height                      = 23
$CMD.location                    = New-Object System.Drawing.Point(120,10)
$CMD.Font                        = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$CMD.BackColor                   = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$CMD.Add_Click({start-process C:\Windows\System32\cmd.exe})

#Klick Powershell ISE
$PWISE                           = New-Object system.Windows.Forms.Button
$PWISE.text                      = "Powershell ISE"  
$PWISE.width                     = 110
$PWISE.height                    = 23
$PWISE.location                  = New-Object System.Drawing.Point(120,40)
$PWISE.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$PWISE.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$PWISE.Add_Click({start-process C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell_ise.exe})

#Klick Powershell
$Powershell                      = New-Object system.Windows.Forms.Button
$Powershell.text                 = "Powershell"  
$Powershell.width                = 110
$Powershell.height               = 23
$Powershell.location             = New-Object System.Drawing.Point(120,70)
$Powershell.Font                 = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Powershell.BackColor            = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Powershell.Add_Click({start-process C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe})

#Klick Foits DB
$Foits                           = New-Object system.Windows.Forms.Button
$Foits.text                      = "Foits DB"  
$Foits.width                     = 110
$Foits.height                    = 23
$Foits.location                  = New-Object System.Drawing.Point(120,100)
$Foits.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Foits.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Foits.Add_Click({start-process C:\OPT-Kopie\startFoitsDBneu.bat})

#Klick Button20
$Button20                        = New-Object system.Windows.Forms.Button
$Button20.text                   = "Button20"  
$Button20.width                  = 110
$Button20.height                 = 23
$Button20.location               = New-Object System.Drawing.Point(120,130)
$Button20.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button20.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button20.Add_Click({start-process })

#Klick Button21
$Button21                        = New-Object system.Windows.Forms.Button
$Button21.text                   = "Button21"  
$Button21.width                  = 110
$Button21.height                 = 23
$Button21.location               = New-Object System.Drawing.Point(120,160)
$Button21.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button21.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button21.Add_Click({start-process })

#Klick Button22
$Button22                        = New-Object system.Windows.Forms.Button
$Button22.text                   = "Button22"  
$Button22.width                  = 110
$Button22.height                 = 23
$Button22.location               = New-Object System.Drawing.Point(120,190)
$Button22.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button22.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button22.Add_Click({start-process })

#Klick Button23
$Button23                        = New-Object system.Windows.Forms.Button
$Button23.text                   = "Button23"  
$Button23.width                  = 110
$Button23.height                 = 23
$Button23.location               = New-Object System.Drawing.Point(120,220)
$Button23.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button23.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button23.Add_Click({start-process })

#Klick Button24
$Button24                        = New-Object system.Windows.Forms.Button
$Button24.text                   = "Button24"  
$Button24.width                  = 110
$Button24.height                 = 23
$Button24.location               = New-Object System.Drawing.Point(120,250)
$Button24.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button24.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button24.Add_Click({start-process })

#Klick Button25
$Button25                        = New-Object system.Windows.Forms.Button
$Button25.text                   = "Button25"  
$Button25.width                  = 110
$Button25.height                 = 23
$Button25.location               = New-Object System.Drawing.Point(120,280)
$Button25.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button25.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button25.Add_Click({start-process })

#Klick Button26
$Button26                        = New-Object system.Windows.Forms.Button
$Button26.text                   = "Button26"  
$Button26.width                  = 110
$Button26.height                 = 23
$Button26.location               = New-Object System.Drawing.Point(120,310)
$Button26.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button26.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#C50F1F")  
$Button26.Add_Click({start-process })

#Klick User Account
$Button30                        = New-Object system.Windows.Forms.Button
$Button30.text                   = "User Account"  
$Button30.width                  = 110
$Button30.height                 = 23
$Button30.location               = New-Object System.Drawing.Point(120,430)
$Button30.Font                   = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Button30.BackColor              = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  
$Button30.Add_Click({& '.C:\OPT-Kopie\Powershell\UserAccount.ps1'})  
############################################################################ #Eingabe Rechnername oder Username

$Label1                          = New-Object system.Windows.Forms.Label
$Label1.text                     = "Eingabe Rechnername"  
$Label1.AutoSize                 = $true
$Label1.width                    = 110
$Label1.height                   = 23
$Label1.location                 = New-Object System.Drawing.Point(10,5)
$Label1.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Label1.ForeColor                = [System.Drawing.ColorTranslator]::FromHtml("#0C0C0C")  

$Label2                          = New-Object system.Windows.Forms.Label
$Label2.text                     = "Eingabe Username"  
$Label2.AutoSize                 = $true
$Label2.width                    = 110
$Label2.height                   = 23
$Label2.location                 = New-Object System.Drawing.Point(300,5)
$Label2.Font                     = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Label2.ForeColor                = [System.Drawing.ColorTranslator]::FromHtml("#0C0C0C")  

$Groupbox2                       = New-Object system.Windows.Forms.Groupbox
$Groupbox2.height                = 510
$Groupbox2.width                 = 820
$Groupbox2.location              = New-Object System.Drawing.Point(250,10)
$Groupbox2.BackColor             = [System.Drawing.ColorTranslator]::FromHtml("#dff9f2")  

$TextBox1                       = New-Object system.Windows.Forms.TextBox
$TextBox1.width                 = 200
$TextBox1.height                = 23
$TextBox1.location              = New-Object System.Drawing.Point(10,30)
$TextBox1.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$TextBox2                       = New-Object system.Windows.Forms.TextBox
$TextBox2.width                 = 200
$TextBox2.height                = 23
$TextBox2.location              = New-Object System.Drawing.Point(300,30)
$TextBox2.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$Listbox1                       = New-Object system.Windows.Forms.Listbox
$Listbox1.width                 = 800
$Listbox1.height                = 450
$Listbox1.location              = New-Object System.Drawing.Point(10,60)
$Listbox1.Font                  = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  

$Reset                           = New-Object system.Windows.Forms.Button
$Reset.text                      = "Reset"  
$Reset.width                     = 110
$Reset.height                    = 23
$Reset.location                  = New-Object System.Drawing.Point(550,30)
$Reset.Font                      = New-Object System.Drawing.Font('Microsoft Sans Serif',10)  
$Reset.BackColor                 = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")  

$Form.controls.AddRange(@($FileEx,$Explorer,$MMC,$CCfCC,$SCCM,$MSRA,$ISE,$Button8,$Button9,$Button10,$Button11,$Button12,$Button13,$Button14,$Button15,$CMD,$PWISE,$Powershell,$Foits,$Button20,$Button21,$Button22,$Button23,$Button24,$Button25,$Button26,$Button27,$Button28,$Button29,$Button30,$Label7,$Groupbox2))
$Groupbox2.controls.AddRange(@($Label1,$Label2,$TextBox1,$TextBox2,$Listbox1,$Reset))

[void]$Form.ShowDialog()
################################################################################################
#Abfrage
############################################################################
Param
(
[String]$Computer = "LocalHost"  # entspricht $Computer = "."  
)
$Line = "`n" # Zeilenumbruch schreiben  

Function Get-ComputerInfo
{
$Line + "COMPUTER:"  
"---------"  
$colItems = Get-WmiObject -class win32_ComputerSystem -Computername $Computer

Foreach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Model                : " + $objItem.Model  
"Name                 : " + $objItem.Name  
"Domain               : " + $objItem.Domain  
"Number of processors : " + $objItem.NumberOfProcessors  
"Physical memory      : " + [Math]::Round($objItem.TotalPhysicalMemory/1GB, 2) + " GB"  
"System type          : " + $objItem.SystemType  
$Line
} #ForEach
} #Function

Function Get-DiskInfo
{
$Line + "DISK:"  
"-----"  
$colItems = Get-WmiObject -class win32_DiskDrive -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Model                : " + $objItem.Model  
"Disk name            : " + $objItem.Name  
"Mediatype            : " + $objItem.MediaType  
"Partitions           : " + $objItem.Partitions  
"Size                 : " + [Math]::Round($objItem.Size/1GB,2) + " GB"  
$Line
} #ForEach
} #Function

Function Get-GraphicsInfo
{
$Line + "GRAPHICS:"  
"---------"  
$colItems = Get-WmiObject -class cim_PCVideoController -Computername $Computer

ForEach($objItem in $colItems)
{
"Name                 : " + $objItem.Name  
"Resolution horizontal: " + $objItem.CurrentHorizontalResolution + " pixels"  
"Resolution vertical  : " + $objItem.CurrentVerticalResolution + " pixels"  
"Refresh rate         : " + $objItem.CurrentRefreshRate + " Hz"  
$Line
} #ForEach
} #Function

Function Get-ProcessorInfo
{
$line + "PROCESSOR:"  
"----------"  
$colItems = Get-WmiObject -class win32_Processor -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name.Trim()  
"Version              : " + $objItem.Version  
"Clock speed          : " + $objItem.CurrentClockSpeed + " Hz"  
"Voltage              : " + $objItem.CurrentVoltage + " V"  
"Data width           : " + $objItem.Datawidth + " bit"  
"Number of cores      : " + $objItem.NumberOfCores  
"Logical Processors   : " + $objItem.NumberOfLogicalProcessors  
$Line
} #ForEach
} #Function

Function Get-OSInfo
{
$Line + "OPERATING SYSTEM:"  
"-----------------"  
$colItems = Get-WmiObject -class win32_OperatingSystem -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name  
"Version              : " + $objItem.Version  
"Build number         : " + $objItem.BuildNumber  
"Build type           : " + $objItem.BuildType  
"Code set             : " + $objItem.CodeSet  
"System directory     : " + $objItem.SystemDirectory  
"Total virtual memory : " + [Math]::Round($objItem.TotalVirtualMemorySize/1MB,2) + " MB"  
"Serial number        : " + $objItem.SerialNumber  
$Line
} #ForEach
} #Function

Function Get-BiosInfo
{
$Line + "BIOS:"  
"-----"  
$colItems = Get-WmiObject -class win32_Bios -Computername $Computer

ForEach($objItem in $colItems)
{
"Manufacturer         : " + $objItem.Manufacturer  
"Name                 : " + $objItem.Name  
"Serial number        : " + $objItem.SerialNumber  
$Line
} #ForEach
} #Function

Function Get-NetworkInfo
{
$Line + "NETWORK:"  
"--------"  
$colItems = Get-WmiObject Win32_NetworkAdapterConfiguration -Computername $Computer | where{$_.IPEnabled -eq "True"}  

ForEach($objItem in $colItems)
{
"Description         :" + $objItem.Description  
"DHCP enabled        :" + $objItem.DHCPEnabled  
"DHCP server         :" + $objItem.DHCPServer  
"IP address          :" + $objItem.IPAddress  
"Sub net mask        :" + $objItem.IPSubnet  
"Dafault gateway     :" + $objItem.DefaultIPGateway  
"DNS domain          :" + $objItem.DNSDomain  
"DNS host            :" + $objItem.DNSHostName  
"MAC address         :" + $objItem.MACAddress  
$Line
} #ForEach
} #Function

Get-ComputerInfo
Get-DiskInfo
Get-GraphicsInfo
Get-ProcessorInfo
Get-OSInfo
Get-BiosInfo
Get-NetworkInfo
Member: chkdsk
chkdsk Nov 03, 2021 at 11:50:36 (UTC)
Goto Top
Schau dir dein Skript nochmal genau an. Eigentlich steht da schon alles direkt drin bspw. Zeile 358
Get-WmiObject -class win32_ComputerSystem -Computername $Computer
$Computer erwartet einen Namen/IP etc. den du ja schon in deiner GUI eingibst
Member: mrjohndo
mrjohndo Nov 03, 2021 at 12:02:36 (UTC)
Goto Top
wenn ich in die TextBox Rechnername eingebe bekomme ich keine Ausgabe in der Listbox
Member: mrjohndo
Solution mrjohndo Nov 04, 2021 at 13:48:45 (UTC)
Goto Top
Wenn ich in Zeile 315 - Textbox1 den Rechnername eintrage, soll in Zeile 327 - Listbox1 das Ergebnis erscheinen und zwar ab Zeile 348 und da liegt mein Problem ich weiß nicht wie man das macht bzw ich brauche ein Tipp wie man Textbox und Listbox mit einbindet