I have a weird problem. Basically I created a form where it asks for a computer name and then when the user clicks on the OK button, it's supposed to grab the users of the "offer Remote assistance helpers" group of that computer and write it in the text box.
The code grabs the users and writes it in the textbox, but instead of stopping, it re-runs and adds the same users in the text box. So I end up with duplicate users. I tried everything and couldn't come up with a solution.
Any help would be appreciated.
- $timer_Tick = {
- [TimeSpan]$span = $script:StartTime - (Get-Date)
- if ($span.TotalSeconds -le 0)
- {
- $timer.Stop()
- }
- $Users = @()
- $OfferGroup = [ADSI]"WinNT://$ComputerName/Offer Remote Assistance Helpers,group"
- $Members = @($OfferGroup.psbase.Invoke("Members"))
- $Members | ForEach-Object {
- $txtboxUsers.AppendText($_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null))
- $txtboxUsers.AppendText("`n")
- }
- }
Authenticated Users
Administrators
Users
Authenticated Users
Administrators
Users
Product, version and build: PowerShell Studio 2016, 5.2.124
32 or 64 bit version of product: 64 bit
Operating system:
32 or 64 bit OS: 64 bit
PowerShell Version: 4
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM