Product: PowerShell Studio 2018 (64 Bit)
Build: v5.5.155
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.16299.0
We have a PowerShell Studio form that has many tabs and over 50 buttons. We want to keep users out of active directory so I want to add a button that when pressed will search for AD groups but only AD groups that begin with SCCM. Then, based on the group they choose it will add their machine to that group. I know how to do all of the PowerShell scripting to add the system but how do you make your button read AD and then capture their choice into a $variable?
Click button and search AD
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.
Re: Click button and search AD
[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Click button and search AD
Yes, that part is easy. I can get the groups and display them in the Richtext window. But then you have to copy/paste the group name into another textbox and then click yet another button. I want to click 1 button that does everything. Or is that not possible?
Re: Click button and search AD
Why do you have to copy and paste? What is it you are trying to do?
I recommend reading the articles on designing forms for administration.
https://info.sapien.com/index.php/guis/gui-design-best-practice/user-interface-design-for-administrators
Alos review the lists of articles available on the left menu of the web page. You will find more info on how to build forms and make them do what you need with very little coding.
I recommend reading the articles on designing forms for administration.
https://info.sapien.com/index.php/guis/gui-design-best-practice/user-interface-design-for-administrators
Alos review the lists of articles available on the left menu of the web page. You will find more info on how to build forms and make them do what you need with very little coding.
Re: Click button and search AD
It sounds to me like you want to display the groups in a ListBox and use the "SelectedIndexChanged" event to execute the code.mqh777 wrote: ↑Fri Oct 19, 2018 10:19 am Yes, that part is easy. I can get the groups and display them in the Richtext window. But then you have to copy/paste the group name into another textbox and then click yet another button. I want to click 1 button that does everything. Or is that not possible?
Read the Spotlight article on ListBoxes.
Re: Click button and search AD
ok, we're making progress. I have a listbox and 1 button. the button will query AD and get a list of groups. It then displays the groups in the listbox. The only problem is they are not listed 'one per line'. They are only 1/2 wide and all jumbled. How do you format the listbox so it looks like this?
AD group num1
AD group num2
AD group num3
AD group num1
AD group num2
AD group num3
Re: Click button and search AD
The first line in your code produces the red exclamation point and does not execute. Here is my code:
This returns the data but it is a 1/2 wide and all jumbled together. I've tried with/without sort-object and with/without -out-string and I get the same result.
Code: Select all
$buttonSCCMAppGroups_Click = {
$SCCMAppGroups = (Get-ADGroup -Filter { name -like "SCCMApp_*" }).name | Sort-Object
$ListSCCMGroups.Items.Add("$SCCMAppGroups")
}