Here we are – speaking about a topic, which all companies should have discussed and implemented years ago, but most of them didn´t. I will show you with some examples, why you should change your mind and even if you´re on the right train – there are still ways to improve.
Most of the companies think of scripting and automation as of cryptic hieroglyphics, which only the software developer gurus can handle. This is just a self protecting lie to be not forced to learn something new. Scripting (totally equally, which language you are using) is built up logically, which every IT-Administrator or IT- adept person can learn and master. But if you are still in doubt with this thesis you should take a look at the pros of scripting:
- scripting saves time (money) – i have seen support desks improving by over 1000% efficiency by automating the tasks with scripting
- scripting reduces human errors – you create automations, where the values are prefilled or filled automatically or even prove the entered arguments before firing up the following tasks
- scripting reduces the requirement of GUIs – the perfect example for this is the Windows Server 2016 with and without GUI. Je – the performance without a GUI is much faster than with, but the most important underlying argument is the topic security. The Windows Server without GUI needs much less to be patched then with, which is totally obvious, if you think about it. Therefore you could say, that a OS without GUI is much more secure. Every time.
- scripting creates standardization – well – it should create it. This step depends on, if you´re doing it right. With standardization you achieve a higher quality and you can reuse your code for different use-cases.
- scripting enables new technologies – this is a point i will show later on in the Powershell part – there are lots of cool new features integrate and still new ones getting planned.
- scripting is necessary for new technologies – Jep – you have read it correctly. There are lots of technologies coming and already on the market, which cannot be handled all over an UI: Azure / O365 / Nano Servers / the IOT topic and many more.
So, just to be honest – if you have read it up till here and you´re still not convinced, you are free to discuss your doubts or concerns with my, but a fact is, that you are on the wrong way.
- Powershell is easy to learn. You will not become a Powershell Guru within a week, but if you start correctly, you will improve your skills successive and write your own scripts in less than half a year and will also be able to read and understand scripts within some weeks or even days.
- Powershell works on nearly every computer. Powershell has been made open sourced previously and has now the full support also in Linux. It becomes more and more a allround scripting language, which is very powerful.
- Powershell enables great technologies. You have to take a look at Just Enough Administration – a framework by which you can centralized delegate rights to your users without the need, that these rights belong directly to them. The next topic on your list should also be Desired State Configuration, by which you can set up and configure your servers and computers with pre or self-created templates. In the newest released Powershell Version 5 you even get the possibility to work with Classes to nearly close the gap to “real software developing”. And these are just a few.
- Powershell is secure – In fact this is a point, which many people do not know. By not knowing how Powershell really works, what ExecutionPolicy is and how PSRemoting can be managed securely, some companies just turn Powershell off. This is actually a big mistake. (read here for further details)
Powershell is built up fully standardized. The commandlets have the same layout every time.
And there is also a list of allowed and usable verbs to improve the standardization in the names by itself. By this you know, if the command starts with “Get”, that it returns an filled object of the following Noun.
For example: Get-Command – with this cmdlet you can search any commandlet, which is retrievable und usable on your computer. But how to use it?
Get-Help – gives you all the information you need to know and most of the time this help comes with very useful examples.
One of the most important things to know and to understand is, that Powershell is a object oriented programming language with the underlying .Net-Framework, which gives any object methods and properties out of the box. Therefore the following command must by in your starting repertoire.
Get-Member – With this you can retrieve the object type of any object and also see what methods and properties it offers.
Afterwards you have to understand, how the Pipeline works and you are ready to work with Powershell.
Most of the people try to find the necessary scripts in the internet – and they will find a lot. The problem often is, if you don´t understand how Powershell basically works, you will get lots of headaches at the moment, when you are confronting the first little problems or the script does not work as expected.
Recommendation: Learn the Powershell basics before downloading and using advanced complete scripts.
Doing it the right way:
As previously mentioned, there are some things you should know. First of all
- Use PowerShell Best Practices and Style Guide (take a look here) – standardization is important and in scripts, which are used in an enterprise companies, even more. A great tool, which may help you in the first steps is the ISE-Addon ISESteroids, which allows you to fully scan and automatically correct your whole scripts.
- Create reusable, tested, signed and documented code – i would say, that this falls also under Best Practices, but the importance of this is so high to be solely pointed out. You should create tested and documented commandlets with help-files, which you then unite into modules. This modules then can be centralised and updated easily.
- Centralize your knowledge / your script – i have spoken at the PSConfAsia about a centralised PSRepo-Server. The problem in a big IT-company is, that you have a lot of good people creating good scripts, which are not centralised and you are loosing a lot of knowledge transfer and also knowledge by itself. (take a look here) By respecting the previous point and creating good modules you can then store them to an internal repository to manage and distribute the code centralised.
- Collaborate and keep up to date – Today we are living in a world of change. You have to stay up to date in the IT – even more now than some years before. Therefore take a look at the free trainings in the internet (Microsoft Virtual Academy and so on) and the videos of the conferences and try also to meet with other Powershell people at UserGroups. (German one here and here) You are also welcome to contribute to the source code itself and take a look at the upcoming versions. (here)
If you stick to these recommendations you will create powerful code bases, which will save you a lot of time in the future and raise up your quality. It is obvious in some environments, that scripting is totally necessary. The best example is the support desk. Automation of repetitive tasks is the most clear use case, which every person understands. So if you find any repetitive tasks in your business you should think a second, if these could not be automated by any kind. Sometimes the needed work to automate these tasks are not worth the work – but by my experience – these cases will be very very rare.
Thank you for reading my whole post. I hope you have taken some new information out of it and i hopefully accomplished to show you the importance of this topic. Provide me with any feedback, if you like to or get in touch with me, if you want to discuss some of the topics.