First thing first. I started my “Development” career with PowerShell like thousands of peopleout there. Yes I have some unpleasant experiences with Delphi and PHP couple of years ago but PowerShell was the perfect match for me as a infrastructure consultant. It allows to build small and quick automation solutions to help me for my daily tasks.
Over the last couple of years PowerShell evolved and changed a lot. With PowerShell version 5.0 we have now .NET class support! In every release you will feel yourself like a real developer 🙂
I was looking for the new features coming with version 5.0 and as always checking PowerShell MVP Trevor Sullivan`s blog. I came across with following Channel 9 video he published.
He is talking about PowerShell tools which is an extension for Visual Studio and allows you to develop PowerShell projects within Visual Studio. I strongly recommend above video if you are interested.
As a PowerShell fan, I always wanted to play with Visual Studio as I know that VS is much more powerful than PowerShell built-in ISE. VS provides integration with VS Online, Github (source control), Intellisense and Test Explorer.
Let me tell you how I develop my PowerShell scripts..
I don`t care about best practices or development cycles. I start to develop script from scratch. I try to follow a basic structure but most of the time I find myself lost in the hundreds of lines of codes. I also feel the pain of lack of change tracking, source control in ISE. In a typical week, I may add or change bunch of codes in my script and I`m trying to track my changes by creating manul version folders. Yes I know…It doesn`t work.
So wanted to give a chance Visual Studio and Github integration with PowerShell. Here is a quick requirements of this integration.
- I installed PowerShell Tools extension for Visual Studio 2015.
- I installed Github Extension for Visual Studio 2015.
- Created a new account on Github and created a repository called PowerShell.
- Logged in my Github account within Visual Studio.
Then followed steps mentioned on http://nokitel.im/index.php/2015/08/15/clone-existing-github-powershell-scripts-to-visual-studio-2015/.
At the end now I can easily create my scripts in Visual Studio using PowerShell Tools extension and then sync them to my Github repository.
For every change in my script, I comment and then commit/sync script to my repository so that easily can track versions.