New to Powershell: where to start?

Good morning,

As a very small team we have been thrown in at the deep end and been told to start learning and using Powershell. We are a small team of Business Intelligence Developers and none of us have any experience with Powershell and what can be done with it. We have been given a small task to learn from scratch the Powershell product. Our first test project is as follows:

As a developer,
I want the restore of the HealthBI database to be automated
So that I can focus on other tasks without having to monitor it

  • Given that a backup of the HealthBI database is available, When I trigger the initialisation/restoration process, Then the HealthBI database is restored And the DA Loaders have been regenerated And the DA Exports have been regenerated And the DA Orchestrations have been regenerated And the config has been updated to the test server config And the security model has been updated to the test server model And the most recent version of reference data files has been applied And the correct Product Licences have been applied And a log file is created, detailing the outcome of each stage of the script
Obviously I don't need the work doing but would love if there were some pointers of what to learn to accomplish the above, so I can get stuck in and start to learn Powershell. So far I have covered the 2 beginners courses on Pluralsight (Powershell: Getting Started and Your First Day with Powershell). It does seem daunting to be honest and much of it went over my head, however I felt the same learning T-Sql and that's now part and parcel of my working life so not put off by the challenge.

I welcome ALL advice and will try to take as much on board as humanly possible.

In general for beginners, most recommend the book:

“Learn Windows PowerShell in a Month of Lunches 3rd Edition” by Don Jones and Jeffrey Hicks.

But any of the courses or books are going to be generic compared to your specific tasks.
So you’ll also need to investigate how those tasks are going to be done in the products you use.
E.g. using command lines, API’s etc.

Go straight to the source, man: Payette - Windows Powershell in Action

PowerShell efforts, can be just like any other development effort. So, many of the same rules apply.

Begin by using PowerSHell as your default vs cmd.exe / DOS.

Anytime you find yourself thinking DOS stuff first, stop, and figure out how to do it in PowerShell.

PowerShell is an object oriented language, and relies on .Net and .Net Core on OSX / Linux. It’s commands are longer than what you would do in DOS. There are shorthand / aliases that can be used, but beer sure to limit your use of those interactive stuff.

In scripts, always, always use the full cmdlet/function names, parameter name and switch names. It’s keeps the code self-documenting, easier to read, share and maintain.

Lastly, never ever, run any code from any one from anywhere, that you do not fully understand and what it is / will do. If you do, you could seriously damage your host and or your enterprise. Learn to master the -WhatIf, -Confirm, and leveraging the Set-StrictMode are part of your development, put that in your profile. Learn about profiles, and how to use them. Learn about execution policies, what they are and how / when to use them. Fully leverage auditing, monitoring and logging of PowerShell use by all users and processes. Especially as part of your corporate risk management effort.

Work on code style, sharing and use standardization.

Book references, normally the ones you’ll see most recommend:

Beginning —

Learn Windows PowerShell in a Month of Lunches 3rd Edition
Donald W. Jones (Author),‎ Jeffrey Hicks (Author)
ISBN-13: 978-1617294167
ISBN-10: 1617294160

Internediate —

Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell 3rd Edition
Lee Holmes (Author)
ISBN-13: 978-1449320683
ISBN-10: 1449320686

Advanced —

Windows PowerShell in Action 3rd Edition
by Bruce Payette (Author),‎ Richard Siddaway (Author)
ISBN-13: 978-1633430297
ISBN-10: 1633430294

From Microsoft

Windows PowerShell Survival Guide

Purpose of this Document
The purpose of this document is to help you to learn more about PowerShell and to be successful in applying it. This document seeks to point to the best content on the web to enable you to reach that goal.

Scope of this Document
This page contains links to help you learn more about Microsoft Windows PowerShell. This includes PowerShell fundamentals as well as how PowerShell is used in Windows applications and services. As long as it’s PowerShell related, we’ll try to point to it! The document is also version agnostic, and contains information about current and future versions of PowerShell.

social.technet.microsoft.com/wiki/contents/articles/183.windows-powershell-survival-guide.aspx

See also posts here for other resource suggestions here:

Learning this stuff.

Best Practices

Practice with PSKoans

PSKoans : 0.50.0
A module designed to provide a crash-course introduction to PowerShell with programming koans.

Come to know your dev tools / environments:
Built into Windows PowerShell ISE (though no more work is going into it, Micros has already said, it will always be in the OS).

Visual Studio Code, then new hotness, for developers, and scripters. It takes a while to get it configure for all you will need, and provides far more that the ISE does.

Sapien’s PowerShell studio is the first class / top tier full IDE for PowerShell, but it not a inexpensive one, but well worth the price IMHO.

Learn to use both, as in most cases, data center servers will not have VSCode, but the ISE is in the box.

There are a bunch of add-one / extensions for both.

Then of course you can use full Visual Studio for PowerShell script, GUI, module development. As you can with VSCode, just be sure to purchase the full PowerShell Pro Tools addon for PowerShell project. It’s $59.00, so, in expensive, though to continue to get updates for it, that is an annual cost.

Thanks all there is a wealth of information here which I will try to make good use of.

I also started with the Month of Lunches books. Fantastic place to get started.

For beginning I usually point everyone to Jeffery Hicks list https://jdhitsolutions.com/blog/essential-powershell-resources/