Tag powershell
How do you write scripts?
PowerShell is easy to learn. Like I said in the previous post, PowerShell is among the easiest languages to learn. Now, like mentioned in the previous post, you learnt to use the pipeline, and now, you are a one-liner star. But how do you go about writing full-blown scripts? You may have seen scripts running hundreds or thousands of lines. How do you write a complete script in PowerShell? Do you write every line of it?
How do you learn PowerShell?
I get asked every now and then—[more so since my book]({{ site.book }})—‘How did you learn PowerShell?’ or, ‘Did you self-learn or did you get trained in it?’ ‘Did you experiment?’ and ‘How long does it take to learn PowerShell enough to be comfortable using it?’ I even get the odd ‘How do you convince your clients on using PowerShell scripts?’ ‘Are all scripts you use written by you? How?‘1
Modularity and Scalability
In the last post, Before you automate, I had promised that I will give an example of how modularity is important for scalability. I had mentioned that modularity leads to simplified scalability. I had also said that applying a little thought to the automation solution well in advance would save us a lot of effort. This way, we would be writing less and doing more. For instance, I once received a request create a script to update a distribution group every day, based on data from a system that the client used, in order to automate some parts of user account provisioning, called Oracle Identity Manager, or OIM.
Before you automate
As significant chunk of my work involves automation using PowerShell. I speak as an Infrastructure specialist, when I say that automation has gained a lot of traction. Automation has several benefits, such as: Reduction in human errors. Higher speed. Higher efficiency. Reduction in effort. No boring tasks. This is all good, shiny. However, can everything be automated? Here are some things you should consider before you automate anything, whether it is an odd user account termination process, or disaster recovery of your datacenter.
Find the computer responsible for user account lockout
Most enterprises of today have a set of security policies that govern how an Active Directory account is handled. Most environments today also have a strong password policy. Some have account lockout policies as well. In most environments I’ve worked with, they have set that the account be locked after three or five failed attempts at logon—if the user enters a wrong password three or five times, the person gets locked out of the account.