Skip to content

Latest commit

 

History

History
907 lines (675 loc) · 51.2 KB

powershell-learning-notes.md

File metadata and controls

907 lines (675 loc) · 51.2 KB

1. 说明

这个repository中的内容包括我学习PowerShell过程中,浏览过的文章、书籍、学习视频、学习过程中写的一些练习脚本。通过系统化的记录学习的内容,希望能够加深对各种知识理解。

网络上的已经有很多关于PowerShell的文章和教程,但是过于分散,而且PowerShell发展比较快,也使很多文章和教程不能涵盖PowerShell最新的发展。所以决定把学习的内容记录下来。

建议把这个文章当作一个学习笔记或者手册,而不要当作一个教程。写教程需要花费更多的时间和精力,我比较懒,只希望花最少的时间掌握PowerShell,所以不想花太多时间在书写教程这件工作上。

希望能对你学习PowerShell有所帮助。

备注:windows-command-line-utilities.md是一些常用的windows命令行命令和工具的用法。

2. PowerShell Introduction

Please read PowerShell-Wikipedia first. Following is the contents:

  1. Background
  2. Design: cmdlet,pipeline,scripting,hosting
  3. Versions:1.0,2.0,3.0,4.0,5.0
  4. Comparison of cmdlet with similar commands
  5. File extensions
  6. Application Support
  7. Alternative implementation

3. Advantages

  • 语言本身:
    • 丰富的命令(或者功能),以及扩展性
    • 管道机制,功能倍增器
    • 语法是否简单,完备:比如是否支持变量、函数、分支、循环、异常处理、闭包等等
    • 方便易用的帮助,比如man,get-help
  • 其它方面:
    • 和Shell集成:反面的例子比如cscript.exe上执行的VBScript和Jscript
    • 包管理机制(类似Chocolatey,OneGet,APT-GET,homebrew),这方面期待powershell 5.0推出的OneGet
    • 互操作性(interoperable):比如.NET程序中执行PowerShell脚本
    • 广泛的支持(SQL Server,Exchange Server等)

4. Learning Videos

4.1. Getting Started with PowerShell 3.0 Jump Start

4.1.1. URL

4.1.2. 课程目录

  • Don't fear the Shell
  • The help System
  • The pipeline: getting connected & extending the shell
  • Objects for the Admin
  • The pipeline: deeper
  • The PowerShell in the shell: remoting
  • Getting prepared for automation
  • Automation in scale: remoting
  • Introducing scripting and toolmaking
  • Recommended Resources & Next Steps for PowerShell 3.0

4.1.3. 内容概要

The Help System

# 下载帮助文档或者更新本地的帮助文档
PS > update-help

# 查找名称中包含service的cmdlet(case-insensitive)
PS > Get-Help *service*

# 查找名称以g开头,包含service的cmdlet(case-insensitive)
PS > Get-Help g*service*                                                              

# 查看某个cmdlet的帮助,阅读并理解帮助内容
PS > Get-Help Get-Service

PS > Get-Help Get-Service -Full
PS > Get-Help Get-Service -Online
PS > Get-Help Get-Service -Examples
PS > Get-Help Get-Service -ShowWindow

# 查看所有的HelpFile列表
PS > Get-Help about*
PS > Get-Help * -Category HelpFile

Pipleline

# 停止名称叫bits的service
PS > Get-Service -name bits | Stop-Service

# 启动名称叫bits的service,并显示结果
PS > Get-Service -name bits | Start-Service -PassThru

# 把所有的系统服务输出到csv文件
PS > Get-Service | export-csv -Path c:\service.csv

# 把所有的进程输出到XML文件
PS > Get-Process | Export-Clixml -Path c:\process.xml

# 运行notepad,然后执行下面的命令比较两个对象的差别
PS > Compare-Object -ReferenceObject (Import-Clixml C:\process.xml) -DifferenceObject (Get-Process) -Property Name

Name                                                                 SideIndicator                                                       
----                                                                 -------------                                                       
notepad                                                              =>            

# 把所有的service的name、status输出到html文件
PS > Get-Service | ConvertTo-Html -Property Name,Status | Out-File c:\service.html

# 通过-whatif查看命令执行效果,实际不执行操作
PS > Get-Service | Stop-Service -WhatIf

# 通过-confirm要求用户确认操作
PS > Get-Service -name bits | Stop-Service -Confirm

# 获得加载的Module
PS > Get-Module

