get network details from remote server using form

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Tamimh
Posts: 8
Last visit: Mon Dec 13, 2021 2:08 am

get network details from remote server using form

Post by Tamimh »

Product, version and build:powershell studio 2016 v 5.2.128
Operating system: windows 10
PowerShell version(s):5.0
32-bit version of software?no

Hi
I'm trying to build a form that will query a remote server for its network settings, however I'm not getting the desired output.
I'm getting a column "Length"
  1. $form1_Load={
  2.     #TODO: Initialize Form Controls here
  3.    
  4. }
  5.  
  6. $Credentials_Click={
  7.     #TODO: Place custom script here
  8.     $global:cred = Get-Credential
  9. }
  10. $textboxComputerName_TextChanged={
  11.     #TODO: Place custom script here
  12.    
  13. }
  14.  
  15. $buttonNetwork_Click={
  16.  
  17.     $IP = (Get-WmiObject -ClassName Win32_NetworkAdapterConfiguration -ComputerName $textboxComputerName.Text -Credential $cred -Filter "IPEnabled = 'True'").IPAddress[0]
  18.    
  19.     Load-DataGridView -DataGridView $datagridview1 -Item $ip
  20. }
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: get network details from remote server using form

Post by brittneyr »

[Topic moved by moderator to PowerShell GUIs forum]
Brittney
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: get network details from remote server using form

Post by jvierra »

The prooblem is that you ahve a singular object and you are try8ing to use it like a collection. Either use a collection or add it as a wrapped array.

-Item (,$ip)
I haven;t tested as I never use the old loader method. For the grid direct assigment always works better and is easier.
User avatar
Tamimh
Posts: 8
Last visit: Mon Dec 13, 2021 2:08 am

Re: get network details from remote server using form

Post by Tamimh »

hmmm.. not sure I follow.
could you possibly write an example for what you suggest?
User avatar
Tamimh
Posts: 8
Last visit: Mon Dec 13, 2021 2:08 am

Re: get network details from remote server using form

Post by Tamimh »

tried that, but there is no change in the output
  1. Load-DataGridView -DataGridView $datagridview1 -Item ( ,$ip)
This topic is 2 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked