ຄຳຖາມທີ່ພົບຢູ່ເລື້ອຍໆກ່ຽວກັບ POWERSHELL ສະບັບພາສາລາວ

By | May 20, 2015

translated-lao


ແນວຄວາມຄິດ: ຄຳຖາມທີ່ພົບຫຼາຍທີ່ສຸດກ່ຽວກັບ PowerShell

ທ່ານສາມາດນຳໃຊ້ຄຳສັ່ງເຫຼົ່ານີ້ດ້ວຍຫຼາຍວິທີເຊັ່ນ:

  • ໃຊ້ເພື່ອ ກອບປີ/ວາງ ຄຳສັ່ງດັ່ງກ່າວລົງໃນສະຄຣິບ
  • ໃຊ້ເພື່ອຊອກຫາຄຳສັ່ງທີ່ຕ້ອງການໄດ້ຢ່າງວ່ອງໄວ
  • ໃຊ້ເພື່ອພັດທະນາທັກສະຄວາມຮູ້ຂອງຕົວເອງ
  • ໃຊ້ເພື່ອຮຽນຮູ້ຄຳສັ່ງໃໝ່ໆ
  • ໃຊ້ເພື່ອກະກຽມເຂົ້າໃນການສຳພາດວຽກ

ການປັບປຸງ
ກໍລະກົດ 13, 2015
ຜູ້ຂຽນ powershell-guru.com
ແຫຼ່ງຂໍ້ມູນ lao.powershell-guru.com
ໝວດໝູ່
75
ຄຳຖາມ
610


ACL
Active Directory
Alias
Arrays
Browsers
Certificates
Characters
CIM
Comments
COM Objects
Compare
Computer
Credentials
CSV
Culture
Date
Drives
Environment
Errors
Event Viewer
Files
Folders
Format Operator (-f)
Functions
GPO
GUI
Hardware
Hashtables
Help
History
Jobs
Keyboard
Loops
Math
Memory
Messages
Modules
Microsoft Excel
Microsoft Exchange
Microsoft Outlook
Microsoft SharePoint
Networking
Openfiles
Operators
Parameters
Password
Powershell ISE
Powershell v5
Printers
Processes
PSObject
Quest
Random
RDP
Regedit
Regex
Remote
Restore
Scheduled Tasks
Search
SCCM
Services
SMTP
Snapins
Sounds
Static .NET Methods
Strings
System
Try/Catch
Variables
Symantec Vault
Windows 2012
Windows Azure
Windows Forms
WMI
XML

System

ວິ​ທີ​ການລະບຸລຸ່ນຂອງ PowerShell​ ວ່າເປັນລຸ່ນໃດ?

ວິ​ທີ​ການ​ດໍາ​ເນີນ​ການ PowerShell ເພື່ອໃຫ້ໃຊ້ງານເຂົ້າກັນກັບລຸ່ນຍ້ອນຫຼັງ​?
powershell.exe -Version 2.0

ວິ​ທີ​ການຂໍໃຊ້ງານ PowerShell ໃນລຸ່ນຕ່ຳສຸດ (3.0 ແລະ ​ສູງ​ກວ່າ​) ໃນ script ດ້ວຍ PowerShell​?
#Requires -Version 3.0

ວິ​ທີ​ການ​ຂໍໃຊ້ສິດທິຂອງຜູ້ດູແລລະບົບສຳລັບ script ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ກວດສອບພາຣາມິເຕີຂອງ script ດ້ວຍ PowerShell?
help -Name .\Get-ExchangeEnvironmentReport.ps1 -Full

ວິ​ທີ​ການ​ສະແດງ​ຂໍ້​ມູນ​ສໍາ​ລັບ​ຜູ້​ໃຊ້​ປະ​ຈຸ​ບັນດ້ວຍ PowerShell​?
[Security.Principal.WindowsIdentity]::GetCurrent()

ວິ​ທີ​ການ​ສ້າງ​, ​ແກ້ໄຂ​, ແລະ ​ໂຫຼດໂປຣໄຟລ໌ ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຢຸດ​ພັກ​ 5 ວິນາ​ທີ / ນາ​ທີ​ໃນ script ດ້ວຍ PowerShell​?
Start-Sleep -Seconds 5
Start-Sleep -Seconds 300 # 5 minutes

ວິ​ທີ​ການສະແດງ​ເວ​ລາ​ໃນການບູທ໌ຄັ້ງລ່າສຸດ​ດ້ວຍ PowerShell​?
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime

ວິ​ທີ​ການສະແດງ​ການ​ເລັ່ງ​ປະ​ເພດຕ່າງໆດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງລາຍການໂປຣແກຣມເລີ່ມ​ຕົ້ນດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຖອນ​ການ​ຕິດ​ຕັ້ງ​ແອພລິເຄຊັນດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຖ່າຍພາບໜ້າຈໍ desktop ທັງ​ໝົດ ​ຫຼື ​​ຫນ້າ​ຈໍ​ທີ່​ກຳລັງໃຊ້ງານຢູ່ດ້ວຍ​ PowerShell​?
Take-ScreenShot -Screen -File 'C:\scripts\screenshot.png' -Imagetype JPEG
Repository : Take-ScreenShot

ວິ​ທີ​ການ​ສະແດງ​ການ​ນັບ​ຂໍ້​ຄວາມ​ສໍາ​ລັບ​​ຄິວ MSMQ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຕັ້ງ​ຄ່ານະ​ໂຍ​ບາຍ​ການ​ປະ​ຕິ​ບັດ​ການດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສ້າງ​ທາງລັດ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ pin ຫຼື unpin ໂປຣແກຣມເທິງແຖບ taskbar ​ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ເປີດ Windows Explorer ດ້ວຍ PowerShell​?
[Diagnostics.Process]::Start('explorer.exe')
Invoke-Item -Path C:\Windows\explorer.exe

ວິ​ທີການສະແດງລາຍການໂປຣແກຣມຄວບຄຸມອຸປະກອນດ້ວຍ PowerShell​?
Get-WmiObject -Class Win32_PnPSignedDriver
Get-WindowsDriver -Online -All
driverquery.exe

ວິ​ທີ​ການ​ສ້າງ​ຄູ່​ມື​ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຮັບຕຳແໜ່ງຂອງໄດເຣັກທໍຣີຂອງຜູ້ໃຊ້ງານ​ປັດ​ຈຸ​ບັນ​ດ້ວຍ PowerShell​?
[System.IO.Path]::GetTempPath()

ວິ​ທີ​ການ​ລວມເສັ້ນທາງຫຼັກ ແລະ ເສັ້ນທາງຍ່ອຍເຂົ້າເປັນເສັ້ນທາງດຽວດ້ວຍ PowerShell​?
Join-Path -Path C:\ -ChildPath \windows

ວິ​ທີ​ການ​ສະແດງລາຍການທັງໝົດຂອງ cmdlet “Get-*​” ດ້ວຍ PowerShell​?
Get-Command -Verb Get

ວິ​ທີ​ການ​ສະແດງລາຍການລະ​ບົບ​ໂຟລ໌ເດີ​ພິ​ເສດ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການຕິດຕັ້ງ ISO / VHD ໄຟລ໌ ດ້ວຍ PowerShell​?
Mount-DiskImage 'D:\ISO\file.iso' # ISO
Mount-DiskImage 'D:\VHD\file.vhd' # VHD

ວິ​ທີ​ການ​ກວດ​ສອບ​ລຸ່ນຂອງ .NET Framework ທີ່ຕິດ​ຕັ້ງ​ມາດ້ວຍ PowerShell​?

ວິ​ທີ​ການກວດ​ສອບເບິ່ງ​ວ່າ​ .NET Framework ລຸ່ນ 4.5 ມີການ​ຕິດ​ຕັ້ງຫຼືບໍ່ ດ້ວຍ PowerShell​?
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -EA 0).Version -like '4.5*'

ວິ​ທີ​ການ​ເລີ່ມ​ຕົ້ນ​ ​ແລະ ຢຸດ transcript (ເພື່ອສ້າງການ​​ບັນ​ທຶກ​ເຊສເຊິນຂອງ Windows PowerShell​) ດ້ວຍ PowerShell​?
Start-Transcript -Path 'C:\scripts\transcript.txt
Stop-Transcript

ວິ​ທີ​ການ​​ປ່ຽນ​ແປງ​ໄດເຣັກທໍຣີໃນ​ປະ​ຈຸ​ບັນ​ໄປຍັງສະ​ຖານ​ທີ່​ສະ​ເພາະ​ໃດ​ຫນຶ່ງດ້ວຍ PowerShell​?
Set-Location -Path 'C:\scripts'

ວິ​ທີ​ການລ້າງ​ຫນ້າ​ຈໍ​ດ້ວຍ PowerShell?
Clear-Host
cls # Alias

ວິ​ທີ​ການ​ປ່ຽນ​ແປງ​ຄວາມລະອຽດຂອງການ​ສະ​ແດງ​ຜົນ​ດ້ວຍ PowerShell​?
Set-DisplayResolution -Width 1280 -Height 1024 -Force # Windows 2012

ວິ​ທີ​ການ​ກໍາ​ນົດ​ໜ້າຕ່າງ “ເຕັມຫນ້າ​ຈໍ​” ດ້ວຍ PowerShell​?
mode.com 300

ວິ​ທີ​ການ​ສະແດງ​ຂະ​ໜາດ (ຄວາມ​ກວ້າງ ​ແລະ ​ຄວາມ​ສູງ​) ຂອງ​ຮູບ​ພາບ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການສະແດງລະຫັດ​ຜະ​ລິດ​ຕະ​ພັນຂອງ Windows ດ້ວຍ PowerShell​?

Perfmon

ວິ​ທີ​ການ​ໄດ້​ຮັບ​ຄ່າສະ​ເລ່ຍໃນ​ປະ​ຈຸ​ບັນຂອງ “​% ເວລາການປະມວນຜົນ​” ໃນຊ່ວງເວລາ 5 ວິນາ​ທີ (10 ຄັ້ງ​) ດ້ວຍ PowerShell​?
(Get-Counter '\Processor(_total)\% Processor Time' -SampleInterval 5 -MaxSamples 10).CounterSamples.CookedValue

Assemblies

ວິ​ທີ​ການ​ໂຫຼດ​ assemblies ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ກວດ​ສອບ .NET assemblies ປະ​ຈຸ​ບັນທີ່ຖືກໂຫຼດ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຄົ້ນຫາເສັ້ນ​ທາງຂອງ GAC (Global Assembly Cache) ດ້ວຍ PowerShell​?

Clipboard

ວິ​ທີ​ການ​ຄັດ​ລອກ​ຜົນ​ໄດ້ຮັບໄປຍັງ clipboard ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຮັບ​​ເນື້ອ​ໃນ​ຂອງ clipboard ດ້ວຍ PowerShell?
Add-Type -AssemblyName PresentationCore
[Windows.Clipboard]::GetText()

Hotfixes

ວິ​ທີ​ການສະແດງ hotfixes ​ທີ່​ຖືກຕິດ​ຕັ້ງ​ດ້ວຍ PowerShell​?
Get-HotFix -ComputerName $computer

ວິ​ທີ​ການ​ສະແດງ hotfixes ທີ່ຖືກຕິດຕັ້ງ ກ່ອນ / ຫຼັງ ​ຈາກ​ວັນ​ທີ​ສະ​ເພາະ​ໃດ​ຫນຶ່ງ​ດ້ວຍ PowerShell​?
Get-HotFix | Where-Object -FilterScript { $_.InstalledOn -lt ([DateTime]'01/01/2015') } # Before 01/01/2015
Get-HotFix | Where-Object -FilterScript {$_.InstalledOn -gt ([DateTime]'01/01/2015')} # After 01/01/2015

ວິ​ທີ​ການ​ກວດ​ກາ​ເບິ່ງວ່າ​ມີ​ການ​ຕິດ​ຕັ້ງ hotfixes ​ຫຼືບໍ່ ດ້ວຍ PowerShell​?
Get-HotFix -Id KB2965142

ວິ​ທີ​ການ​ສະແດງ hotfixes ​ທີ່​ຕິດ​ຕັ້ງ​ໃນ​ຄອມ​ພິວ​ເຕີ​ຫ່າງ​ໄກ​​ດ້ວຍ PowerShell​?
Get-HotFix -ComputerName $computer

Pagefile

ວິ​ທີ​ການ​ສະແດງຂໍ້​ມູນ​ Pagefile ດ້ວຍ PowerShell​?
Get-WmiObject -Class Win32_PageFileusage | Select-Object -Property Name, CurrentUsage, AllocatedBaseSize, PeakUsage, InstallDate