# 获得所有的Module,无论加载与否
PS > Get-Module -ListAvailable

# 获得某个module的所有cmdlet
PS > Get-Command -Module Microsoft.PowerShell.Core

# 当某个module未加载,如果你执行这个module的cmdlet,PowerShell会自动加载这个module

Objects for the admin

# 获得handles大于900的进程,并排序展示出来
PS > Get-Process | where Handles -gt 900 | sort handles -Descending

# 获得某个service的成员
PS > Get-Service -Name BITS | Get-Member

# 获得service的name、status
PS > get-service | Select-Object -Property Name, Status

# 自定义property的格式
PS >  Get-WmiObject -Class win32_logicalDisk | `
>>> Select-Object -Property __Server, Name,
>>> @{n='FreeGB';e={$_.Freespace /1Gb -as [int]}} |
>>> Format-Table -AutoSize

__SERVER        Name FreeGB
--------        ---- ------
WIN-LRSDTAVTAR1 A:        0
WIN-LRSDTAVTAR1 C:       55
WIN-LRSDTAVTAR1 D:       97
WIN-LRSDTAVTAR1 E:        0

# 把最近的5条System日志输出到html文件中
PS > Get-EventLog -LogName System -Newest 5 | Select-Object -Property EventID, TimeWritten, Message | Sort -Property TimeWritten | ConvertTo-Html | Out-File c:\elog.html

# xml操作
PS > $x = [xml](cat c:\test.xml)
PS > $x.PLAY
PS > $x.PLAY.ACT
PS > $x.PLAY.ACT[0]
PS > $x.PLAY.ACT.SCENE.SPEECH | group speeker | sort count

# $_用法
PS > Get-Service | Where-Object -FilterScript { $_.Status -eq "Running" -and $_.Name -like "b*" }
PS > Get-Service | Where { $_.Status -eq "Running" -and $_.Name -like "b*" }
PS > Get-Service | ?{ $_.Status -eq "Running" -and $_.Name -like "b*" }

Pipleline: deeper

# 理解下面的命令为什么都能执行成功
PS > Get-Service *bits* | Start-Service -PassThru

PS > "BITS" | Start-Service -PassThru

PS > $h = @{ Name = "BITS"}
PS > $h | Start-Service -PassThru

PS > $h = @{ Name = "BITS"}
PS > $ho = New-Object -TypeName psobject -Property $h
PS > $ho | Start-Service -PassThru

# 理解-ExpandProperty的作用
# 下面命令返回的是ServiceController
PS > get-service | Select-Object -Property Name 

# 下面命令返回的是String
PS > get-service | Select-Object -ExpandProperty Name

PowerShell Remoting

注意:

  • Windows Server 2012 R2 ServerCore自动启用了PowerShell Remoting
# Enable PowerShell Remoting
PS > Enable-PSRemoting

# WinRM Service的组策略路径在"Computer Configuration/Policies/Administrative Templates/Windows Components/Windows Remote Management(WinRM)/WinRM Service"

# One-to-one, interactive
PS > Enter-PSSession -ComputerName dc

# One-to-many, interactive
PS > Invoke-Command -ComputerName 192.168.1.105 -ScriptBlock { ls c:\ } -Credential administrator

# PowerShell Web Access
PS > Get-WindowsFeatures *powershell* #View all features about powershell
PS > Install-WindowsFeature WindowsPowerShellWebAccess
PS > Get-Help *pswa*

Name                              Category  Module                    Synopsis                                                           
----                              --------  ------                    --------                                                           
Get-PswaAuthorizationRule         Cmdlet    PowerShellWebAccess       Get-PswaAuthorizationRule...                                       
Add-PswaAuthorizationRule         Cmdlet    PowerShellWebAccess       Add-PswaAuthorizationRule...                                       
Remove-PswaAuthorizationRule      Cmdlet    PowerShellWebAccess       Remove-PswaAuthorizationRule...                                    
Test-PswaAuthorizationRule        Cmdlet    PowerShellWebAccess       Test-PswaAuthorizationRule...                                      
Install-PswaWebApplication        Function  PowerShellWebAccess       ...                                                                
Uninstall-PswaWebApplication      Function  PowerShellWebAccess       ...    

PS > Install-PswaWebApplication -UseTestCertificate
PS > Add-PswaAuthorizationRule * * * #Don't use this in product environment

Getting Prepared for automation

# 执行策略包括:
#   Restricted
#   Unrestricted
#   AllSigned
#   RemoteSigned
#   Bypass
#   Undefined

PS > Get-ExecutionPolicy

# 可以通过注册表修改PowerShell的执行策略,路径"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
# 也可以通过组策略来修改PowerShell执行策略,路径"Computer Configuration | Administrative Templates | Windows Components | Windows PowerShell"

# 查看PSDrive
PS > Get-PSDrive

Name           Used (GB)     Free (GB) Provider      Root                                                                 CurrentLocation
----           ---------     --------- --------      ----                                                                 ---------------
A                                      FileSystem    A:\                                                                                 
Alias                                  Alias                                                                                             
C                  44.68         55.32 FileSystem    C:\                                                                 Windows\system32
Cert                                   Certificate   \                                                                                   
D                   2.62         97.25 FileSystem    D:\                                                                                 
E                                      FileSystem    E:\                                                                                 
Env                                    Environment                                                                                       
Function                               Function                                                                                          
HKCU                                   Registry      HKEY_CURRENT_USER                                                                   
HKLM                                   Registry      HKEY_LOCAL_MACHINE                                                                  
Variable                               Variable                                                                                          
WSMan                                  WSMan             

# 下面是一个测试签名的例子

PS > Set-ExecutionPolicy Allsigned #修改执行策略
PS > D:\test.ps1 #执行测试脚本,应该提示没有签名
PS > #从https://gallery.technet.microsoft.com/scriptcenter/Self-signed-certificate-5920a7c6下载创建证书的PS function,保存到D:\
PS > . D:\New-SelfSignedCertificateEx.ps1 #执行脚本并在当前session保留脚本中的function
PS > New-SelfsignedCertificateEx -Subject "CN=Test Code Signing" -EKU "Code Signing" -KeySpec "Signature" -KeyUsage "DigitalSignature" -FriendlyName "Test code signing" -NotAfter ([DateTime]::Now.AddYears(5)) #创建证书
PS > $certs = (dir Cert:\CurrentUser\my) #获得创建的证书
PS > Set-AuthenticodeSignature -FilePath D:\test.ps1 -Certificate $certs[0] #对脚本进行签名
PS > D:\test.ps1 #正常执行
PS > Set-ExecutionPolicy Unrestricted #改回执行策略


# 打印消息
PS > Write-Output "hello" | Get-Member
PS > Write-Host "hello"   #Write-Host不会输出到pipeline
PS > Write-Warning "Warning Message"
PS > Write-Error "Error Message"

# Write-Debug,Write-Verbose一般用于

Automation in scale: remoting

# 创建PSSession
PS > $session = New-PSSession -ComputerName dc
PS > Invoke-Command -Session $session { $var=2 }
PS > Invoke-Command -Session $session { $var }

# 通过Connect-PSSession和Disconnect-PSSession连接和断开PSSession,用法见Technet文档

# 度量执行时间
PS > Measure-Command { Invoke-Command -Session $session { dir c:\ } }

# 通过Import-PSSession加载远程OS的module
PS > Import-PSSession -module ActiveDirectory -prefix remote -session $session

# 关闭PSSession
PS > Remove-PSSession $session

Introducing scripting and toolmaking

# 编写function
function Do-Something {
  <#
  .SYNOPSIS
  Describe the function here
  .DESCRIPTION
  Describe the function in more detail
  .EXAMPLE
  Give an example of how to use it
  .EXAMPLE
  Give another example of how to use it
  .PARAMETER computername
  The computer name to query. Just one.
  .PARAMETER logname
  The name of a file to write failed computer names to. Defaults to errors.txt.
  #>
  [CmdletBinding(SupportsShouldProcess=$True,ConfirmImpact='Low')]
  param
  (
    [Parameter(Mandatory=$True,
    ValueFromPipeline=$True,
    ValueFromPipelineByPropertyName=$True,
      HelpMessage='What computer name would you like to target?')]
    [Alias('host')]
    [ValidateLength(3,30)]
    [string[]]$computername,
		
    [string]$logname = 'errors.txt'
  )

  begin {
  write-verbose "Deleting $logname"
    del $logname -ErrorActionSilentlyContinue
  }

  process {

    write-verbose "Beginning process loop"

    foreach ($computer in $computername) {
      Write-Verbose "Processing $computer"
      if ($pscmdlet.ShouldProcess($computer)) {
        # use $computer here
      }
    }
  }
}

# 查看PSModulePath,此变量配置在windows系统环境变量中
PS > $env:PSModulePath

# 创建自己的Module,注意事项:
#   1. Module必须包含一个psm1文件,且文件名称必须和文件夹名称一致
#   2. Module文件夹必须放在$env:PSModulePath的任何一个目录中

4.2. Advanced Tools & Scripting with PowerShell 3.0 Jump Start

4.2.1. URL

4.2.2. 课程目录

  • Get Started Scripting
  • PowerShell’s Scripting Language
  • Simple Scripts and Functions
  • Advanced Functions
  • More on Parameters
  • Writing Help
  • Error Handling
  • Tools That Make Changes
  • Script and Manifest Modules
  • Recommended Resources & Next Steps for Advanced PowerShell 3.0

4.2.3. 内容概要

PowerShell's Scripting Language

参考:幻灯片展示

Simple Scripts and Functions

参考:幻灯片展示

Advanced Functions

参考:幻灯片展示

More on Parameters

参考:幻灯片展示

Writing Help

参考:幻灯片展示

Error Handling

参考:幻灯片展示

Tools That Make Changes

参考:幻灯片展示

Script and Manifest Modules

参考:幻灯片展示

4.3. Getting Started with PowerShell Desired State Configuration (DSC)

4.3.1. URL

4.3.2. 课程目录

  • 01 | Get Getting ready for DSC
  • 02 | Performing a Push deployment
  • 03 | Configuring Pull Servers for Deployment​
  • 04 | Deploying Configurations Using a Pull Server
  • 05 | Resource roundup
  • 06 | Writing better configurations
  • 07 | DSC and Linux
  • Recommended Resources & Next Steps

4.3.3. 内容概要

4.3.3.1. 01 | Get Getting ready for DSC

通过Dsc可以实现:

  • Install or remove server roles and features
  • Manage registry settings
  • Manage files and directories
  • Start, stop, and manage processes and services
  • Manage local groups and user accounts
  • Install and manage packages such as .msi and .exe
  • Manage environment variables
  • Run Windows PowerShell scripts
  • Fix a configuration that has drifted away from the desired state
  • Discover the actual configuration state on a given node

PowerShell的Pull/Push模式

这篇文章清楚描述了Push/Pull模式的工作原理。

如果Windows没有安装WMF 5.0 Preview,先下载安装。

安装之后,你可以:

  • Search through modules in the Gallery with Find-Module
  • Save modules to your system from the Gallery with Save-Module
  • Install modules from the Gallery with Install-Module
  • Update your modules to the latest version with Update-Module
  • Add your own custom repository with Register-PSRepository

下面的命令列出了Repository的地址:

PS > Get-PSRepository

Name                      OneGetProvider       InstallationPolicy   SourceLocation
----                      --------------       ------------------   --------------
PSGallery                 NuGet                Untrusted            https://www.powershellgallery.com/api/v2/

Find-Module, Install-Module这些命令都属于PowerShellGet module,PowerShellGet module如何利用PackageManage(也叫OneGet)来安装module?

How does PackageManagement relate to PowerShellGet? (High Level Answer)

PackageManagement is a common interface for working with any package manager. Eventually, whether you're dealing with Windows PowerShell modules, MSIs, Ruby gems, NuGet packages, or Perl modules, you should be able to use PackageManagement's commands (Find-Package and Install-Package) to find and install them. PackageManagement does this by having a package provider for each package manager that plugs into PackageManagement. Providers do all of the actual work; they fetch content from repositories, and install the content locally. Often, package providers simply wrap around the existing package manager tools for a given package type.

PowerShellGet is the package manager for Windows PowerShell modules. There is a PSModule package provider that exposes PowerShellGet functionality through PackageManagement. Because of this, you can either run Install-Module or Install-Package -Provider PSModule to install a module from the PowerShell Gallery. Certain PowerShellGet functionality, including Update-Module and Publish-Module, cannot be accessed through PackageManagement commands.

In summary, PowerShellGet is solely focused on having a premium package management experience for Windows PowerShell content. PackageManagement is focused on exposing all package management experiences through one general set of tools. If you find this answer unsatisfying, there is a long answer at the bottom of this document, in the How does PackageManagement actually relate to PowerShellGet? section.

For more information, please visit the PackageManagement project page.

How does PackageManagement actually relate to PowerShellGet? (Technical Details)

Under the hood, PowerShellGet heavily leverages PackageManagement infrastructure.

At the Windows PowerShell cmdlet layer, Install-Module is actually a thin wrapper around Install-Package -Provider PSModule.

At the PackageManagement package provider layer, the PSModule package provider actually calls into other PackageManagement package providers. For example, when you are working with NuGet-based galleries (such as the PowerShell Gallery), the PSModule package provider uses the NuGet Package Provider to work with the repository.

下面的命令列出了安装在本地的DSC Resource(我理解这个resource就是module)

PS > Get-DscResource

查看Get-DscResource命令所在PSDesiredStateConfiguration Module的其它命令,可以发现很多跟Dsc相关的command:

PS > Get-Command -Module PSDesiredStateConfiguration

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Configuration                                      1.0        PSDesiredStateConfiguration
Function        Find-DscResource                                   1.0        PSDesiredStateConfiguration
Function        Get-DscConfiguration                               1.0        PSDesiredStateConfiguration
Function        Get-DscConfigurationStatus                         1.0        PSDesiredStateConfiguration
Function        Get-DscLocalConfigurationManager                   1.0        PSDesiredStateConfiguration
Function        Get-DscResource                                    1.0        PSDesiredStateConfiguration
Function        New-DSCCheckSum                                    1.0        PSDesiredStateConfiguration
Function        Remove-DscConfigurationDocument                    1.0        PSDesiredStateConfiguration
Function        Restore-DscConfiguration                           1.0        PSDesiredStateConfiguration
Function        Stop-DscConfiguration                              1.0        PSDesiredStateConfiguration
Function        Test-DscConfiguration                              1.0        PSDesiredStateConfiguration
Cmdlet          Compare-DscConfiguration                           1.0        PSDesiredStateConfiguration
Cmdlet          Connect-DscConfiguration                           1.0        PSDesiredStateConfiguration
Cmdlet          Invoke-DscResource                                 1.0        PSDesiredStateConfiguration
Cmdlet          Publish-DscConfiguration                           1.0        PSDesiredStateConfiguration
Cmdlet          Set-DscLocalConfigurationManager                   1.0        PSDesiredStateConfiguration
Cmdlet          Start-DscConfiguration                             1.0        PSDesiredStateConfiguration
Cmdlet          Update-DscConfiguration                            1.0        PSDesiredStateConfiguration

4.3.3.2. 02 | Performing a Push deployment

# 第1步,我在自己电脑上搭建了两个VM,一个Windows Server 2012 R2,另外一个是Windows Server 2012 ServerCore。下面我称前者是VMa,后者是VMb。

# 第2步,在VMa上执行下面的命令,查看VMb的LCM配置
PS > $s1 = New-CimSession -ComputerName 192.168.1.102 -Credential Administrator

PS > Get-DscLocalConfigurationManager -CimSession $s1

# 第3步,编写DSC Configuration文件,执行文件生成MOF
PS > C:\Scripts\DSC1\Mod2\1.LCM_Push_NewWay.ps1

# 第4步,把MOF推送到远程服务器
PS > Set-DscLocalConfigurationManager -ComputerName 192.168.1.102 -Path C:\DSC\LCM -Verbose -Credential Administrator

# 第5步,查看DSC Resource的用法
PS > Get-DscResource
PS > Get-DscResource -Name windowsFeature | Select-Object -ExpandProperty Properties
PS > Get-DscResource -Name windowsFeature -Syntax

# 第6步,编写一个安装IIS的Dsc Configuration文件,并执行文件生成MOF
configuration ConfigName {
    Node $ComputerName {

        WindowsFeature IIS{
            Name = 'web-server'
            Ensure = 'Present'
        }
    }
}
$computername = '192.168.1.102'
ConfigName -OutputPath c:\DSC\Config

# 第7步,应用Dsc Configuration文件
PS > Start-DscConfiguration -Path C:\dsc\Config -ComputerName 192.168.1.106 -Credential Administrator

4.3.3.3. 03 | Configuring Pull Servers for Deployment​

4.3.3.4. 04 | Deploying Configurations Using a Pull Server

4.3.3.5. 05 | Resource roundup

4.3.3.6. 06 | Writing better configurations

4.3.3.7. 07 | DSC and Linux

4.4. Advanced PowerShell Desired State Configuration (DSC) and Custom Resources

4.4.1. URL

4.4.2. 课程目录

  • 01 | Getting Ready for DSC Custom Resources
  • 02 | Implementing and Testing Custom Resources
  • 03 | Packaging and Deploying Custom Resources
  • 04 | Using Classes to Build a Custom Resource
  • 05 | Enhancing Your Custom Resources
  • 06 | Building Composite Resources
  • 07 | Advanced Configurations
  • Recommended Resources & Next Steps

4.4.3. 内容概要

4.4.3.1. 01 | Getting Ready for DSC Custom Resources

4.4.3.2. 02 | Implementing and Testing Custom Resources

4.4.3.3. 03 | Packaging and Deploying Custom Resources

4.4.3.4. 04 | Using Classes to Build a Custom Resource

4.4.3.5. 05 | Enhancing Your Custom Resources

4.5. Windows Server 2012 R2 : 服务器管理和自动化

4.5.1. URL

4.5.2. 课程目录

  • Module 1 : 基于标准的管理
  • Module 2 : 简化常规任务
  • Module 3 : 部署
  • Module 4 : 多服务器管理

4.5.3. 内容概要

5. Blog Articles

6. Third-Party Utilities

6.1. PowerShell Modules

6.2. Utilities

7. Websites about PowerShell

7.1. In China

  • pstips.net: 收集和分享 Windows PowerShell 相关教程,技术和最新动态

7.2. Out of China

8. Books

  • "Learn PowerShell 3 in a month of Lunches (2nd)" by Don Jones
  • "PowerShell in Depth (2nd)" by Don Jonnes
  • "Windows PowerShell in Action (2nd)" by Bruce Payette
  • "Windows PowerShell Cookbook (3nd)" by Lee Holmes
  • "Learn PowerShell ToolMaking in a Month of Lunches" by Don Jones
  • powershell.org free ebooks

9. FAQ

9.1. Windows PowerShell Profiles文件保存在什么位置?

9.2. PowerShell Remote Trouble Shooting

下面的文章中包含了很多关于PowerShell远程连接的一些问题和解决办法

9.3. PowerShell展示本地及远程电脑的driver

GET-WMIOBJECT –query "SELECT * from win32_logicaldisk where DriveType='3'"

检查远程电脑的drivers,需要加上-ComputerName参数

GET-WMIOBJECT –query "SELECT * from win32_logicaldisk where DriveType = '3'" –computername "ContosoWS1"

9.4. Windows 10的Microsoft Edge浏览器默认不能访问localhost website,如果解决?

参考Can't open localhost in Project Spartan in Windows 10 preview

原因是:So the issue is Edge doesn't have access to the loopback addresses, which is something that most Windows Store are blocked from accessing.

9.5. Write-Host和Write-Output有什么区别?

参考:Which should I use: “write-host”, “write-output”, or “[console]::WriteLine”?

Write-Output should be used when you want to send data on in the pipe line, but not necessarily want to display it on screen. The pipeline will eventually write it to out-default if nothing else uses it first. Write-Host should be used when you want to do the opposite.

9.6. 如何查看所有的WMI Classes?

参考:

9.7. 如何连接局域网中不在域的PC?

参考:Using Enter-PSSession on LAN without domain?

9.8. PowerShell中Cmdlet和Function有什么区别?

参考:cmdlets vs functions

Basically a true Powershell cmdlet is written in a .NET programming language, typically C#, and compiled – so in a way it's a real application. An advanced function is written in Powershell (although you could include some custom C# code) and is not compiled. There are probably performance benefits to implementing a compiled cmdlet rather than an advanced function but the functions exist for us average joe admins who aren't real programmers to be able to develop and share our own tools.

This is probably not the most eloquent description so I'll leave the nitty-gritty details to those who know more about the developer side of Powershell and .NET.

9.9. ConEmu中PowerShell Shell输入中文字符时字符重叠在一起,如何解决?

打开Settings -> Main -> Main console font,取消Monospace(等宽字体)上的勾。

9.10. Windows和Linux的dynamic port range动态端口范围是多少?

参考:

Dynamic Port Range is used by the client computers (or a server acting as a client) to connect to Well Known Port Services or Root Services.

  • Default dynamic port range of Windows XP, Windows 2000 Professional, and Windows Server 2003: 1024-65535
  • Default dynamic port range of Windows Vista, Windows 7 and Windows Server 2008: 49152-65535
  • Default dynamic port range of Ubuntu Linux 14.04: 32768-61000