Forms, text boxes and get-gpo

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 4 years and 10 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
Tnt48185
Posts: 17
Last visit: Mon May 13, 2019 7:38 am

Re: Forms, text boxes and get-gpo

Post by Tnt48185 »

I forgot to change the get-gpo line to get-gpo -all. The results are the same, this just runs quicker for testing.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms, text boxes and get-gpo

Post by jvierra »

Please read the red box at the top of this topic. It asks to post large amounts of code as an attached PS1 file. Copying large amounts of code is almost impossible to do without errors.

Please edit your post with the full code and add it as an attachment
Tnt48185
Posts: 17
Last visit: Mon May 13, 2019 7:38 am

Re: Forms, text boxes and get-gpo

Post by Tnt48185 »

Dang it, and $searchterm = $txtbox.text
Not $txtbox1.text
Tnt48185
Posts: 17
Last visit: Mon May 13, 2019 7:38 am

Re: Forms, text boxes and get-gpo

Post by Tnt48185 »

Ok, reposting as attachment with corrections... just noting however, my red box states to either use select code or attach...
script.txt
(7.57 KiB) Downloaded 88 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms, text boxes and get-gpo

Post by jvierra »

Here is an example of how to enumerate this and create a form that gives you decent feedback. I changed the code to use "All". It is fast and easier to understand.

See attached.

Also take some time to learn how to write PowerShell code. You are copying and guessing which makes things much more difficult for you,
Attachments
gpo_sample.ps1
(1.26 KiB) Downloaded 69 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms, text boxes and get-gpo

Post by jvierra »

Tnt48185 wrote: Fri May 10, 2019 9:11 am Ok, reposting as attachment with corrections... just noting however, my red box states to either use select code or attach...script.txt
Post code as a function PS1 file and not just some text. Remember that technical help requires some assistance from the one asking for help to make the job easier for us. We cannot guess at what is in you mind.
Tnt48185
Posts: 17
Last visit: Mon May 13, 2019 7:38 am

Re: Forms, text boxes and get-gpo

Post by Tnt48185 »

I can not attach a .ps1 file as I am blocked from doing so. You can’t change a file extension after downloading??? Thanks for the help but really? It is getting a little ridiculous. It is as though you keep having me re-post until I give up and you never really answer the question...
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms, text boxes and get-gpo

Post by jvierra »

Tnt48185 wrote: Fri May 10, 2019 9:20 am I can not attach a .ps1 file as I am blocked from doing so. You can’t change a file extension after downloading??? Thanks for the help but really? It is getting a little ridiculous. It is as though you keep having me re-post until I give up and you never really answer the question...
Delete the TXT file and upload a new PS1 file. You can't rename a file once uploaded.
Tnt48185
Posts: 17
Last visit: Mon May 13, 2019 7:38 am

Re: Forms, text boxes and get-gpo

Post by Tnt48185 »

I cannot upload a ps1 on my network. It is not allowed by policy. All you have to do is change the dang extension or copy and paste or download, save as....
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms, text boxes and get-gpo

Post by jvierra »

Tnt48185 wrote: Fri May 10, 2019 9:43 am I cannot upload a ps1 on my network. It is not allowed by policy. All you have to do is change the dang extension or copy and paste or download, save as....
Oh. You network won't allow you to "upload" a PS1.

The code I posted should demonstrate everything you need to understand how the code should work.
This topic is 4 years and 10 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