ວິ​ທີ​ການ​ຮັບ​ຂະ​ຫນາດ​ທີ່​ແນະ​ນໍາ (MB​) ສໍາ​ລັບ​ Pagefile ດ້ວຍ PowerShell?
[Math]::Truncate(((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5

ວິ​ທີ​ການ​ສ້າງ Pagefile (4096 MB​) ໃນຊ່ອງ (D:) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ລົບ Pagefile ໃນຊ່ອງ (C:) ດ້ວຍ PowerShell​?

Maintenance

ວິ​ທີ​ການ​ກວດ​ສອບ​ການ​ກະຈາຍຕົວ​ຂອງ​ໄດຣຟ໌ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ກວດ​ສອບພື້ນທີ່ວ່າງໃນດິສກ໌ໄດຣຟ໌ ດ້ວຍ PowerShell​?

Up


Files

ວິ​ທີ​ການ​ເປີດ​ໄຟລ໌ ດ້ວຍ PowerShell?
Invoke-Item -Path 'C:\scripts\file.txt'
.'C:\scripts\file.txt'

ວິ​ທີ​ການ​ອ່ານ​ໄຟລ໌ ດ້ວຍ PowerShell?
Get-Content -Path 'C:\scripts\file.txt'
gc "C:\scripts\file.txt" # Alias

ວິ​ທີ​ການ​ຂຽນ​ຜົນໄດ້ຮັບ​ໄປຍັງ​ໄຟລ໌ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງ​ຊື່​ເຕັມ​ຂອງ​ໄຟລ໌​ສະ​ຄຣິບ​ປະ​ຈຸ​ບັນ​ ດ້ວຍ PowerShell?
$MyInvocation.MyCommand.Path

ວິ​ທີ​ການບີບອັດໄຟລ໌ / zip ໄຟລ໌ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການເປີດໄຟລ໌ບີບອັດ / unzip ໄຟລ໌ ດ້ວຍ PowerShell​?

ວິທີ​​ເຂົ້າ​ໄປ​ເບິ່ງ​ໄຟລ໌​ທີ່ຈັດເກັບໃນຮູບແບບ ZIP ດ້ວຍ PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::OpenRead($fileZIP)

ວິ​ທີ​ການ​ສະ​ແດງ​ຂະ​ຫນາດ​ຂອງ​ໄຟລ໌ໃນຮູບແບບ KB ດ້ວຍ PowerShell​?
(Get-ChildItem -Path .\winsrv.dll).Length /1KB
(Get-ChildItem -Path .\winsrv.dll).Length /1MB
(Get-ChildItem -Path .\winsrv.dll).Length /1GB

ວິ​ທີ​ການ​ຊອກ​ຫາ​ໄຟລ໌ຂະ​ຫນາດ​ໃຫຍ່ ​ຫຼື ​ນ້ອຍ​ກ່ວາ 1 GB ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະ​ແດງ​ຊື່​ຂອງ​ໄຟລ໌​​ໂດຍ​ບໍ່​ສະແດງສ່ວນ​ຂະ​ຫຍາຍ​ ດ້ວຍ PowerShell?
[System.IO.Path]::GetFileNameWithoutExtension('C:\Windows\system32\calc.exe') # Return calc

ວິ​ທີ​ການ​ສະ​ແດງ​ສ່ວນຂະ​ຫຍາຍຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell​?
[System.IO.Path]::GetExtension('C:\scripts\file.txt') # Return .txt

ວິ​ທີ​ການສະແດງລຸ່ນຂອງ​ເອ​ກະ​ສານ​ຂອງ​ໄຟລ໌ ດວ້ຍ PowerShell​?

ວິ​ທີ​ການສະແດງລະຫັດ hash ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell?
(Get-FileHash $file).Hash

ວິ​ທີ​ການ​​ກວດ​ສອບ MD5 / SHA1 ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell​?
Get-FileHash $file -Algorithm MD5
Get-FileHash $file -Algorithm SHA1

ວິທີການ​ສະ​ແດງ​ໄຟລ໌​ທີ່ຖືກ​ເຊື່ອງ​ໄວ້​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​​ກວດສອບ​ເບິ່ງ​ວ່າໄຟລ໌ດັ່ງກ່າວມີ​ນາມ​ສະ​ກຸນ ຫຼື ບໍ່ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຕັ້ງຄ່າ​ໄຟລ໌ໃຫ້​ເປັນ “​ອ່ານຢ່າງດຽວ” ດ້ວຍ PowerShell?
Set-ItemProperty -Path .\file.txt -Name IsReadOnly -Value $true

ວິ​ທີ​ການ​ປ່ຽນ​ແປງ attribute “LastWriteTime​” ຂອງໄຟລ໌ໃດໜຶ່ງໃຫ້ເປັນອາ​ທິດທີ່ຜ່ານມາ​ດ້ວຍ PowerShell​?
Set-ItemProperty -Path .\file.txt -Name LastWriteTime -Value ((Get-Date).AddDays(-7))
If not working, use Nirsoft tool: BulkFileChanger.

ວິ​ທີ​ການ​ສ້າງ​ໄຟລ໌ໃຫມ່​ດ້ວຍ PowerShell​?
New-Item -ItemType File -Path 'C:\scripts\file.txt' -Value 'FirstLine'

ວິທີການປ່ຽນ​ຊື່​ໄຟລ໌ດ້ວຍ PowerShell?
Rename-Item -Path 'C:\scripts\file.txt' -NewName 'C:\scripts\powershellguru2.txt'

ວິ​ທີ​ການ​ bulk / batch ເພື່ອປ່ຽນຊື່ຫຼາຍໄຟລ໌ພ້ອມກັນດ້ວຍ PowerShell​?
Get-ChildItem -Path C:\scripts\txt | Rename-Item -NewName { $_.Name -replace ' ', '_' }

ວິ​ທີ​ການ​ລົບ​ໄຟລ໌ ດ້ວຍ PowerShell​?
Remove-Item -Path 'C:\scripts\file.txt'

ວິ​ທີ​ການ​ສະ​ແດງ 10 ແຖວຫຼ້າ​ສຸດ​ຂອງ​ໄຟລ໌ໃດໜຶ່ງ ດ້ວຍ PowerShell​?
Get-Content -Path 'C:\scripts\log.txt' -Tail 10

ວິ​ທີ​ການປົດລ໋ອກໄຟລ໌​ຈໍາ​ນວນຫຼາຍ​ຂອງ​ໂຟລ໌ເດີ​ໃດໜຶ່ງດ້ວຍ PowerShell​?
Get-ChildItem -Path 'C:\scripts\Modules' | Unblock-File

ວິ​ທີ​ການ​ລຶບແຖວວ່າງຈາກໄຟລ໌ໃດໜຶ່ງ ດ້ວຍ PowerShell?
(Get-Content -Path file.txt) | Where-Object -FilterScript {$_.Trim() -ne '' } | Set-Content -Path file.txt

ວິ​ທີ​ການ​ເພື່ອ​ກວດ​ກາ​ເບິ່ງ​ວ່າມີໄຟລ໌ດັ່ງກ່າວຢູ່ຫຼືບໍ່ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງໄຟລ໌ ໃໝ່ທີ່ສຸດ / ເກົ່າທີ່ສຸດ ທີ່ຖືກ​ສ້າງ​ຂື້ນ​ໃນ​ໂຟລ໌​ເດີ​ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ລຶບແຖວທີ່ຊ້ຳກັນອອກ​ຈາກ​ໄຟລ໌ ດ້ວຍ PowerShell?

ວິ​ທີ​ການສະແດງໄຟລ໌ທີ່ຖືກ​​ສ້າງ ​ຫຼາຍ ​ຫຼື ​ໜ້ອຍ​ກ່​ວາ 1 ເດືອນ​ໃນ​ໂຟລ໌ເດີ ​ດ້ວຍ PowerShell?

ວິ​ທີ​ການສະແດງໄຟລ໌ທີ່ຖືກ​​ສ້າງ ​ຫຼາຍ ​ຫຼື ​ໜ້ອຍ​ກ່​ວາ 1 ປີ​ໃນ​ໂຟລ໌ເດີ ​ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ສົ່ງ​ອອກ​ຄ່າ​​ຂອງ​ຕົວປ່ຽນໄປຍັງໄຟລ໌ໃດໜຶ່ງ ດ້ວຍ​ PowerShell?
Set-Content -Path file.txt -Value $variable

ວິ​ທີ​ການ​ນັບ​ຈໍາ​ນວນ​ຂອງ​ໄຟລ໌ (*.txt​) ໃນ​ໂຟລ໌ເດີ​ ດ້ວຍ PowerShell​?

ວິ​ທີການ​ຄົ້ນຫາສະ​ຕຣິງ​​ໃນຫຼາກຫຼາຍ​ໄຟລ໌ ດ້ວຍ PowerShell?
Select-String -Path 'C:\*.txt' -Pattern 'Test'

ວິທີ​ການ​ສະ​ແດງ​ແຖວ ​ທໍາ​ອິດ / ສຸດ​ທ້າຍ​ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະ​ແດງ​ຈຳ​ນວນ​ແຖວສະ​ເພາະ​ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ນັບ​ຈໍາ​ນວນ​ແຖວ​ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ນັບ​ຈໍາ​ນວນ​ຂອງ​ຕົວເລກ ​ແລະ​ ຄໍາ​ເວົ້າ​ ໃນ​ໄຟລ໌ໃດໜຶ່ງ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ດາວ​ນ໌​ໂຫລດ​ໄຟລ໌ ດ້ວຍ PowerShell​?
Invoke-WebRequest -Uri 'http://www.nirsoft.net/utils/searchmyfiles.zip' -OutFile 'C:\tools\searchmyfiles.zip'

ວິ​ທີ​ການ​ສະ​ແດງ​ເສັ້ນ​ທາງແບບ​ເຕັມ​ຂອງ​ໄຟລ໌ ດ້ວຍ PowerShell​?
Resolve-Path -Path .\script.ps1 # Return C:\Scripts\script.ps1

Copy

ວິ​ທີ​ການ​ສໍາ​ເນົາ​ໄຟລ໌ໃດໜຶ່ງໄປຍັງໂຟລ໌ເດີ​ໃດໜຶ່ງ ດ້ວຍ PowerShell?
Copy-Item -Path 'C:\source\file.txt' -Destination 'C:\destination'

ວິ​ທີ​ການ​ສໍາ​ເນົາ​ໄຟລ໌ໜຶ່ງ​ໄປຍັງ​ຫຼາຍໂຟລ໌ເດີ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​​ສໍາ​ເນົາ​ເອົາຫຼາຍ​ໄຟລ໌ໄປຍັງ​ໂຟລ໌​ເດີ​ໜຶ່ງ ດ້ວຍ PowerShell​?
Get-ChildItem -Path 'C:\source' -Filter *.txt | Copy-Item -Destination 'C:\destination'

Up


Active Directory

Domain & Forest

Computers

Groups

Organizational Unit (OU)

Users

Domain & Forest

ວິ​ທີ​ການ​ຫາ​ເຄື່ອງ​ແມ່​ຂ່າຍ Global Catalog ໃນ Active Directory ດ້ວຍ PowerShell​?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs

ວິ​ທີ​ການ​ຊອກ​ຫາ​ສະ​ຖານ​ທີ່​ຢູ່​ໃນ Active Directory ດ້ວຍ PowerShell​?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites

ວິ​ທີ​ການ​ຊອກ​ຫາ​​ຕົວຄວບຄຸມໂດເມນ​​ປະ​ຈຸ​ບັນ​ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​​ຊອກ​ຫາຕົວຄວບຄຸມໂດເມນທັງ​ຫມົດ​​ໃນ​ໂດ​ເມນໃດໜຶ່ງ ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຊອກ​ຫາ​ການ​ລົ້ມ​ເຫຼວຂອງ AD ​ທີ່ໃຊ້ງານຢູ່ ດ້ວຍ PowerShell​?
Get-ADReplicationFailure dc02.domain.com # Windows 8 and 2012

ວິ​ທີ​ການ​ຊອກ​ຫາ​ອາຍຸການໃຊ້ງານຂອງ tombstone ​ສໍາ​ລັບ​ປ່າ​ໄມ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງ​ລາຍ​ລະ​ອຽດ​ຂອງ ​ປ່າ​ໄມ້ / ໂດເມນ ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງ​ເສັ້ນ​ທາງ​ຂອງຕົວຈັດເກັບ “Deleted Objects​” ​ໃນ Active Directory ດ້ວຍ PowerShell​?
(Get-ADDomain).DeletedObjectsContainer

ວິ​ທີ​ການ​ເປີດໃຊ້ງານ​ຄຸນ​ສົມ​ບັດພິເສດຂອງ AD Recycle Bin ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ກູ້ຄືນບັນ​ຊີ AD ຈາກ Recycle Bin ໃນ Active Directory ດ້ວຍ PowerShell​?
Get-ADObject -Filter 'samaccountname -eq "powershellguru"' -IncludeDeletedObjects | Restore-ADObject

ວິ​ທີ​ການ​ຫາ​​ບົດ​ບາດຂອງ FSMO ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ເຊື່ອມ​ຕໍ່​ກັບ​ຕົວຄວບຄຸມໂດເມນ​ທີ່ສະ​ເພາະເຈາະຈົງ ​ດ້ວຍ PowerShell​?
Get-ADUser -Identity $user -Server 'serverDC01'

ວິ​ທີ​ການ​​ຮັບ​ການເຂົ້າສູ່ລະບົບເຄື່ອງ​ແມ່​ຂ່າຍປະ​ຈຸ​ບັນ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການດຳເນີນການ “gpupdate​” ເທິງ​ຄອມ​ພິວ​ເຕີ ດ້ວຍ PowerShell​?
Invoke-GPUpdate -Computer $computer -Force -RandomDelayInMinutes 0 # Windows 2012

Groups

ວິ​ທີ​ການ​ສ້າງ​ກຸ່ມ​ໃຫມ່​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການລຶບກຸ່ມ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Remove-ADGroup -Identity 'PowershellGuru'

ວິ​ທີ​ການ​ເພີ່ມຜູ້ໃຊ້ເຂົ້າກຸ່ມ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Add-ADGroupMember "Powershell Guru" -Members powershellguru

ວິ​ທີ​ການ​ລຶບ​ຜູ້ໃຊ້ອອກ​ຈາກ​ກຸ່ມ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Remove-ADGroupMember 'Powershell Guru' -Members powershellguru

ວິ​ທີ​ການ​ຊອກ​ຫາ​ກຸ່ມ​ເປົ່າ (ທີ່​ບໍ່​ມີ​ສະ​ມາ​ຊິກ​​) ໃນ Active Directory ດ້ວຍ PowerShell​?
Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}

ວິ​ທີ​ການ​ນັບ​ກຸ່ມ​ເປົ່າ (ທີ່​ບໍ່ມີ​ສະ​ມາ​ຊິກ​​​) ໃນ Active Directory ດ້ວຍ PowerShell​?
(Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}).Count

ວິ​ທີ​ການ​ສະແດງ​ສະ​ມາ​ຊິກ​ຂອງ​ກຸ່ມ​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການສະແດງ​ສະ​ມາ​ຊິກ​ຂອງ​ກຸ່ມ​ລວມທັງສະ​ມາ​ຊິກ recursive ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ນັບ​ຈໍາ​ນວນ​ຂອງ​ສະ​ມາ​ຊິກ​ຂອງ​ກຸ່ມ ​ລວມທັງ / ບໍ່​ລວມທັງ ​ສະ​ມາ​ຊິກ recursive ໃນ Active Directory ດ້ວຍ PowerShell​?

Users

ວິ​ທີ​ການ​ນໍາ​ໃຊ້ ​wildcard ​ໃນ​ການ​ກັ່ນ​ຕອງ​ຂອງ “Get-ADUser” ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຍ້າຍ​ຜູ້​ໃຊ້ໄປຍັງ OU ອື່ນ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Move-ADObject -Identity $dn -TargetPath 'OU=myOU,DC=domain,DC=com'

ວິ​ທີ​ການ​ຫາ​ສະ​ມາ​ຊິກ​ທັງ​ຫມົດ​ເປັນ (Nested) ສໍາ​ລັບ​ຜູ້​ໃຊ້ໃດໜຶ່ງ​ ດ້ວຍ PowerShell​?
Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($dn))"

