Page 1 of 1

Combobox won't populate after packaging

Posted: Mon Oct 19, 2015 5:35 am
by wayne_Avery
Stats
Powershell Studio 2012
Version 3.1.35
Windows 7 64 bit

I have made a form with a combobox that populates from an arraylist. The list is a bunch of samAccountNames from AD. In design it works fine however when I package the project the Combobox fails to populate. Any ideas what I may be missing? Code as follows:

Code: Select all

$group = [ADSI] "LDAP://CN=ADSecurityGroup,OU=xx,DC=xx,DC=xx,DC=xx" 
$group.cn
$myArrayList = New-Object System.Collections.ArrayList
$group.cn  
    foreach ($member in $group.member) 
        { 	
            $Uname = new-object directoryservices.directoryentry("LDAP://$member") 
			$myArrayList .Add($Uname.samAccountName)
            $Uname.samAccountName 
        }
		$myArrayList = $myArrayList | sort
		Load-ComboBox $cboUserList $myArrayList -Append
Thanks
Wayne

Combobox won't populate after packaging

Posted: Mon Oct 19, 2015 5:35 am
by SAPIEN Support Forums
This is an automated post. A real person will respond soon.

Thank you for posting, wayne_Avery.

Did you remember to include the following?
  • 1. Product, version and build (e.g. Product: PowerShell Studio 2014, Version & Build: 4.1.71. Version and build information can be found in the product's About box accessed by clicking the blue icon with the 'i' in the upper right hand corner of the ribbon.)
    2. Specify if you are running a 32 or 64 bit version
    3. Specify your operating system and if it is 32 or 64 bit.
    4. Attach a screenshot if your issue can be seen on the screen
    5. Attach a zip file if you have multiple files (crash reports, log entries, etc.) related to your issue.
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***

Re: Combobox won't populate after packaging

Posted: Tue Oct 20, 2015 3:55 am
by wayne_Avery
Since posting this yesterday I have found that my compiled powershell script (and combobox) actually works as it should if I run it from a local drive. The combobox still refuses to populate if ran from a network drive. Any suggestions appreciated.

Regards
Wayne

Re: Combobox won't populate after packaging

Posted: Tue Oct 20, 2015 8:29 am
by davidc
I moved this post to the PowerShell GUIs forum in hopes that an AD expert can chime in.

David

Re: Combobox won't populate after packaging

Posted: Tue Oct 20, 2015 9:35 am
by jvierra
How are you running this when you say you are running it from a network drive?

There is no difference in Windows in how a form works when run from a local versus a UNC location assuming nothing is wrong with your installation and no Group Policy or permissions are blocking youo.

Re: Combobox won't populate after packaging

Posted: Tue Oct 20, 2015 9:40 am
by jvierra
The following approach would be less prone to errors.
PowerShell Code
Double-click the code block to select all.
$group = [ADSI] "LDAP://CN=ADSecurityGroup,OU=xx,DC=xx,DC=xx,DC=xx"
$members=foreach ($member in $group.member) {
	[adsi]"LDAP://$member"
}
$cboUserList.DataSource = [collections.arraylist]@($members)
$cboUserList.DisplayMember='SamAccountName'

Re: Combobox won't populate after packaging

Posted: Tue Oct 20, 2015 10:26 am
by jvierra
Here is a demo of a method that will function correctly on all servers and workstations.

Edit the group path and build to test.

Re: Combobox won't populate after packaging

Posted: Wed Oct 21, 2015 4:01 am
by wayne_Avery
Many thanks for assistance but today we worked it out. Our environment is transitioning to a new domain. If I put the executable on a server in the same domain as where I am calling AD it worked fine. It will have something to do with trusts between the 2 domains but I needn't bother at this point as the migration should be completed soon.
Cheers
Wayne