Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Reading Notes-PowerShell practical Guide (third Edition)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The difference between the third edition and the second edition

The third edition adds a lot of practical skills and experience, which is richer than that of the second edition, and adds a lot of knowledge points that are not easy to notice. After mastering these knowledge points, we can avoid trampling in the practical application.

For an introduction to this book, please refer to

Http://www.pstips.net/learn-powershell-3-in-a-month-of-lunches.html

About the difference between PowerShell and cmd

Https://www.zhihu.com/question/22611859

Personal remarks:

Powershell is an object-oriented scripting tool, in powershell, the output is objects, you can call its properties and methods, you can also use PS to write function (functions), Powershell is a high-level scripting language, the bottom has encapsulated a large number of available cmdlet and functions, classes. You can use WMI in powershell, call the C # interface, invoke cmd commands, output xml, json, and so on. In the future, almost all of Microsoft's mainstream server products will be based on powershell for remote or local management. At present, powershell already has an open source version of powershell core, which can manage the Linux platform. Powershell is the preferred tool for automated operation and configuration management on Windows platform.

Advantages and disadvantages of Get-wmiobject and get-ciminstance

The traditional WMI way to manage the operating system, the problems are: complex syntax, difficult to understand, difficult to query parameters. When WMI needs to manage multiple remote operating systems, there are two drawbacks:

1) need to use RPC for communication, not based on HTTPS

2) remote execution is serial, that is to say, it is inefficient to perform operations one by one.

The advantages of using CIM are:

1) adopt WS-MAN protocol

2) remote execution is parallel and can be used for distributed computing. After the parallel execution is completed, the result is returned.

The drawback of CIM is that it does not support older, earlier versions of the operating system and PowerShell.

About PowerShell command aliases

Aliases are not recommended frequently in delivered scripts or code because they are less readable and difficult to understand.

The difference between write-host and write-output

To put it simply, write-host bypasses powershell's default pipe output mechanism and prints the information to be output directly to the screen, while write-output prints the output to the screen through powershell's default pipe. This explains why in powershell studio graphical programming, the output of write-output can be further output to richtextbox, but not write-host. The reason for this is that content programs that write-host outputs directly to the screen cannot be captured.

On implicit remoting of powershell

In fact, to put it bluntly, the session is used to establish a remote pipeline, and then import the corresponding management module on the target computer through the remote pipeline. The advantage is that the script or tool does not need to install the corresponding module or management tool when it is executed, because the command is transferred to the target server for execution through a remote session, and the local is just the result of deserialization. The disadvantage is that the deserialized output has no properties and methods to continue to call.

This reading is the third edition of the Powershell practical guide. Before reading the second edition, I made a mind map for the first seven chapters, which can be moved to:

Link: https://pan.baidu.com/s/1HiX8u4eZSsuwnct0NBXHJQ extraction code: gzue

For more information, please follow the official account of Wechat below:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report