ວິ​ທີ​ການ​ສະແດງສະ​ມາ​ຊິກ (ຊື່​ສັ້ນ / ຕົວຫຍໍ້) ສໍາ​ລັບ​ຜູ້​ໃຊ້ໃດໜຶ່ງ ດ້ວຍ PowerShell​?
(Get-ADUser $user -Properties MemberOf).MemberOf | ForEach-Object -Process {($_ -split ',')[0].Substring(3)} | Sort-Object

ວິ​ທີ​ການ​ປ່ຽນ​​ຊື່ (FullName​)​, ​​(DisplayName)​, GivenName (FirstName​) ແລະ ​ນາມ​ສະ​ກຸນ (LastName) ສໍາ​ລັບ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິທີການ​ປ່ຽນ​ແປງ ​ລາຍ​ລະ​ອຽດ​, ຫ້ອງ​ການ​, ແລະ​ ໝາຍເລກ​ໂທລະ​ສັບ​ສໍາ​ລັບ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
Set-ADUser $samAccountName -Description 'IT Consultant' -Office 'Building B' -OfficePhone '12345'

ວິ​ທີ​ການ​ກໍາ​ນົດ​ວັນ​ຫມົດ​ອາ​ຍຸ​ທີ່ວັນທີ “31/12/2015​” ຫຼື “ບໍ່ໝົດອາຍຸ​” ສໍາ​ລັບ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ປົດ​ລັອກ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
Unlock-ADAccount $samAccountName

ວິ​ທີ​ການ​ ເປີດ / ປິດ​ ການ​ໃຊ້​ງານ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການລຶບບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
Remove-ADUser $samAccountName

ວິ​ທີ​ການຕັ້ງຄ່າລະ​ຫັດ​ຜ່ານ​ສໍາ​ລັບ​​ບັນ​ຊີ​​ຜູ້​ໃຊ້​ຄົນໜຶ່ງໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການຕັ້ງຄ່າລະ​ຫັດ​ຜ່ານ​ສໍາ​ລັບບັນ​ຊີ​ຜູ້​ໃຊ້ຫຼາຍຄົນ (ກຸ່ມ​) ໃນ Active Directory ດ້ວຍ PowerShell?

ວິ​ທີ​ການຊອກ​ຫາ​ເຈົ້າ​ຂອງ​ເອ​ກະ​ສານ​ທີ່​ຢູ່​ໃນ Active Directory ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ຫາ OU (Organizational Unit) ສໍາ​ລັບ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
[regex]::match("$((Get-ADUser $user -Properties DistinguishedName).DistinguishedName)",'(?=OU=)(.*\n?)').value

ວິ​ທີ​ການ​ຊອກ​ຫາ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ທີ່ປິດການໃຊ້ງານ​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຊອກ​ຫາ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ທີ່​ຫມົດ​ອາ​ຍຸ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Search-ADAccount -AccountExpired

ວິ​ທີ​ການຊອກ​ຫາ​ບັນ​ຊີ​ຜູ້​ໃຊ້ທີ່ຖືກລ໋ອກ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Search-ADAccount -LockedOut

ວິ​ທີ​ການ​ຫາ SID ຂອງ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
(Get-ADUser $user -Properties SID).SID.Value

ວິ​ທີ​ການປ່ຽນ​ແປງ​ຊື່​ຜູ້​ໃຊ້ເປັນ SID ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການປ່ຽນ​ແປງ SID ເປັນຊື່​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິທີການແຍກ​ຊື່​ສະເພາະ​ຂອງ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຫາ​ວັນ​ທີ​ຂອງ ​ການ​ສ້າງ / ການແກ້ໃຂ ​ຂອງ​ບັນ​ຊີ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
Get-ADUser -Identity $user -Properties whenChanged, whenCreated | Format-List -Property whenChanged, whenCreated

ວິ​ທີສະ​ແດງ​ຄຸນ​ສົມ​ບັດ​ທາງ​ເລືອກ​ ແລະ​ ການ​ບັງ​ຄັບ ​ສໍາ​ລັບ​ຄລາສ “ຜູ້ໃຊ້​” ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີສະແດງ​ເສັ້ນ​ທາງ​ຂອງ LDAP ສໍາ​ລັບ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ປ່ຽນ​ແປງ CN (Canonical​ Name) ສໍາ​ລັບ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?
Rename-ADObject $((Get-ADUser $user -Properties DistinguishedName).DistinguishedName) -NewName 'Test Powershell'

ວິ​ທີ​ການ​ສະແດງ Organizational Unit (OU​) ພໍ່​ແມ່​ຂອງ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ເພື່ອ​ໃຫ້​ໄດ້​ຮັບ​ຂອງ​ເຈົ້າ​ຂອງ​ເປັນ​ຜູ້​ໃຊ້ (ຜູ້​ທີ່​ໄດ້​ສ້າງ​ບັນ​ຊີ​) ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ປ່ຽນແປງ​ຄຸນລັກສະນະຂອງ PwdLastSet ສໍາ​ລັບ​ຜູ້​ໃຊ້​ໃນ Active Directory ດ້ວຍ PowerShell​?

Computers

ວິ​ທີ​ການ​ທົດ​ສອບ​ຊ່ອງທາງຄວາມ​ປອດ​ໄພລະ​ຫວ່າງ​ເຄື່ອງ​ຄອມ​ພິວ​ເຕີ​ທົ່ວໄປ ແລະ ໂດເມນ ດ້ວຍ PowerShell?
Test-ComputerSecureChannel

ແນວທາງ​ການ​ສ້ອມ​ແປງ​​ຊ່ອງທາງຄວາມ​ປອດ​ໄພ​​ລະ​ຫວ່າງ​ເຄື່ອງ​ຄອມ​ພິວ​ເຕີທົ່ວໄປ ​ແລະ​ ໂດເມນ PowerShell?
Test-ComputerSecureChannel -Repair

ວິ​ທີ​ການ​ປິດ​ການ​ໃຊ້​ງານ​ບັນ​ຊີ​ຄອມ​ພິວ​ເຕີ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Disable-ADAccount $computer

ວິ​ທີ​ການ​ຫາ​ຄອມ​ພິວ​ເຕີ​ທີ່ມີ​ລະ​ບົບ​ປະ​ຕິ​ບັດ​ການ​ສະ​ເພາະເຈາະຈົງ​ໃນ Active Directory ດ້ວຍ PowerShell​?

Organizational Unit (OU)

ວິ​ທີ​ການ​ສ້າງ​ Organizational Unit (OU​) ໃນ Active Directory ດ້ວຍ PowerShell​?
New-ADOrganizationalUnit -Name 'TEST' -Path 'DC=domain,DC=com'

ວິ​ທີ​ການ​ສະແດງລາຍລະອຽດຂອງ Organizational Unit (OU​) ​ໃນ Active Directory ດ້ວຍ PowerShell​?
Get-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Properties *

ວິທີການປ່ຽນ​ແປງ​ລາຍ​ລະ​ອຽດ​ຂອງ ​Organizational Unit (OU​) ໃນ Active Directory ດ້ວຍ PowerShell​?
Set-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Description 'My description'

ວິ​ທີ​ການ ເປີດ / ປິດ​ ການ​ໃຊ້​ງານ Organizational Unit (OU​) ຈາກ​ການ​ລຶບໂດຍບໍ່ຕັ້ງໃຈໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການເປີດໃຊ້ງານການ​ລຶບໂດຍບໍ່ຕັ້ງໃຈ​ສໍາ​ລັບ​​ Organizational Unit (OU​) ທັງ​ຫມົດໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ລົບ Organizational Unit (OU​) ຈາກປ້ອງ​ກັນ​ຈາກ​ການ​ລຶບໂດຍບໍ່ຕັ້ງໃຈ​ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ປ່ຽນແປງ ​Distinguished Name ຂອງ Organizational Unit (OU​) ເປັນ Canonical Name ໃນ Active Directory ດ້ວຍ PowerShell​?

ວິ​ທີ​ການສະແດງລາຍການຂອງ Organizational Units (OUs) ວ່າງເປົ່າ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການສະແດງຜູ້​ຈັດ​ການ​ຂອງ​ກຸ່ມ​ດ້ວຍ PowerShell​?
(Get-ADGroup $dn -Properties Managedby).Managedby

Up


Regex (Regular Expression)

ວິ​ທີ​ການ​ດຶງເອົາທີ່​ຢູ່ IP v4 (80.80.228.8​) ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The IP address is 80.80.228.8'
$ip = [regex]::match($example,'\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b').value

