hi
I can't get the result of my script in the datagridview.
I would like it to display the displayname value in the datagridview
THANKS
$rules=Get-NetFirewallRule
$DisplayGroups=foreach ($rule in $rules){$rule.displaygroup}
$DisplayGroups | Select-Object -Unique
datagridwiew result
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.
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: datagridwiew result
you do not have any datagrid in your code, try this
$DisplayGroups | out-gridview
$DisplayGroups | out-gridview
Re: datagridwiew result
hi
thank you but don t work
my code
$rules = Get-NetFirewallRule
$DisplayGroups = foreach ($rule in $rules) { $rule.displaygroup }
$DisplayGroups | Select-Object -Unique
Update-DataGridView -DataGridView $datagridview1 -Item $DisplayGroups
Update-DataGridView: Failed to validate argument on parameter 'Item'. Argument is null or an element of argument collection
ERROR: contains a null value. Specify a collection that does not contain a null value and try again.
ERROR: At character C:\Users\orabache\Videos\SAPIEN\PowerShell Studio\Files\firewall\firewall.Run.ps1:346: 58
when i debug the value n is empty pad
thank you but don t work
my code
$rules = Get-NetFirewallRule
$DisplayGroups = foreach ($rule in $rules) { $rule.displaygroup }
$DisplayGroups | Select-Object -Unique
Update-DataGridView -DataGridView $datagridview1 -Item $DisplayGroups
Update-DataGridView: Failed to validate argument on parameter 'Item'. Argument is null or an element of argument collection
ERROR: contains a null value. Specify a collection that does not contain a null value and try again.
ERROR: At character C:\Users\orabache\Videos\SAPIEN\PowerShell Studio\Files\firewall\firewall.Run.ps1:346: 58
when i debug the value n is empty pad
Re: datagridwiew result
I changed the code variable
and it only shows me the length of the result string
and it only shows me the length of the result string
Re: datagridwiew result
The issue is tat you are not working with "Object" or "PsObject" collections:. Tiese objects are "CIM" objects,
See:
TypeName: Selected.Microsoft.Management.Infrastructure.CimInstance
See:
TypeName: Selected.Microsoft.Management.Infrastructure.CimInstance
- Name MemberType Definition
- ---- ---------- ----------
- Equals Method bool Equals(System.Object obj)
- GetHashCode Method int GetHashCode()
- GetType Method type GetType()
- ToString Method string ToString()
- DisplayName NoteProperty System.String DisplayName=Wi-Fi Direct Spooler Use (Out)
- Name NoteProperty string Name=WFDPRINT-SPOOL-Out-Active