"Exploring PowerShell" and "one" first knowledge

Source: Internet
Author: User
Tags aliases file system

PowerShell is a new shell program provided by Microsoft, using a new command prompt and scripting environment. What does using PowerShell bring to the system administrator? What are the benefits of learning PowerShell? If you already have the experience of managing and using VBScript, I'm sure you already know the answer. Active directory domains are now becoming larger and more complex, and for administrators who are tied to the GUI and Microsoft management consoles, PowerShell will make them free!

I do not know if you have logged into each server, the client to modify the registry experience, or batch processing files, batch configuration ... When you encounter these problems, what will you do? Manual configuration? Or do you want to run a script to solve the problem? People who often use VBScript will certainly choose the latter, but they will ask, why do I have to learn PowerShell?

The answer is simple: PowerShell uses an object-oriented approach, which is not available or supported by VBScript, based on. Net.

PowerShell is based on object rather than text

If you're already proficient with Cmd.exe and batch scripts, then I think you need some time for conceptual change. PowerShell is fundamentally different from the concepts that use VBScript and other programming languages, where the output from a traditional command prompt is text-based and not in PowerShell. It looks like text, but it's actually an object. That's why I say PowerShell is powerful because the output of a PowerShell command (object) can be entered into another command without adding additional code. In a traditional scripting language, if you want a command to be passed to another command, additional code is needed to convert the command that needs to be passed into the data and format that the second command can understand. Another problem involved, what is the object? This sounds familiar, "everything in an Active Directory domain is an object." "For example, our servers, computers, printers, security groups, group policies, users, etc., with PowerShell, we can easily interact with these objects: View information, and create, modify or delete.

Customizing the PowerShell command

The PowerShell command is called the cmdlet. PowerShell has more than 100 cmdlet. PowerShell's development team used their boundless imagination to create aliases for these cmdlet, allowing us to use the traditional commands we have been accustomed to, such as Dir, CD, Del, copy, and so on. Even a veteran of Unix can easily use commands such as LS, man, and so on. To maximize user habits and streamline operations, PowerShell allows users to create their own defined aliases for the cmdlet, or even create their own cmdlet.

PowerShell is a command-line interpreter and a scripting environment

Generally speaking, PowerShell has both worlds. DOS is just a command-line interpreter, input commands, and then output, of course, you can also use batch files, but the batch file is essentially a simplification of the operation of the input command. In VBScript, you can take advantage of WSH (Windows Scripting Host), but you cannot enter VBScript code at the command prompt. PowerShell are different but similar in that they can not only enter commands, but also build scripts on the command line. Later tutorials will cover this in more detail.

In the next few weeks I will continue to post PowerShell basic tutorials, to provide you with a solid foundation, a good start.

I will focus on the following areas:

Configuration and customization of the console for Windows PowerShell

PowerShell Base: cmdlet, Parameters, command type ...

• Use PowerShell's command format output

• Using the Windows file system

WMI and. NET

• Use variables in PowerShell

• Application

To begin with, we will focus on basic commands and shell features around PowerShell to understand their basic usage. It is also important to understand that a powerful feature of PowerShell is the ability to build and test code at the command prompt. In previous experience, we often wrote the script first, then tested it, and then adjusted the script, as it did in VBScript. But the powerful thing about PowerShell is that you can write a script after the command line, which is explained in more detail later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.