ວິ​ທີ​ການດຶງ​ເອົາ​ທີ່​ຢູ່ຂອງ MAC (C0​, D9-62-39-61-2D​) ດ້ວຍຕົວ​ແຍກ “-​” ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The MAC address is C0-D9-62-39-61-2D'
$mac = [regex]::match($example,'([0-9A-F]{2}[-]){5}([0-9A-F]{2})').value

ວິ​ທີ​ການດຶງ​ເອົາ​ທີ່​ຢູ່ຂອງ MAC (C0​: D9​: 62​: 39​: 61​: 2D​) ດ້ວຍຕົວ​ແຍກ “:​” ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The MAC address is C0:D9:62:39:61:2D'
$mac = [regex]::match($example,'((\d|([a-f]|[A-F])){2}:){5}(\d|([a-f]|[A-F])){2}').value

ວິ​ທີ​ການດຶງເອົາ​ວັນ​ທີ (10/02/2015​) ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The date is 10/02/2015'
$date = [regex]::match($example,'(\d{2}\/\d{2}\/\d{4})').value

ວິ​ທີ​ການດຶງ​ເອົາ URL (www.powershell-guru.com​) ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The URL is www.powershell-guru.com'
$url = [regex]::match($example,'[a-z]+[:.].*?(?=\s)').value

ວິ​ທີ​ການດຶງ​ເອົາ​ອີ​ເມລ (user@domain.com​) ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'The email is user@domain.com'
$email = [regex]::match($example,'(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b').value

ວິ​ທີ​ການດຶງເອົາຄຳວ່າ “guru​” ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?=.com)').value

ວິ​ທີ​ການ​ດຶງເອົາຄຳວ່າ “guru.com​” ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?<=.)').value

ວິ​ທີ​ການ​ດຶງເອົາ “powershell-guru.com​” ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=www.)(.*\n?)').value

ວິ​ທີ​ການ​ດຶງເອົາຕົວເລກ “123​” ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'Powershell123'
[regex]::match($example,'(\d+)').value

ວິ​ທີ​ການ​ດຶງເອົາເຄື່ອງໝາຍ “$​” (ເຄື່ອງໝາຍດອນລາ​) ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
$example = 'Powershell`$123'
[regex]::match($example,'(\$)').value

ວິ​ທີ​ການ​ທົດ​ແທນ​ຕົວອັກສອນ (*.com​) ໄປເປັນ (*.fr​) ຈາກ​ຂໍ້ຄວາມ​ຕົວ​ຢ່າງໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell?
$example = 'www.powershell-guru.com'
[regex]::Replace($example, '.com','.fr')

ວິ​ທີ​ການຫຼີກລ້ຽງຂໍ້ຄວາມໃດໜຶ່ງ ດ້ວຍ Regex ​​ດ້ວຍ PowerShell​?
[regex]::Escape('\\server\share')

Up


Memory

ວິ​ທີ​ການ​ບັງ​ຄັບ​ການ​ເກັບ​ກໍາ​ຂອງໜ່ວຍຄວາມຈໍາ​ໂດຍ​ຕົວເກັບກຳ ດ້ວຍ PowerShell​?
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()

ວິ​ທີ​ການ​​ຮັບ​ຂະ​ຫນາດຂອງ RAM ຂອງ​ຄອມ​ພິວ​ເຕີ​ດ້ວຍ PowerShell​?

Up


Date

ວິ​ທີ​ການ​ສະແດງວັນ​ທີ່​ປະ​ຈຸ​ບັນ​ດ້ວຍ PowerShell​?
Get-Date
[Datetime]::Now

ວິ​ທີ​ການ​ສະ​ແດງ​ວັນ​ທີ​ໃນ​ຮູບ​ແບບ​ທີ່​ແຕກ​ຕ່າງ​ກັນ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການປ່ຽນ​ແປງ​ວັນທີແບບ (Datetime) ເປັນ​ວັນທີແບບ (String​) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ແປງ​ວັນທີແບບ (String​) ເປັນ​ວັນ​ທີແບບ (Datetime) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຄິດ​ໄລ່ຄວາມແຕກ​ຕ່າງ​ກັນຂອງ (ຈຳ​ນວນ​ຂອງ​ມື້​, ຊົ່ວ​ໂມງ​, ນາ​ທີ​, ​ຫຼື ວິ​ນາ​ທີ​) ລະ​ຫວ່າງ​ສອງວັນ​ທີ່​​ດ້ວຍ PowerShell​?
(New-TimeSpan -Start $dateStart -End $dateEnd).Days
(New-TimeSpan -Start $dateStart -End $dateEnd).Hours
(New-TimeSpan -Start $dateStart -End $dateEnd).Minutes
(New-TimeSpan -Start $dateStart -End $dateEnd).Seconds

ວິ​ທີ​ການ​ປຽບ​ທຽບ​ສອງ​ວັນ​ທີດ້ວຍ PowerShell​?
(Get-Date 2015-01-01) -lt (Get-Date 2015-01-30) # True
(Get-Date 2015-01-01) -gt (Get-Date 2015-01-30) # False

ວິ​ທີ​ການຈັດລຽງອາເຣຂອງ​ວັນ​ທີ່ເປັນ “Datetime” ດ້ວຍ PowerShell?
$arrayDate | Sort-Object -Property {$_ -as [Datetime]}

ວິ​ທີ​ການ​ເລີ່ມ​ຕົ້ນ​​ແລະ​ການຢຸດ​ເຊົາ​ການ​ຈັບ​ເວ​ລາ​ ດ້ວຍ PowerShell?
$chrono = [Diagnostics.Stopwatch]::StartNew()
$chrono.Stop()
$chrono

ວິ​ທີ​ການສະແດງ​​ມື້ປະ​ຈຸ​ບັນ​ຂອງ​ອາ​ທິດ​ດ້ວຍ PowerShell?
(Get-Date).DayOfWeek #Sunday

ວິ​ທີ​ການ​ຮັບວັນ​ທີ່​ຂອງ​ມື້​ວານ​ນີ້​ ດ້ວຍ PowerShell​?
(Get-Date).AddDays(-1)

ວິ​ທີ​ການສະແດງ​ຈໍາ​ນວນ​ຂອງ​ມື້​ໃນ​ໜຶ່ງເດືອນ (ໃນ​ເດືອນ​ກຸມ​ພາ 2015​) ດ້ວຍ PowerShell​?
[DateTime]::DaysInMonth(2015, 2)

ວິ​ທີ​ທີ່​ຈະ​ຮູ້​ວ່າ​ປີ​ກ້າວ​ກະ​ໂດດ​ດ້ວຍ PowerShell​?
[DateTime]::IsLeapYear(2015)

ວິ​ທີ​ການສະແດງລາຍການ​ເຂດ​ເວ​ລາ​ດ້ວຍ PowerShell​?
[System.TimeZoneInfo]::GetSystemTimeZones()

Up


Networking

ວິ​ທີ​ການ​ເຂົ້າ​ລະ​ຫັດ (ໃນ​ຮູບ​ແບບ ASCII​) ແລະ​ ຖອດ​ລະ​ຫັດ URL ດ້ວຍ PowerShell?

​ຄໍາ​ສັ່ງທຽບ​ເທົ່າ​ຂອງ​​ເຄືອ​ຂ່າຍພື້ນຖານ ດ້ວຍ PowerShell ແມ່ນ​ຫຍັງ​?

ວິ​ທີ​ການສະແດງ​ທີ່​ຢູ່ IP ດ້ວຍ PowerShell​?
Get-NetIPAddress # Windows 8.1 & Windows 2012
Get-NetIPConfiguration # Windows 8.1 & Windows 2012

ວິ​ທີ​ການ​ປິດ​ການ​ໃຊ້​ງານທີ່​ຢູ່ IP v6 (IPv6​) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ກວດ​ສອບທີ່​ຢູ່ IP v4 (IPv4​) ດ້ວຍ PowerShell​?
if([ipaddress]'10.0.0.1'){'validated'}

ວິ​ທີ​ການ​ຊອກ​ຫາ​ທີ່​ຢູ່ IP ພາຍ​ນອກ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຫາ​ Hostname ​ຈາກ​ທີ່​ຢູ່ IP ດ້ວຍ PowerShell?
([System.Net.Dns]::GetHostEntry($IP)).Hostname

ວິ​ທີ​ການ​ຊອກ​ຫາ​ທີ່​ຢູ່ IP ​ຈາກ​ Hostname ດ້ວຍ PowerShell​?
([System.Net.Dns]::GetHostAddresses($computer)).IPAddressToString

ວິ​ທີ​ການ​ຫາ FQDN ຈາກ Hostname ​ດ້ວຍ PowerShell​?
[System.Net.Dns]::GetHostByName($computer).HostName

ວິ​ທີ​ການ​ຊອກ​ຫາ​ການ​ຕັ້ງ​ຄ່າ​ເຄືອ​ຂ່າຍ (Ip​, Subnet​, Gateway, DNS​) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຫາ​ທີ່​ຢູ່ MAC ດ້ວຍ PowerShell​?
Get-CimInstance win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress
Get-WmiObject -Class win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress

ວິ​ທີ​ການ​ ping ​ຄອມ​ພິວ​ເຕີ​ດ້ວຍ PowerShell?

