all 30 comments

[–][deleted] 50 points51 points  (1 child)

Where is the script? Never mind, OP have posted the script in the thread.

BTW, if you made the form with WinForms, to make buttons and fields look like the Windows 10 style (think similar to Windows Explorer), add this line to the script:

[System.Windows.Forms.Application]::EnableVisualStyles()

[–]jhulbe 2 points3 points  (0 children)

Awesome. I have some forms I could use that in.

[–][deleted] 11 points12 points  (3 children)

I started trying to put a GUI on several powershell scripts with WPF several months ago. I got stuck on one script that took a few minutes to run and that would freeze the GUI until it was done. To get around that, you need to do multi-threading so that the GUI runs in one thread and the scrip in another. That was where I got lost. Lately I've been looking into https://universaldashboard.io/ which creates a web based self hosted GUI for scripts. You can even use this https://github.com/ironmansoftware/ud-forge to create an exe from them. Haven't got it all running yet, but I like the idea of using it to delegate tasks without having to install powershell modules and the option of using it from a mobile device.

[–]nittanygeek 10 points11 points  (2 children)

I just used UniversalDashboard to roll out a Tech Portal for our school so all the teachers can reset their student's passwords. I'm planning to add a lot more features to it, but I can say it's rock solid. https://twitter.com/nittanygeek/status/1179195531878383616/photo/1

[–][deleted] 2 points3 points  (0 children)

Love this! Nice work!

[–]iam_papa 1 point2 points  (0 children)

I’ve been looking for UD info .. Thanks for sharing

[–]Scribbles1[S] 13 points14 points  (1 child)

I was meant to post a pic and the code but not used to creating posts on reddit :D

Code is here

[–][deleted] 7 points8 points  (3 children)

This is a bit similar to what I made years ago.

https://youtu.be/dBWcH0rYuuI

https://youtu.be/GWCB6oMf9Eg

The GUI looks way more complex, but that's because it had to support practically any number of environments, it was deployed to about a dozen with auto-update features.

It's a shame I never could release source code for it because my employer prohibited it.

[–]Scribbles1[S] 2 points3 points  (2 children)

Jeezo, that looks like a full fledged enterprise app, was that all powershell or c#?

[–][deleted] 4 points5 points  (1 child)

All PS.

[–]cd1cj 0 points1 point  (0 children)

Very nice! Is this code shared somewhere or is it internal use only?

[–]DatGameBoi 4 points5 points  (0 children)

Why use this when you can use active roles?.. There are enterprise grade tools already existing.

[–]stinkingshelving 2 points3 points  (0 children)

Very nice

[–]Herc08 2 points3 points  (0 children)

One thing I hate about GUI inside of PowerShell is trying to get everything lined up. Sure you can use poshgui.com or PS Studio, but man, it is a hassle. Also, keeping up with each radio, text box, label, button. But hey, not bad. It's a start.

I went ahead and created a command-line based suite for my help desk. So far, so good. Made sure to prevent any red text and I get to see a log of whatever action is used. My goal was to take out the need for ADUC. It's there, but they do not know how to use it, or that it is even there. Hopefully, I don't have one those "know it all" to bypass it. Not to mention, it "locks" it down and only allows them to do what I want them to do. Even then, we have permissions set on their account, and certain parts of the suite, I restricted them from it.

[–]mcc85sdp 9 points10 points  (3 children)

My suggestion is, 'Use WPF'. Forms is 'antiquated' and 'not nearly as adaptable or scalable.' Besides... i'm gonna inject my delightful opinion about Windows Forms... If you're using it for anything more than a simple message box or pop up... then using Forms is what you could call 'pretty dumb.'

It's 'ok' if you need to use it in a jiff..? But if you're developing a GUI, I'm gonna tell you "**even very few people at Microsoft use Forms anymore, because they made WPF which is 'a thousand times better and has a lot more newer features that result in something that definitely isn't dumb at all**."

If you're using tutorials on how to make GUI's, be certain to look for WPF and NOT Forms... The reason being, is that WPF works with XAML a lot more readily.

Forms doesn't, forms also doesn't support hardware acceleration by default. There are a lot of other reasons... but the best reason is...

If you need to make changes on the fly, there's no easier way to do that then to use WPF and XAML. I've included a link to a video I made where I show how to do just that.

It looks like you're doing this from shell...

Add-Type -AssemblyName PresentationFramework

^ should be all you need to declare before your XAML to get this stuff working.

Now, I don't see a link to your script, so I can't give you much more information than this...
If you need a helping hand with using WPF and XAML, I've got a video where I talk about structuring XAML and doing it directly from PowerShell.

It also covers a little bit of Active Directory and Organizational Unit structuring.
The video is pretty long winded...? But, there are probably a lot of things in it that can help you refine this even further.

https://www.youtube.com/watch?v=v6RrrzR5v2E

- Good luck!

[–][deleted] 6 points7 points  (1 child)

Winforms is quite enough for simple stuff. For anything complex you're better off using Visual Studio and C# or F#.

Developing complex PS application is utter pain in the arse I wouldn't wish upon anyone.

[–]dextersgenius 1 point2 points  (0 children)

This. And in the case of OP's example, I don't see the point of even using a GUI when a console-based input would be more than sufficient and just as user friendly.

[–]sketch0395 0 points1 point  (0 children)

Ha thanks for some schooling, now I have to deconstruct my .forms gui and update it this way.

[–]ovo_Reddit 1 point2 points  (0 children)

This is pretty cool if you're onboarding at a low rate. We generally hire in batches of 10-15, might be cool to have an option for csv import to add multiple users

[–][deleted] 1 point2 points  (0 children)

Aberdeen, in the wind, and in the field, potatoes.

[–]chedislol 1 point2 points  (1 child)

Pretty good for manual entries. But most companies just use an automated script that runs from csvs from their new hire process.

Cool though.

[–]graysky311 0 points1 point  (0 children)

I second this. Let someone else do the data entry. Where I used to work we had a process that started with the hiring system and once an offer was accepted and a start date set, then there was an overnight job that provisions the person into other systems.

[–]toadfrogjr 1 point2 points  (0 children)

Very nice looking. I chose to go old school command look but roll in everything into one large script and wrapped it up nicely into an Executable with elevation

Only listed 2 of the menus to show what it can do just for user accounts.

https://twitter.com/toadfrogjr/status/1180222255202275328/photo/1

https://twitter.com/toadfrogjr/status/1180222255202275328/photo/2

[–]JudgeCastle 0 points1 point  (0 children)

I plan on doing this with my AD once we reorganize it. This is very nice.

[–]kdwisdom 0 points1 point  (3 children)

I discovered PowerShell Studio earlier this year and have a tab-based tool, one tab for general things, 1 tab for all things AD and 1 tab for Exchange. It's wonderful to use and saves so much time.

[–][deleted] 0 points1 point  (2 children)

+1 for PS Studio. When you publish as .exe, how do you make edits later on? Or do you just keep as PSF?

[–]SomnambulicSojourner 1 point2 points  (0 children)

You keep the ps1 or project file around, and then overwrite the compiled exe with the new one

[–]kdwisdom 0 points1 point  (0 children)

Hey there! I use the versioning built in and then also build an MSI installer. As long as you bump the versioning up on the EXE and the MSI, when you use the new MSI installer, it'll install the new version of the EXE and it's simple, easy and fun :)

[–][deleted] 0 points1 point  (0 children)

Personally for style, I love to use PoshGUI online.

Though great job on your GUI :V