Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows

Windows PowerShell คืออะไร? ฟีเจอร์และประโยชน์ของการอัปเกรดเป็นเวอร์ชันล่าสุด

Windows 10 มาพร้อมกับ Windows PowerShell 5.0 เวอร์ชันล่าสุดตอนนี้คือ PowerShell 7.0 Windows 8.1 มาติดตั้ง Windows PowerShell 4.0 เวอร์ชันใหม่มีฟีเจอร์ใหม่มากมายออกแบบให้ภาษาง่ายขึ้น ใช้งานง่ายขึ้น และหลีกเลี่ยงข้อผิดพลาดทั่วไป หากคุณใช้ PowerShell เวอร์ชันเก่าบน Windows OS การย้ายไปยัง Windows PowerShell เวอร์ชันนี้จะนำประโยชน์มามาก ไม่ได้แค่ให้ System Administrators จัดการทุกแง่มุมของ Windows Server OS แต่ยังให้การควบคุม SQL, Exchange และ Lync-based Servers

PowerShell คืออะไร

PowerShell เป็น Command-line Shell และ Scripting Language คุณสามารถใช้ PowerShell สำหรับ Script Automation รัน Batches ของคำสั่ง ควบคุม Resources ใน Cloud ฯลฯ ตอนนี้มี PowerShell Core ที่ทำงานบน Linux, macOS และ Windows OS

หากต้องการข้อมูลเพิ่มเติม สามารถดู Introduction to PowerShell บน microsoft.com สำหรับการเรียนรู้ที่ดี

ฉันกำลังรัน PowerShell เวอร์ชันไหนอยู่

เพื่อทราบว่าคุณใช้ PowerShell เวอร์ชันไหน ทำดังนี้

Windows PowerShell คืออะไร? ฟีเจอร์และประโยชน์ของการอัปเกรดเป็นเวอร์ชันล่าสุด

เปิดหน้าต่าง PowerShell พิมพ์ คำสั่งใดก็ตามหนึ่ง ต่อไปนี้ และกด Enter:

get-host|Select-Object version $psversiontable $host.version

อ่านเพิ่ม: How to check PowerShell version in Windows 10

  • Windows Server 2012, Windows Server 2008 R2, Windows Server 2008 SP2, Windows 8 และ Windows 7 with SP1 จะใช้ Windows PowerShell 3.0 ได้
  • Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2, Windows 8.1 และ Windows 7 with SP1 จะใช้ Windows PowerShell 4.0 ได้
  • Windows 10 มาพร้อม Windows PowerShell 5.0

อ่าน: How to install PowerShell 7.0 on Windows 10

Windows PowerShell Features

Windows PowerShell 3.0 นำเสนอฟังก์ชันใหม่ดังนี้:

  • Windows PowerShell Workflows
  • CIM Cmdlets
  • Cmdlets over objects (CDXML)
  • Windows PowerShell Web Access
  • Module Automatic Loading
  • Updatable Help
  • Robust และ Disconnected Sessions
  • Scheduled Jobs

Windows PowerShell 4.0 นำมาให้:

  • Desired State Configuration (DSC)
  • Windows PowerShell Web Access Improvements
  • Workflow Enhancements
  • New features for Windows PowerShell Web Services
  • Save-Help

Related: How to install and use Windows PowerShell ISE

Windows PowerShell 5.0 ซึ่งรวมอยู่ใน Windows 10 นำเสนอฟังก์ชันดังนี้:

  • Classes สามารถกำหนดใน Functionality ได้
  • DSC Enhancements
  • Transcriptions พร้อมใช้ในทุก Hosts
  • การปรับปรุง Debugging อย่างมาก รวมถึงความสามารถ Debug Windows PowerShell Jobs
  • Network Switch Module
  • OneGet สำหรับจัดการ Software Packages
  • PowerShellGet สำหรับจัดการ Windows PowerShell Modules ผ่าน OneGet
  • Performance Gain เมื่อใช้ COM Objects

Windows PowerShell 6.0 เป็น Cross-platform (Windows, macOS, และ Linux) Open-source และสร้างสำหรับ Heterogeneous Environments และ Hybrid Cloud

  • ย้ายจาก .NET Framework ไป .NET Core
  • ใช้ .NET Core 2.0 เป็น Runtime
  • ทำให้ PowerShell Core ทำงานบนหลาย Platforms (Windows, macOS, และ Linux)
  • APIs ที่แชร์ระหว่าง .NET Core และ .NET Framework ถูกกำหนดเป็นส่วนหนึ่งของ .NET Standard