ວິ​ທີ​ການກວດສອບ​ເບິ່ງ​ວ່າ​ຄອມ​ພິວ​ເຕີ​ແມ່ນ​ເຊື່ອມ​ຕໍ່​ກັບ​ອິນ​ເຕີ​ເນັດ ຫຼື ບໍ່ ​ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ດຳເນີນການຄົ້ນຫາແບບ “whois” ສໍາ​ລັບ​ເວັບ​ໄຊ​ດ້ວຍ PowerShell?
$whois = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$whois.GetWhoIs('powershell-guru.com')

ວິ​ທີ​ການ​ສະແດງ​ລາຍ​ລະ​ອຽດ​ຂອງ ​IP ສາ​ທາ​ລະ​ນະ (Geolocation​) ດ້ວຍ PowerShell​?

ວິ​ທີ​ການກວດ​ກາ​ເບິ່ງ​​ວ່າ​ພ໋ອດ​ແມ່ນ​ ເປີດ / ປິດ​ ດ້ວຍ PowerShell​?
New-Object -TypeName Net.Sockets.TcpClient -ArgumentList $computer, 135

ວິ​ທີ​ການ​ດຳເນີນການກັບ “tracert​” ດ້ວຍ PowerShell​?
Test-NetConnection www.google.com -TraceRoute

ວິ​ທີ​ການ​ແກ້​ໄຂ​ຂໍ້​ມູນ​ການເຊື່ອມ​ຕໍ່​ເຄືອ​ຂ່າຍ​ພາຍໃນເຮືອນ​ດ້ວຍ PowerShell​?
Get-NetAdapter | Format-Table -Property Name, InterfaceDescription, ifIndex -AutoSize # Windows 8.1
Set-NetConnectionProfile -InterfaceIndex 6 -NetworkCategory Private

ວິ​ທີ​ການ​ສະ​ແດງ​ພ໋ອດການ​ເຊື່ອມ​ຕໍ່​ TCP ດ້ວຍ PowerShell​?
netstat.exe -ano
Get-NetTCPConnection #Windows 8 and 2012

ວິ​ທີ​ການ​ຫຼຸດ​ຄວາມຍາວຂອງ URL ​ໃຫ້ເປັນ URL ທີ່ສັ້ນລົງ ​ດ້ວຍ PowerShell​?
$url = 'www.powershell-guru.com'
$tiny = Invoke-RestMethod -Uri "http://tinyurl.com/api-create.php?url=$url"

ວິ​ທີ​ການ​​ຮັບ​ການ​ຕັ້ງຄ່າ ​proxy ດ້ວຍ PowerShell​?
Get-ItemProperty -Path HKCU:"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

DNS

ວິ​ທີ​ການ​ກວດ​ສອບຖານຄວາມຈຳ DNS ເທິງຄອມ​ພິວ​ເຕີ​ພື້ນຖານ ​ດ້ວຍ PowerShell​?
ipconfig.exe /displaydns
Get-DnsClientCache #Windows 8 and 2012

ວິ​ທີ​ການ​ອະ​ນາ​ໄມ​ຖານ​ຄວາມ​ຈໍາ DNS ເທິງຄອມ​ພິວ​ເຕີ​ພື້ນຖານ ດ້ວຍ PowerShell​?
ipconfig.exe /flushdns
Start-Process -FilePath ipconfig -ArgumentList /flushdns -WindowStyle Hidden
Clear-DnsClientCache #Windows 8 and 2012

ວິ​ທີ​ການ​ອະ​ນາ​ໄມ​ຖານ​ຄວາມ​ຈໍາ DNS ເທິງຣີໂມດຄອມ​ພິວ​ເຕີ ດ້ວຍ PowerShell​?
Invoke-Command -ScriptBlock {Clear-DnsClientCache} -ComputerName computer01, computer02

ວິ​ທີ​ການ​ອ່ານແຟ້ມ​ໂຮສຕ໌ ດ້ວຍ PowerShell​?
Get-Content -Path 'C:\Windows\system32\drivers\etc\hosts'

Up


Password

ວິ​ທີ​ການ​ສ້າງ​ລະ​ຫັດ​ຜ່ານແບບສຸ່ມ ດ້ວຍ PowerShell​?
[Reflection.Assembly]::LoadWithPartialName('System.Web')
[System.Web.Security.Membership]::GeneratePassword(30,2)

ວິ​ທີ​ການ​ປ່ຽນ​ລະ​ຫັດ​ຜ່ານ​ສໍາ​ລັບ​ຜູ້​ບໍ​ລິ​ຫານ​ເທິງ​ເຄື່ອງ​ແມ່​ຂ່າຍ​ຫ່າງ​ໄກ​ ​ດ້ວຍ PowerShell​?
$admin = [ADSI]('WinNT://server01/administrator,user')
$admin.SetPassword($password)
$admin.SetInfo()

ວິ​ທີ​ການ​ຫາ​ວັນ​ຫມົດ​ອາ​ຍຸ​ຂອງລະ​ຫັດ​ຜ່ານ​ຂອງ​ບັນ​ຊີ​ຜູ້ໃຊ້ໃນ Active Directory ດ້ວຍ PowerShell​?

Up


Printers

ວິ​ທີ​ສະແດງລາຍການເຄື່ອງ​ພິມ​ທັງ​ຫມົດ​ສໍາ​ລັບ​ເຄື່ອງ​ແມ່​ຂ່າຍ​ສະ​ເພາະເຈາະຈົງ ​ດ້ວຍ PowerShell​?
Get-WmiObject -Query 'Select * From Win32_Printer' -ComputerName $computer

ວິ​ທີສະແດງລາຍການພ໋ອດ​ທັງ​ຫມົດ​ສໍາ​ລັບ​ເຄື່ອງ​ແມ່​ຂ່າຍ​ສະ​ເພາະ​ເຈາະຈົງ ດ້ວຍ PowerShell​?
Get-WmiObject -Class Win32_TCPIPPrinterPort -Namespace 'root\CIMV2' -ComputerName $computer

ວິ​ທີ​ການ​​ປ່ຽນ​ແປງ ​ຄວາມ​ຄິດ​ເຫັນ / ສະ​ຖານ​ທີ່ ​ຂອງ​ເຄື່ອງ​ພິມ​ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການລົບລ້າງ (ຍົກ​ເລີກ​ໜ້າວຽກ​ທັງ​ຫມົດ​) ໃນ​ເຄື່ອງ​ພິມ ​ດ້ວຍ PowerShell​?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.CancelAllJobs()

ວິ​ທີ​ການ​ພິມ​ຫນ້າ​ການ​ທົດ​ສອບ​ສໍາ​ລັບເຄື່ອງ​ພິມ​ດ້ວຍ PowerShell?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.PrintTestPage()

ວິ​ທີ​ການ​ສະແດງ​ການ​ລໍ​ຖ້າ​ພິມ​ງານສໍາ​ລັບເຄື່ອງ​ພິມ​ດ້ວຍ PowerShell​?

Up


Regedit

Read

ວິ​ທີ​ການລາຍງານກຸ່ມຣີຈິສທຣີດ້ວຍ PowerShell​?
Get-ChildItem -Path Registry::

ວິ​ທີ​ການ​ສະແດງ​ຄ່າຂອງຣີຈິສທຣີ​ ​ແລະ​ ຊະ​ນິດຂອງຣີຈິສທຣີ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການສະແດງຣີຈິສທຣີຄີ​ ຊັບຄີ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສະແດງຣີຈິສທຣີຄີ ຊັບຄີ ແບບ recursive ດ້ວຍ PowerShell​?
Get-ChildItem -Path 'HKLM:\SYSTEM' -Recurse -ErrorAction SilentlyContinue

ວິ​ທີ​ການ​ຊອກ​ຫາຊັບ​ຄີ​ທີ່​ມີ​ຊື່​ສະ​ເພາະ​ດ້ວຍ PowerShell​?
Get-ChildItem -Path 'HKLM:\SOFTWARE' -Include *Plugin* -Recurse -ErrorAction SilentlyContinue

ວິ​ທີ​ການ​ເອີ້ນ​ຄືນ​ພຽງ​ແຕ່​ຊື່​ຂອງຣີຈິສທຣີ ຊັບ​ຄີ​ ດ້ວຍ PowerShell?
(Get-ChildItem -Path 'HKLM:\SYSTEM').Name # Return HKEY_LOCAL_MACHINE\SYSTEM\ControlSet
Get-ChildItem -Path 'HKLM:\SYSTEM' -Name # Return ControlSet

ວິ​ທີ​ການ​ລາຍງານຄ່າຂອງຣີຈິສທຣີ ​ດ້ວຍ PowerShell​?
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

