Jump to content

need help creating a GUI for this Code!

Teletha

Hey i wonder if there's any skilled peeps here that can make a gui with the code bellow that has buttons included and that prints the answers/info inside the gui.

 

 
Code origin: https://gallery.technet.microsoft.com/scriptcenter/Get-Network-Information-of-6d07766f
    param (     [array]$arrComputer="$env:computername"     )          "`n"          Write-Host "Name|    NetworkCard                                  | IP          | SUBNET      | GateWay      | MacADD           | DNS "  -ForegroundColor Green   foreach ( $Computer in $arrComputer ) {            $nwINFO = Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder | format-Table * -AutoSize      #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder     $nwServerName = $nwINFO.DNSHostName     $nwDescrip = $nwINFO.Description     $nwIPADDR = $nwINFO.IPAddress     $nwSUBNET = $nwINFO.IpSubnet     $nwGateWay = $nwINFO.DefaultIPGateway     $nwMacADD = $nwINFO.MACAddress     $nwDNS = $nwINFO.DNSServerSearchOrder     #        Server/CompName   |NetworkCard | IPAdress  |  SubnetMask|  Gateway    | MAC Address|   DNS |     Write-Host "$nwServerName | $nwDescrip | $nwIPADDR | $nwSUBNET | $nwGateWay | $nwMacADD | $nwDNS " | ft *      } 

AMD Ryzen 7950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX TUF 4090 OC@3GHz [EKWB Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS 4x 18TB Seagate Exo Raid 10+Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | Copyright©1996-2024 Teletha All rights reserved. ®

Link to comment
Share on other sites

Link to post
Share on other sites

Simplest way:

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")param (     [array]$arrComputer="$env:computername" ) "`n" Write-Host "Name|    NetworkCard                                  | IP          | SUBNET      | GateWay      | MacADD           | DNS "  -ForegroundColor Green   foreach ( $Computer in $arrComputer ) {      $nwINFO = Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder | format-Table * -AutoSize      #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder     $nwServerName = $nwINFO.DNSHostName     $nwDescrip = $nwINFO.Description     $nwIPADDR = $nwINFO.IPAddress     $nwSUBNET = $nwINFO.IpSubnet     $nwGateWay = $nwINFO.DefaultIPGateway     $nwMacADD = $nwINFO.MACAddress     $nwDNS = $nwINFO.DNSServerSearchOrder     #        Server/CompName   |NetworkCard | IPAdress  |  SubnetMask|  Gateway    | MAC Address|   DNS |     Write-Host "$nwServerName | $nwDescrip | $nwIPADDR | $nwSUBNET | $nwGateWay | $nwMacADD | $nwDNS " | ft * 	[System.Windows.Forms.MessageBox]::Show("$nwServerName | $nwDescrip | $nwIPADDR | $nwSUBNET | $nwGateWay | $nwMacADD | $nwDNS ")}

Otherwise you will need to rewrite it in another language that supports graphical interfaces, do.. whatever with buttons it is that you want to do, and capture the powershell commands.

Link to comment
Share on other sites

Link to post
Share on other sites

Simplest way:

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")param (     [array]$arrComputer="$env:computername" ) "`n" Write-Host "Name|    NetworkCard                                  | IP          | SUBNET      | GateWay      | MacADD           | DNS "  -ForegroundColor Green   foreach ( $Computer in $arrComputer ) {      $nwINFO = Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder | format-Table * -AutoSize      #| Select-Object DNSHostName,Description,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder     $nwServerName = $nwINFO.DNSHostName     $nwDescrip = $nwINFO.Description     $nwIPADDR = $nwINFO.IPAddress     $nwSUBNET = $nwINFO.IpSubnet     $nwGateWay = $nwINFO.DefaultIPGateway     $nwMacADD = $nwINFO.MACAddress     $nwDNS = $nwINFO.DNSServerSearchOrder     #        Server/CompName   |NetworkCard | IPAdress  |  SubnetMask|  Gateway    | MAC Address|   DNS |     Write-Host "$nwServerName | $nwDescrip | $nwIPADDR | $nwSUBNET | $nwGateWay | $nwMacADD | $nwDNS " | ft * 	[System.Windows.Forms.MessageBox]::Show("$nwServerName | $nwDescrip | $nwIPADDR | $nwSUBNET | $nwGateWay | $nwMacADD | $nwDNS ")}

Otherwise you will need to rewrite it in another language that supports graphical interfaces, do.. whatever with buttons it is that you want to do, and capture the powershell commands.

there is a gui in powershell: http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898 

 

but im to bad to iplement it =/

AMD Ryzen 7950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX TUF 4090 OC@3GHz [EKWB Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS 4x 18TB Seagate Exo Raid 10+Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | Copyright©1996-2024 Teletha All rights reserved. ®

Link to comment
Share on other sites

Link to post
Share on other sites

Do you need help doing it yourself or do you want someone to make it for you? 

 

well it would be nice if some1 could make it but i don't know how hard it is to actually make it 

AMD Ryzen 7950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX TUF 4090 OC@3GHz [EKWB Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS 4x 18TB Seagate Exo Raid 10+Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | Copyright©1996-2024 Teletha All rights reserved. ®

Link to comment
Share on other sites

Link to post
Share on other sites

I warn against this for beginners. Powershell is a CLI driven language, be prepared for anything not CLI to be a real pain to code.

Link to comment
Share on other sites

Link to post
Share on other sites

there is a gui in powershell: http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898 

 

but im to bad to iplement it =/

You page you linked to 404's.

 

It shouldn't be too hard to implement a gui in powershell, since the code I added to your existing code was to add messageboxes.

If you need more help, check out this example.

 

Again, I recommend using something other than powershell if you need an interactive gui, it will be better in the long run. And you should be able to capture the output of powershell commands if you really need them, I've done it in C# applications in the past.

Link to comment
Share on other sites

Link to post
Share on other sites

well it would be nice if some1 could make it but i don't know how hard it is to actually make it 

 

If you can't do it yourself or can't get someone to do it for free, there are many freelance sites where you can pay someone to do it for you.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×