Bare with me because some of this might come across as nonsense…
I have been trying to specialise in PowerShell for a few years now and have used many resources along the way. However, I often find fancy scripts online where people are using dialogue boxes, forms and .NET classes which I cannot get my head around.
I haven’t come across many resources covering this type of thing. What I want to know is - do people writing intricate scripts using .NET etc tend to come from a programming background? Where do you learn to utilise .NET classes etc in PowerShell? assuming I have to look at dedicated .NET resources?
This might sound like a silly question and I’m not sure I’m conveying myself properly. I just want to know where people get these silky skills from and whether it requires a dev background / day job?
I’m more than willing to spend the time and effort on learning, I just don’t know where to start.
I hope this makes some kind of sense. As you can probably tell, I don’t know a lot about programming - I just know I see a lot of stuff in PowerShell scripts that aren’t cmdlets or providers and I want to know about it!
Baring with you seems a bit personal. I’ll bear with you, though (grin).
Sometimes, folks do come from a more programmer-y background. Sometimes, folks are relying on something like PowerShell Studio to do the heavy GUI lifting for them, letting them focus just on the PowerShell functional bits. I don’t think it requires a full-time Dev job, mind you - I’m perfectly comfortable writing basic GUI code, and I’ve never been a professional .NET developer. But understand that hand-coding a GUI isn’t PowerShell - it’s .NET, either WinForms or WPF. You may be “writing” in PowerShell, but it’s pure .NET programming, for sure. So starting with a beginner’s guide to .NET would be a big help, if that’s a direction for you.
No offense to Don, this forum isn’t the place to talk gui:-) If you really want to get into gui building I suggest starting with the blogs over at Sapien. I’m a regular contributor on the forums there as well.
It’s important to have a very good knowledge of powershell to start. I started writing simple gui scripts from scratch before I found PS studio so I do know how forms work. Sapien is built for speed, dragging a .net control on a form and coding the event for it is days faster than writing out the form design manually. It’s helpful to know a some vb and c# as msdn gives examples for controls only in those languages.
No, I don’t consider myself a programmer.
My advise to get a better grip on .NET GUIs (WinForms / WPF) is to start developing your own. Instead of spending USD 389 for Sapien’s PowerShell Studio you can download Microsoft’s Visual Studio Community Edition for free and start digging around. Create a C# WinForms project, put some controls on the main window it and look under the hood (into the source code) what VS has generated for you.
I hope that helps.
There is a trial of Sapien. I don’t think you’re going to get a whole lot of script support in visual studio.
I’ve suggested Visual Studio not for scripting but for Mike to checkout how the VS editor creates the GUI in C# code. Additionally C# is a good language to understand in addition to PowerShell.
Thank you for all your helpful responses.
Would a beginners C# book be a good way to expand on my scripting skills? Its not necessarily the GUI stuff I’m interested in but just acquiring some very basic .NET knowledge so I have at least some chance of understanding scripts found online - or if I don’t initially - knowing how I can go about researching the classes etc to gradually get my head around them.
I will definitely check out Sapien and have a play around with VS.
Just noticed the following chapters in ‘PowerShell in Depth’
35 Working with .NET Framework objects
38 Building a GUI
While not related to .NET may I suggest a little known book bay an unappreciated author?
Give it a look. Walk before you run.