The Basics of PowerShell
- What is PowerShell? Look at the word POWER-SHELL. You may ask what is a shell?
A shell is a user interface that gives you access to the operating system.
- What can I use PowerShell for? PowerShell allows you to write scripts and use commands to automate repetitive tasks. For example:
You could check the security logs on one or a number of server’s, save that log file to a server as an HTML file and the Admins that work for you could check the log file every morning anywhere in the world to verify that your servers are not being attacked by hackers.
You can work with Active Directory, registry, WMI, backup your server, run tasks in the background while you perform other tasks.
3. PowerShell is built into many products. Microsoft IT products, VMware, Citrix.
4. Do you have a Linux, Unix or strictly Windows client background? You may ask, what commands from those O/S will PowerShell recognize?
PowerShell recognizes many windows native commands. Let’s check it out.
Open the ISE version of Powershell in Administrator mode
Type Explorer – Yep that works
Type Ipconfig /all
Cmdlets are PowerShell specific commands. So how do we get a list of CMDlets?
Here we see a list of aliases -we’ll get to those later
And Functions – Functions are written in PowerShell’s own scripting language. You can create your own Functions in PowerShell.
CMDlets are native PowerShell commands that are written in a .net language
BTW you can get-help on any of these aliases, functions or cmdlets.
Let’s grab a command and get some help
And there’s your help for the Get-variable cmdlet
What about UNIX or Linux commands
Type LS – Displays the contents of a specified location.
PWD – Returns the current working directory name.
MAN - Gives help on the get-service command.
CAT -path c:\sec.txt
and there is our security log that we saved from a previous lecture
Q: Is there a command that I can type to give me a list of aliases which is another name for a command that points to the real command that PowerShell recognizes?
Checkout the list of aliases, I am sure you will see some that you recognize. Take a little time to experiment with familiar commands.
Q: Why would Microsoft developers include commands from these other operating systems.
A: So, people from the Unix/Linux world would be able to sit down open up PowerShell and find commands that they are familiar with. Granted there are differences between the various tools, but I think this encourages others to dig in and hopefully discover the power of PowerShell.
- In this course we will concentrate mainly on using PowerShell with Windows 10 and Windows server 2016.
- You may say, well Robert you really haven’t convinced me yet - why would I want to go to the trouble to learn PowerShell?
Let me ask you this:
If you were the hiring manager in charge of hiring all your system admins, who would you rather have on your team. A person that manually performs his everyday tasks using the basic tools. Or an Admin that takes seconds to perform the same tasks in an automated fashion. The answer is obvious. So welcome to PowerShell this is the future for administrators.
Sign up to access the rest of this lesson
You must either log in or sign up to access this lesson.