ວິ​ທີ​ການ​ອ່ານ​ຄ່າ​ຂອງຣີຈິສທຣີ​ສະ​ເພາະ​ເຈາະຈົງ ດ້ວຍ PowerShell​?
(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ProductName

ວິ​ທີ​ການ​ອ່ານ​ຄ່າ​ຣີຈິສທຣີ​ສະ​ເພາະ​ເຈາະຈົງເທິງ​ຄອມ​ພິວ​ເຕີ​ຫ່າງ​ໄກ​ ດ້ວຍ PowerShell​?

Write

ວິ​ທີ​ການ​ສ້າງ​ຣີຈິສທຣີຄີໃຫມ່​ດ້ວຍ PowerShell​?
New-Item -Path 'HKCU:\Software\MyApplication'

ວິ​ທີ​ການ​ສ້າງ​ຄ່າຣີຈິສທຣີ ​ດ້ວຍ PowerShell​?
New-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '1.0'

ວິ​ທີ​ການ​ປັບ​ປຸງ​ແກ້​ໄຂ​ຄ່າຣີຈິສທຣີທີ່​ມີ​ຢູ່​ແລ້ວ​ດ້ວຍ PowerShell​?
Set-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '2.0'

Delete

ວິ​ທີ​ການ​ລົບ​ຄ່າ​ຣີຈິສທຣີດ້ວຍ PowerShell​?
Remove-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version'

ວິ​ທີ​ການ​ລົບ​ຣີຈິສທຣີຄີດ້ວຍ PowerShell​?
Remove-Item -Path 'HKCU:\Software\MyApplication' -Force

Test

ວິ​ທີ​ການ​ທົດ​ສອບ​ວ່າ​ຣີຈິສທຣີຄີ​ມີ​ຢູ່ ຫຼື ບໍ່ ​ດ້ວຍ PowerShell​?
Test-Path -Path 'HKCU:\Software\MyApplication'

ວິ​ທີ​ການ​ທົດ​ສອບ​ວ່າ​​ຄ່າ​ຂອງຣີຈິສທຣີ​ມີ​ຢູ່​ ຫຼື ບໍ່ ດ້ວຍ PowerShell​?
(Get-Item -Path 'HKCU:\Software\MyApplication').GetValueNames() -contains 'Version'

Up


Strings

ວິ​ທີ​ການ​ລຶບຊ່ອງວ່າງຈາກ​ຈຸດ​ເລີ່ມ​ຕົ້ນ​ຂອງ​ຂໍ້ຄວາມ ດ້ວຍ PowerShell​?
$string = ' PowershellGuru'
$string = $string.TrimStart()

ວິ​ທີ​ການ​ລຶບຊ່ອງວ່າງຈາກ​ຈຸດສິ້ນສຸດ​ຂອງ​ຂໍ້ຄວາມ ດ້ວຍ PowerShell​?
$string = 'PowershellGuru '
$string = $string.TrimEnd()

ວິ​ທີ​ການ​ລຶບຊ່ອງວ່າງຈາກ​ຈຸດ (ເລີ່ມ​ຕົ້ນ ​ແລະ ​ສິ້ນ​ສຸດ​) ຂອງ​ຂໍ້ຄວາມ ​ດ້ວຍ PowerShell?
$string = ' PowershellGuru '
$string = $string.Trim()

ວິ​ທີ​ການ​ແປງ​ຂໍ້ຄວາມໃຫ້ເປັນຕົວອັກສອນໃຫຍ່ ດ້ວຍ PowerShell​?
$string = 'powershellguru'
$string = $string.ToUpper()

ວິ​ທີ​ການ​ແປງ​ຂໍ້ຄວາມໃຫ້ເປັນຕົວອັກສອນນ້ອຍ PowerShell?
$string = 'POWERSHELLGURU'
$string = $string.ToLower()

ວິ​ທີ​ການ​ເລືອກຂໍ້ຄວາມຍ່ອຍ “PowerShell​” ຈາກຂໍ້ຄວາມ “PowerShellGuru​” ດ້ວຍ PowerShell?
$string.Substring(0,10)

ວິ​ທີ​ການ​ຄັດ​ເລືອກ​ເອົາຂໍ້ຄວາມຍ່ອຍ “Guru​” ຈາກຂໍ້ຄວາມ “PowerShellGuru​” ດ້ວຍ PowerShell?
$string.Substring(10)

ວິ​ທີ​ການ​ຄັດ​ເລືອກ​ເອົາ​ຕົວເລກ “123​” ຈາກຂໍ້ຄວາມ “PowerShell123Guru​” ດ້ວຍ PowerShell​?
$string = 'Powershell123Guru'
[regex]::match($string,'(\d+)').value

ວິ​ທີ​ການ​ຮັບ​ຄ່າ​ດັດ​ຊະ​ນີທີ່​ສູນ ຂອງຄຳວ່າ “Guru​” ຈາກຂໍ້ຄວາມ “PowerShellGuru​” ດ້ວຍ PowerShell​?
$string.IndexOf('Guru') # 10

ວິ​ທີ​ການ​ກວດສອບ​ເບິ່ງ​​ວ່າ​ຂໍ້ຄວາມເປັນຄ່າເປົ່າຫວ່າງ ຫຼື​ ບໍ່ ​ດ້ວຍ PowerShell​?
$string = $null
$string = ''
[string]::IsNullOrEmpty($string)

ວິ​ທີ​ການ​​ກວດ​ສອບເບິ່ງ​​ວ່າ​ຂໍ້ຄວາມເປັນຄ່າເປົ່າຫວ່າງ​, ຫລື ​ມີພຽງ​ແຕ່​ຊ່ອງວ່າງເທົ່ານັ້ນ ຫຼືບໍ່ ດ້ວຍ PowerShell​?
$string = $null
$string = ''
$string = ' '
[string]::IsNullOrWhiteSpace($string)

ວິ​ທີ​ການກວດ​​ສອບເບິ່ງ​ວ່າ​ຂໍ້ຄວາມ​ປະ​ກອບ​ດ້ວຍ​ຕົວ​ອັກ​ສອນພິເສດ ຫຼືບໍ່ ​ດ້ວຍ PowerShell​?
$string = 'PowershellGuru'
$string.Contains('s')
[regex]::match($string,'s').Success

ວິ​ທີ​ການ​ເອີ້ນຄືນ​ຄວາມ​ຍາວ​ຂອງ​ຂໍ້ຄວາມດ້ວຍ PowerShell​?
$string.Length

ວິ​ທີ​ການເຊື່ອມຕໍ່ສອງ​ຂໍ້ຄວາມເຂົ້າດ້ວຍກັນ ​ດ້ວຍ PowerShell​?

ວິທີ​ການຈັບຄູ່​ຫນຶ່ງ​ຫຼື​ຫຼາຍ​ວົງ​ຂໍ “[ ]​” ໃນຂໍ້ຄວາມ ​ດ້ວຍ PowerShell?
$string = '[PowershellGuru]'
$string -match '\[' # Only 1
$string -match '\[(.*)\]' # Several

ວິທີ​ການຈັບຄູ່​ຫນຶ່ງ​ຫຼື​ຫຼາຍວົງ​ເລັບ “( )​” ​​ໃນຂໍ້ຄວາມ ​ດ້ວຍ PowerShell​?
$string = '(PowershellGuru)'
$string -match '\(' # Only 1
$string -match '\((.*)\)' # Several

ວິທີ​ການຈັບຄູ່​ຫນຶ່ງ​ຫຼື​ຫຼາຍ​ວົງ​​ປີກກາ​ “{ }​” ໃນ​ຂໍ້ຄວາມ ​ດ້ວຍ PowerShell?
$string = '{PowershellGuru}'
$string -match '\{' # Only 1
$string -match '\{(.*)\}' # Several

ວິທີ​ການຈັບຄູ່​ຫນຶ່ງ​ຫຼື​ຫຼາຍ​ວົງ​ເລັບ​ມຸມ “< >​” ໃນ​ຂໍ້ຄວາມ ດ້ວຍ PowerShell​?
$string = ''
$string -match '\<' # Only 1
$string -match "\<(.*)\>" # Several

ວິທີການຈັບຄູ່​ຕົວ​ອັກ​ສອນ​ນ້ອຍ (abc​) ໃນຂໍ້ຄວາມ ​ດ້ວຍ PowerShell?
$string = 'POWERSHELLGURU'
$string -cmatch "^[a-z]*$" #False

ວິທີການຈັບຄູ່ຕົວອັກສອນໃຫຍ່ (ABC​) ໃນ​ຂໍ້ຄວາມ ​ດ້ວຍ PowerShell​?
$string = 'powershellguru'
$string -cmatch "^[A-Z]*$" #False

ວິທີການຈັບຄູ່ຄໍາ​ວ່າ “[p​” (ຕົວອັກສອນນ້ອຍ) ໃນ​ຂໍ້ຄວາມ ດ້ວຍ PowerShell​?
$string = '[powershellGuru]'
$string -cmatch '\[[a-z]\w+' #True

ວິທີການຈັບຄູ່ຄໍາ​ວ່າ “[P​” (ຕົວອັກສອນໃຫຍ່) ໃນຂໍ້ຄວາມ ​ດ້ວຍ PowerShell?
$string = '[PowershellGuru]'
$string -cmatch '\[[A-Z]\w+' #True

ວິ​ທີ​ການ​ທົດ​ແທນ​ແຖວໃດໜຶ່ງດ້ວຍແຖວ​ອື່ນ​ ດ້ວຍ PowerShell?
$a = 'Line A'
$b = 'Line B'
$a = $a -replace $a, $b

ວິ​ທີ​ການ​ແປງ​ການ​ດໍາ​ເນີນ​ການຫານໄປເປັນຂໍ້ຄວາມ (ສ່ວນ​ຮ້ອຍ​) ດ້ວຍ PowerShell​?
(1/2).ToString('P')

ວິ​ທີ​ການ​ຈັດລຽງຂໍ້ຄວາມ​ທີ່​ບັນ​ຈຸ​ຕົວເລກ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ຄັດ​ເລືອກ​ເອົາ​ຄໍາ​ສຸດ​ທ້າຍ​ຂອງ​ປະ​ໂຫຍກ​ດ້ວຍ PowerShell​?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ')[-1] # Returns Powershell

ວິ​ທີ​ການສະແດງ​ຄໍາ​ທີ່​ໃຫຍ່​ທີ່​ສຸດ​ຂອງ​ປະ​ໂຫຍກ​ດ້ວຍ PowerShell​?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ') | Sort-Object -Property Length | Select-Object -Last 1 # Returns Powershell

ວິ​ທີ​ການ​ນັບ​ຈໍາ​ນວນ​ຄັ້ງຂອງຂໍ້ຄວາມ​ທີ່ສະແດງ​ໃນ​ປະ​ໂຫຍກ ​ດ້ວຍ PowerShell​?
$sentence = 'test test test Powershell'
[regex]::Matches($sentence, 'test').Count # Returns 3

ວິ​ທີ​ການ​ສໍາ​ເນົາ​ເອົາຕົວອັກສອນແຕ່ລະຕົວໃນຂໍ້ຄວາມໄປຍັງແຖວຂໍ້ຄວາມ ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ແປງ​ຕົວອັກສອນທໍາ​ອິດ​ໃຫ້ເປັນຕົວ​ພິມ​ໃຫຍ່​ຂອງຂໍ້ຄວາມ ດ້ວຍ PowerShell?

ວິ​ທີ​ການຍັບ (ຊ້າຍ​ ຫຼື​ ຂວາ​) ຂອງຂໍ້ຄວາມ ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ເຂົ້າ​ລະ​ຫັດ ​ແລະ​ ຖອດ​ລະ​ຫັດ​ຂອງຂໍ້ຄວາມເປັນ Base64 ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ແປງ​ຕົວ​ເລກ (ໄປ​ເປັນ ​ແລະ​ ຈາກ​) ໄບນາຣີ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ເອີ້ນ​ຄືນ​ພຽງ​ແຕ່​ໂຟ​ລ໌ເດີສຸດທ້າຍໃນ​ເສັ້ນ​ທາງ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ເອີ້ນ​ຄືນ​ພຽງ​ແຕ່​ລາຍ​ການ​ສຸດທ້າຍທີ່​ຢູ່​ໃນ​ເສັ້ນ​ທາງ​ ດ້ວຍ PowerShell​?

Up


Math

ວິ​ທີ​ການສະແດງລາຍການຂອງຄຳສັ່ງ ຂອງຄລາສ System.Math ດ້ວຍ PowerShell​?
[System.Math] | Get-Member -Static -MemberType Method

ວິ​ທີ​ການຄືນ​ຄ່າ​​ແທ້ແນ່ນອນ ​ດ້ວຍ PowerShell​?
[Math]::Abs(-12) #Returns 12
[Math]::Abs(-12.5) # Returns 12.5

ວິ​ທີ​ການຄືນ​ຄ່າ​​ມຸມຊິນ​ຂອງຕົວເລກ​ທີ່​ລະ​ບຸ​ໄວ້​ ດ້ວຍ PowerShell?
[Math]::ASin(1) #Returns 1,5707963267949

ວິ​ທີ​ການຄືນ​ຄ່າ​​ເພ​ດານ​ດ້ວຍ PowerShell​?
[Math]::Ceiling(1.4) #Returns 2
[Math]::Ceiling(1.9) #Returns 2

ວິ​ທີ​ການຄືນ​ຄ່າ​​ພື້ນ​ດ້ວຍ PowerShell​?
[Math]::Floor(1.4) #Returns 1
[Math]::Floor(1.9) #Returns 1

ວິ​ທີ​ການຄືນ​ຄ່າ​​​ຂອງໂລ​ກາຣິທຶ໋ມ​ປົກກະຕິ ​(ຖານ e) ຂອງ​ຈໍາ​ນວນ​ທີ່​ກໍາ​ນົດ​ໄວ້​ດ້ວຍ PowerShell​?
[Math]::Log(4) #Returns 1,38629436111989

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​​ຖານ 10 ໂລກາ​ຣິທຶ໋ມຂອງ​ຈໍາ​ນວນ​ທີ່​ກໍາ​ນົດ​ໄວ້​ດ້ວຍ PowerShell​?
[Math]::Log10(4) #Returns 0,602059991327962

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​ສູງ​ສຸດ​ຂອງ​ສອງຄ່າ​ດ້ວຍ PowerShell​?
[Math]::Max(2,4) #Returns 4
[Math]::Max(-2,-4) #Returns -2

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​ຕ່ຳ​ສຸດຂອງ​ສອງ​ຄ່າ​ດ້ວຍ PowerShell​?
[Math]::Min(2,4) #Returns 2
[Math]::Max(-2,-4) #Returns -4

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​ຕົວເລກຍົກກຳລັງທີ່​ລະ​ບຸ​ໄວ້​ດ້ວຍ PowerShell​?
[Math]::Pow(2,4) #Returns 16

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​ທົດສະນິ​ຍົມໄປເປັນຄ່າຕົວເລກປົກກະຕິ​ທີ່​ໃກ້​ຄຽງທີ່​ສຸດ​ດ້ວຍ PowerShell​?
[Math]::Round(3.111,2) #Returns 3,11
[Math]::Round(3.999,2) #Returns 4

ວິ​ທີ​ການຄືນ​ຄ່າ​ຕົວເລກປົກກະຕິຂອງຄ່າທົດສະນິຍົມທີ່​ກໍາ​ນົດ​ໄວ້​ດ້ວຍ PowerShell​?
[Math]::Truncate(3.111) #Returns 3
[Math]::Truncate(3.999) #Returns 3

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​​ຮາກຂັ້ນ​ສອງ​ຂອງ​ຈໍາ​ນວນ​ທີ່​ກໍາ​ນົດ​ໄວ້​ດ້ວຍ PowerShell​?
[Math]::Sqrt(16) #Returns 4

ວິ​ທີ​ການ​ຄືນ​ຄ່າ​​ຄົງທີ່ PI ດ້ວຍ PowerShell​?
[Math]::Pi #Returns 3,14159265358979

ວິ​ທີ​ການຄືນ​ຄ່າ​​ຖານໂລກາຣິທຶ໋ມປົກກະຕິ (ຄ່າຄົງທີ່ e​) ດ້ວຍ PowerShell​?
[Math]::E #Returns 2,71828182845905

ວິ​ທີ​ການ​ກວດສອບ​ເບິ່ງ​ວ່າ​ເປັນຈໍາ​ນວນຄູ່ ​ຫລື​ ຄີກ ​ດ້ວຍ PowerShell​?
[bool]($number%2)

Up


Hashtables

ວິ​ທີ​ການ​ສ້າງ HashTable ວ່າງເປົ່າ ​ດ້ວຍ PowerShell​?
$hashtable = @{}
$hashtable = New-Object -TypeName System.Collections.Hashtable

ວິ​ທີ​ການ​ສ້າງ HashTable ທີ່ມີ​ລາຍ​ການ ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ສ້າງ HashTable ໂດຍຈັດລຽງ​ຕາມ​ ຄີ / ຊື່ (ວັດຈະ​ນາ​ນຸ​ກົມ​ຄໍາ​ສັ່ງ​) ທີ່​ມີ​ລາຍ​ການ​ດ້ວຍ PowerShell​?

ວິ​ທີ​ການ​ເພີ່ມ​ລາຍ​ການ (key-value pair) ໃສ່ HashTable ດ້ວຍ PowerShell?
$hashtable.Add('Key4', 'Value4')

ວິ​ທີ​ການ​ຮັບ​ຄ່າ​ສະ​ເພາະ​ໃດ​ຫນຶ່ງ​ຂອງ HashTable ດ້ວຍ PowerShell?

ວິ​ທີ​ການຮັບຄ່າ​ຕ່ຳສຸດ​ຂອງ HashTable ດ້ວຍ PowerShell​?

ວິ​ທີ​ການຮັບຄ່າ​ສູງ​ສຸດ​ຂອງ HashTable ດ້ວຍ PowerShell?

ວິ​ທີ​ການ​ປັບ​ປຸງ​ແກ້​ໄຂ​ລາຍ​ການ​ໃນ HashTable ດ້ວຍ PowerShell​?
$hashtable.Set_Item('Key1', 'Value1Updated')

ວິ​ທີ​ການລຶບ​ລາ​​ຍ​ການ​ໃນ HashTable ດ້ວຍ PowerShell​?
$hashtable.Remove('Key1')

ວິ​ທີ​ການ​ອະ​ນາ​ໄມ HashTable ດ້ວຍ PowerShell​?
$hashtable.Clear()

ວິ​ທີ​ການ​ກວດ​ສອບ​ສະຖານະ​ຂອງ​ ຄີ / ຄ່າ ​ສະ​ເພາະໃນ HashTable ດ້ວຍ PowerShell​?
$hashtable.ContainsKey('Key3')
$hashtable.ContainsValue('Value3')

ວິ​ທີ​ການຈັດລຽງຕາມ ຄີ / ຄ່າ​ ໃນ HashTable ດ້ວຍ PowerShell?
$hashtable.GetEnumerator() | Sort-Object -Property Name
$hashtable.GetEnumerator() | Sort-Object -Property Value -Descending

Up


Arrays

ວິ​ທີ​ການ​ສ້າງ​ອາເຣວ່າງ​ເປົ່າ​ດ້ວຍ PowerShell​?
$array = @()
$array = [System.Collections.ArrayList]@()

ວິ​ທີ​ການ​ສ້າງ​ອາເຣທີ່ປະກອບດ້ວຍ​ລາຍ​ການ​ດ້ວຍ PowerShell?
$array = @('A', 'B', 'C')
$array = 'A', 'B', 'C'