Windows PowerShell 7.0 มาพร้อมฟีเจอร์ใหม่มากมายเช่น:

  • Pipeline Parallelization
  • New Operators
  • ConciseView และ Get-Error Cmdlet
  • Automatic New Version Notifications
  • Invoke DSC Resources โดยตรงจาก PowerShell 7
  • Compatibility Layer

อ่าน: Windows PowerShell ISE vs Windows PowerShell

TechNet Library อธิบายฟีเจอร์เหล่านี้อย่างละเอียด มาดูบางอย่างสรุปสั้นๆ

Windows PowerShell Workflow: ความสามารถนำพลังของ Windows Workflow Foundation มาสู่ Windows PowerShell คุณสามารถเขียน Workflows ใน XAML หรือภาษา Windows PowerShell และรันได้เหมือน Cmdlet

Improvements to Existing Core Cmdlets and Providers: Windows PowerShell 3.0 รวมฟีเจอร์ใหม่สำหรับ Cmdlets ที่มีอยู่ รวมถึง Simplified Syntax และ Parameters ใหม่สำหรับ Cmdlets เช่น – Computer Cmdlets, CSV Cmdlets, Get-ChildItem, Get-Command, Get-Content, Get-History, Measure-Object, Security Cmdlets, Select-Object, Select-String, Split-Path, Start-Proces, Tee-Object, Test-Connection และ .Add-Member

Remote Module Import and Discovery: Windows PowerShell 3.0 ขยาย Module Discovery Importing และ Implicit Remoting Capabilities บน Remote Computers

The Module Cmdlets: มีความสามารถ Import Modules บน Remote Computers ไปยัง Local Computer โดยใช้ Windows PowerShell Remoting

New CIM Session Support: ให้สิทธิ์ใช้ CIM และ WMI จัดการ Non-Windows Computers โดย Import Commands ไปยัง Local Computer ที่รัน Implicitly บน Remote Computer

The Auto-complete Feature: ประหยัดเวลาพิมพ์ และลด Typos

PowerShell 3.0 Intellisense: ขีดเส้นใต้ Error ที่คุณทำเป็นสีแดง และแนะนำการแก้ไขเมื่อ Hover Mouse Pointer ไปที่เส้นคลื่น

Update-Help Cmdlet: รักษาข้อผิดพลาดเล็กๆ หรือ Typos รบกวนใน Built-in Documentation

Enhanced Console Host Experience: การเปลี่ยนแปลงที่อยู่เบื้องหลัง Windows PowerShell Console Host Program ถูก Enable ใน PowerShell 3.0 โดย Default นอกจากนี้ Option "Run with PowerShell" ใหม่ใน File Explorer ให้คุณรัน Scripts ใน Unrestricted Session โดยแค่คลิกขวา

RunAs และ Shared Host Support: RunAs Feature ออกแบบสำหรับ Windows PowerShell Workflow ให้ Users ของ Session Configuration สร้าง Sessions ที่รันด้วย Permission ของ Shared User Account SharedHost Feature อีกด้านหนึ่ง อนุญาต Multiple Users บน Multiple Computers เชื่อมต่อกับ Workflow Session พร้อมกัน และติดตาม Progress ของ Workflow อย่างระมัดระวัง

Special Character Handling Improvements: รอบเร็วของ Windows PowerShell 3.0 แสดงให้เห็นถึงการปรับปรุงความสามารถในการตีความและจัดการ Special Characters อย่างถูกต้อง Parameter LiteralPath ซึ่งจัดการ Special Characters ใน Paths ถูกต้องบนเกือบทุก Cmdlets ที่มี Path Parameter รวมถึง Update-Help และ Save-Help Cmdlets ใหม่

ใช้ PowerShell คุณสามารถ Generate List of Windows Services, Generate List of Disabled Features, Export และ Backup Device Drivers, Find System Uptime, Update Windows Defender Definitions, List Drives, Get Installed Driver List, Uninstall Windows Store Apps, Add Item to Desktop Context Menu, Create System Image, Download a file และอื่นๆ

Windows PowerShell คืออะไร? ฟีเจอร์และประโยชน์ของการอัปเกรดเป็นเวอร์ชันล่าสุด