សួរ និងឆ្លើយដោយសេរីក្នុង POWERSHELL ជាភាសាខ្មែរ

By | May 24, 2015

translated-cambodia


គំនិត: សំណួរដែលសួរញឹកញាប់បំផុតអំពី PowerShell ។

អ្នកអាចប្រើបញ្ជីក្នុងវិធីផ្សេងគ្នានេះ:

  • ចម្លង/បិទភ្ជាប់ពាក្យបញ្ជាមួយទៅក្នុងស្គ្រីប
  • ដើម្បីមើលវាក្យសម្ព័ន្ធនៃពាក្យបញ្ជាជាក់លាក់មួយយ៉ាងលឿន
  • ដើម្បីបង្កើននូវចំនេះដឹងបច្ចេកទេសរបស់អ្នក
  • ដើម្បីរកឱ្យឃើញពាក្យបញ្ជាថ្មី
  • ដើម្បីរៀបចំសម្ភាសន៍ការងារមួយ

ធ្វើឱ្យទាន់សម័យ
ខែកក្កដា 02, 2015
អ្នកនិពន្ធ powershell-guru.com
ប្រភព khmer.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
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
Windows10
Windows 2012
Windows Azure
Windows Forms
WMI
XML

System

តើធ្វើដូចម្តេចដើម្បីកំណត់កំណែនៃ PowerShell របស់ខ្ញុំ?

តើធ្វើដូចម្តេចដើម្បីដំណើការ PowerShell នៅក្នុងកំណែផ្សេងមួយទៀតសម្រាប់ការត្រឡប់ទៅវិញនៃភាពឆបគ្នា?
powershell.exe -Version 2.0

តើធ្វើដូចម្តេចដើម្បីទាមទារឱ្យ PowerShell មានកំណែតិចតួចបំផុត (3.0 និងខ្ពស់ជាងនេះ) ក្នុងស្គ្រីបជាមួយ PowerShell?
#Requires -Version 3.0

តើធ្វើដូចម្តេចដើម្បីទាមទារឱ្យមានសិទ្ធិជាអ្នកគ្រប់គ្រងសម្រាប់ស្គ្រីបជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលប៉ារ៉ាម៉ែត្រនៃស្គ្រីបជាមួយ PowerShell?
help -Name .\Get-ExchangeEnvironmentReport.ps1 -Full

តើធ្វើដូចម្តេចដើម្បីទទួលបានពត៌មានសម្រាប់អ្នកប្រើបច្ចុប្បន្នជាមួយ PowerShell?
[Security.Principal.WindowsIdentity]::GetCurrent()

តើធ្វើដូចម្តេចដើម្បីបង្កើត កែសម្រួល និងផ្ទុកទម្រង់ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីធ្វើការផ្អាក 5 វិនាទី/នាទីនៅក្នុងស្គ្រីបជាមួយ PowerShell?
Start-Sleep -Seconds 5
Start-Sleep -Seconds 300 # 5 minutes

តើធ្វើដូចម្តេចដើម្បីទទួលបានពេលវេលាចាប់ផ្ដើមមុនជាមួយ PowerShell?
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime

តើធ្វើដូចម្តេចដើម្បីទទួលបានប្រភេទឧបករណ៍បង្កើនល្បឿនជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីរាយកម្មវិធីចាប់ផ្ដើមជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីដំឡើងកម្មវិធីជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីយករូបថតអេក្រង់នៃផ្ទៃតុទាំងមូលឬមួយជាបង្អួចសកម្មជាមួយ PowerShell?
Take-ScreenShot -Screen -File 'C:\scripts\screenshot.png' -Imagetype JPEG
Repository : Take-ScreenShot

តើធ្វើដូចម្តេចដើម្បីទទួលបានការរាប់សារសម្រាប់ជួរ MSMQ ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីកំណត់គោលការណ៍ប្រតិបត្តិការជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីបង្កើតផ្លូវកាត់ជាមួយ PowerShell?

របៀបបង្ខំឬ unpin កម្មវិធីដើម្បីរបារភារកិច្ចជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីរាយ cmdlets ទាំងអស់ “Get- *” ជាមួយ PowerShell?
Get-Command -Verb Get

តើធ្វើដូចម្តេចដើម្បីរាយថតដែលមានប្រព័ន្ធពិសេសជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីដាក់ឯកសារ ISO/VHD ជាមួយ PowerShell?
Mount-DiskImage 'D:\ISO\file.iso' # ISO
Mount-DiskImage 'D:\VHD\file.vhd' # VHD

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលកំណែក្របខណ្ឌដែលបានដំឡើងជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលថាតើកំណែដែលក្របខណ្ឌ 4.5 ត្រូវបានដំឡើងជាមួយ PowerShell?
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -EA 0).Version -like '4.5*'

តើធ្វើដូចម្តេចដើម្បីចាប់ផ្តើមនិងបញ្ឈប់ប្រតិចារិកមួយ (ដើម្បីបង្កើតកំណត់ត្រានៃការ 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

តើធ្វើដូចម្តេចដើម្បីផ្ទុកការដំឡើងជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលការដំឡើងនាពេលបច្ចុប្បន្នបានផ្ទុកជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកផ្លូវ GAC (កន្លែងទុកការដំឡើងសាកល) ជាមួយ PowerShell?

Clipboard

តើធ្វើដូចម្តេចដើម្បីចម្លងលទ្ធផលនានាទៅកាន់ក្ដារតម្បៀតខ្ទាស់ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបាននូវមាតិកានៃក្ដារតម្បៀតខ្ទាស់ជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលប្រសិនបើ hotfix មួយដែលត្រូវបានដំឡើងដោយ PowerShell?
Get-HotFix -Id KB2965142

តើធ្វើដូចម្តេចដើម្បីទទួលបានការដំឡើង hotfixes នៅលើកុំព្យូទ័រពីចម្ងាយជាមួយ PowerShell?
Get-HotFix -ComputerName $computer

Pagefile

តើធ្វើដូចម្តេចដើម្បីទទួលបានព័ត៌មានចំលាស់ជាមួយ PowerShell?
Get-WmiObject -Class Win32_PageFileusage | Select-Object -Property Name, CurrentUsage, AllocatedBaseSize, PeakUsage, InstallDate

តើធ្វើដូចម្តេចដើម្បីទទួលបានទំហំដែលបានផ្ដល់អនុសាសន៍ (MB) សម្រាប់ចំលាស់ការជាមួយ PowerShell នេះ?
[Math]::Truncate(((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5

តើធ្វើដូចម្តេចដើម្បីបង្កើតចំលាស់ (4096 មេកាបៃ) មួយនៅលើ ដ្រាយ (D 🙂 ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីលុបចំលាស់មួយនៅលើ ដ្រាយ (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?
'Line1', 'Line2', 'Line3' | Out-File -FilePath 'C:\scripts\file.txt'
'Line1', 'Line2', 'Line3' | Add-Content -Path file.txt

តើធ្វើដូចម្តេចដើម្បីទទួលបានឈ្មោះពេញរបស់ឯកសារបច្ចុប្បន្នជាមួយស្គ្រីប PowerShell?
$MyInvocation.MyCommand.Path

តើធ្វើដូចម្តេចដើម្បីបង្ហាប់/ឯកសារដែលបានបង្ហាប់ជាមួយនឹងការ PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::CreateFromDirectory($folder,$fileZIP)

តើធ្វើដូចម្តេចដើម្បីពន្លាឯកសារ/ពន្លាការជាមួយ PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::ExtractToDirectory($fileZIP, $folder)

តើធ្វើដូចម្តេចដើម្បីមើលឃើញឯកសារក្នុងប័ណ្ណសារ ZIP មួយជាមួយ PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::OpenRead($fileZIP)

តើធ្វើដូចម្តេចដើម្បីបង្ហាញទំហំឯកសារមួយនៅក្នុងគីឡូបៃការជាមួយ PowerShell?
(Get-ChildItem -Path .\winsrv.dll).Length /1KB
(Get-ChildItem -Path .\winsrv.dll).Length /1MB
(Get-ChildItem -Path .\winsrv.dll).Length /1GB

តើធ្វើដូចម្តេចដើម្បីស្វែងរកឯកសារដែលមានទំហំធំឬតិចជាង 1 ជីកាបៃជាមួយ 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?

តើធ្វើដូចម្តេចដើម្បីទទួលបានសញ្ញានៃឯកសារជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរ “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'

តើធ្វើដូចម្តេចដើម្បីកែឈ្មោះទំហំ/ចំនួនច្រើនដែលមានឯកសារច្រើនជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីស្វែងរកម៉ាស៊ីនបម្រើកាតាឡុកពិភពលោកក្នុងថតសកម្មជាមួយ PowerShell?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs

តើធ្វើដូចម្តេចដើម្បីរកកន្លែងក្នុងថតសកម្មជាមួយ PowerShell?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites

តើធ្វើដូចម្តេចដើម្បីស្វែងរកការឧបករណ៍បញ្ជាដែនបច្ចុប្បន្នជាមួយ PowerShell?
(Get-ADDomainController).HostName

តើធ្វើដូចម្តេចដើម្បីស្វែងរកឧបករណ៍បញ្ជាដែនទាំងអស់នៅក្នុងដែនជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកការថតចម្លង AD មិនបានសម្រេចជាមួយ PowerShell?
Get-ADReplicationFailure dc02.domain.com # Windows 8 and 2012

តើធ្វើដូចម្តេចដើម្បីស្វែងរកថ្មដាក់មុខផ្នូរដែលមានអាយុកាលបានយូ សម្រាប់ព្រៃឈើដែលនៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានពត៌មានលម្អិតនៃព្រៃ/ដែននៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានផ្លូវនៃ “វត្ថុដែលបានលុប” ធុងក្នុងថតសកម្មជាមួយ PowerShell?
(Get-ADDomain).DeletedObjectsContainer

តើធ្វើដូចម្តេចដើម្បីបើកលក្ខណៈពិសេសនៃធុងសម្រាម AD ក្នុងការថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្ដារឡើងវិញនូវគណនី AD ពីធុងសំរាមនៅក្នុងថតសកម្មជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីបង្កើតក្រុមថ្មីនៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីយកចេញជាក្រុមមួយនៅក្នុងថតសកម្មជាមួយ PowerShell?
Remove-ADGroup -Identity 'PowershellGuru'

តើធ្វើដូចម្តេចដើម្បីបន្ថែមអ្នកប្រើទៅក្រុមមួយនៅក្នុងថតសកម្មជាមួយ PowerShell?
Add-ADGroupMember "Powershell Guru" -Members powershellguru

តើធ្វើដូចម្តេចដើម្បីយកអ្នកប្រើចេញពីក្រុមមួយនៅក្នុងថតសកម្មជាមួយ PowerShell?
Remove-ADGroupMember 'Powershell Guru' -Members powershellguru

តើធ្វើដូចម្តេចដើម្បីស្វែងរកក្រុមទទេ (គ្មានសមាជិក) នៅក្នុងថតសកម្មជាមួយ PowerShell?
Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}

តើធ្វើដូចម្តេចដើម្បីរាប់ក្រុមទទេ (គ្មានសមាជិក) នៅក្នុងថតសកម្មជាមួយ PowerShell?
(Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}).Count

តើធ្វើដូចម្តេចដើម្បីទទួលបានសមាជិករបស់ក្រុមមួយនៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានសមាជិកនៃក្រុមមួយនេះជាមួយសមាជិកដែលហៅខ្លួនឯងក្នុងការថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីរាប់ចំនួននៃសមាជិករបស់ក្រុមមួយដែលមាន/ដោយគ្មានសមាជិកក្រុមហៅខ្លួនឯងក្នុងថតសកម្មជាមួយ PowerShell?

Users

តើធ្វើដូចម្តេចដើម្បីប្រើតួអក្សរជំនួសក្នុងតម្រងរបស់ “ទទួលបាន-ADUser” នៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរអ្នកប្រើ OU ផ្សេងទៀតនៅក្នុងថតសកម្មជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីប្តូរឈ្មោះ (ឈ្មោះពេញ), (DisplayName), GivenName (FirstName) និងគោត្តនាម (LastName) សម្រាប់គណនីអ្នកប្រើនៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរទិសដៅ ការិយាល័យនិងលេខទូរស័ព្ទសម្រាប់គណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?
Set-ADUser $samAccountName -Description 'IT Consultant' -Office 'Building B' -OfficePhone '12345'

តើធ្វើដូចម្តេចដើម្បីកំណត់កាលបរិច្ឆេទផុតកំណត់ទៅជា “31/12/2015” ឬ “មិន” សម្រាប់គណនីអ្នកប្រើនៅក្នុងថតសកម្មជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីដោះសោគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?
Unlock-ADAccount $samAccountName

តើធ្វើដូចម្តេចដើម្បីបើក/បិទគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីយកគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?
Remove-ADUser $samAccountName

តើធ្វើដូចម្តេចដើម្បីកំណត់ពាក្យសម្ងាត់សម្រាប់គណនីអ្នកប្រើម្នាក់មួយនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីកំណត់ពាក្យសម្ងាត់សម្រាប់គណនីច្រើនអ្នកប្រើ (ភាគច្រើន) នៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកម្ចាស់ឯកសារនៅក្នុងថតសកម្មដោយមាន PowerShell ?

តើធ្វើដូចម្តេចដើម្បីស្វែងរក OU (អង្គភាពស្ថាប័ន) សម្រាប់អ្នកប្រើមួយនៅក្នុងថតសកម្មដោយមាន PowerShell?
[regex]::match("$((Get-ADUser $user -Properties DistinguishedName).DistinguishedName)",'(?=OU=)(.*\n?)').value

តើធ្វើដូចម្តេចដើម្បីស្វែងរកគណនីអ្នកប្រើជនពិការនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកគណនីអ្នកប្រើបានផុតកំណត់នៅក្នុងថតសកម្មដោយមាន PowerShell?
Search-ADAccount -AccountExpired

តើធ្វើដូចម្តេចដើម្បីស្វែងរកគណនីអ្នកប្រើចាក់សោក្នុងថតសកម្មដោយមាន PowerShell?
Search-ADAccount -LockedOut

តើធ្វើដូចម្តេចដើម្បីស្វែងរក SID នៃគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?
(Get-ADUser $user -Properties SID).SID.Value

តើធ្វើដូចម្តេចដើម្បីបម្លែងឈ្មោះអ្នកប្រើដើម្បី SID ក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីបម្លែង SID មួយដើម្បីប្រើឈ្មោះអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីបំបែកឈ្មោះកិត្តិយសនៃគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកកាលបរិច្ឆេទនៃការបង្កើត/កែប្រែគណនីអ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?
Get-ADUser -Identity $user -Properties whenChanged, whenCreated | Format-List -Property whenChanged, whenCreated

តើធ្វើដូចម្តេចដើម្បីបង្ហាញលក្ខណៈសម្បត្តិស្រេចចិត្តនិងជាចាំបាច់សម្រាប់ថ្នាក់ “អ្នកប្រើប្រាស់” នៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានផ្លូវបម្រើ LDAP សម្រាប់អ្នកប្រើមួយនៅក្នុងការថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរ CN (ដោយ Canonical ឈ្មោះ) សម្រាប់អ្នកប្រើមួយនៅក្នុងថតសកម្មដោយមាន PowerShell?
Rename-ADObject $((Get-ADUser $user -Properties DistinguishedName).DistinguishedName) -NewName 'Test Powershell'

តើធ្វើដូចម្តេចដើម្បីទទួលបានអង្គភាពស្ថាប័ននេះ (OU ) ឪពុកម្តាយរបស់អ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានជាម្ចាស់អ្នកប្រើ (ដែលបានបង្កើតគណនី) នៅក្នុងថតសកម្មដោយមាន PowerShell នេះ?

តើធ្វើដូចម្តេចដើម្បីបម្លែងគុណលក្ខណៈ PwdLastSet សម្រាប់អ្នកប្រើនៅក្នុងថតសកម្មដោយមាន PowerShell?

Computers

តើធ្វើដូចម្តេចដើម្បីសាកល្បងឆានែលដែលមានសុវត្ថិភាពរវាងកុំព្យូទ័រមូលដ្ឋាននិងដែនជាមួយ PowerShell ?
Test-ComputerSecureChannel

តើធ្វើដូចម្តេចដើម្បីជួសជុលបណ្តាញដែលមានសុវត្ថិភាពរវាងកុំព្យូទ័រមូលដ្ឋាននិងដែនជាមួយ PowerShell ?
Test-ComputerSecureChannel -Repair

តើធ្វើដូចម្តេចដើម្បីបិទកុំព្យូទ័រនៅក្នុងគណនីថតសកម្មដោយមាន PowerShell?
Disable-ADAccount $computer

តើធ្វើដូចម្តេចដើម្បីស្វែងរកកុំព្យូទ័រជាមួយប្រព័ន្ធប្រតិបត្តិការជាក់លាក់នៅក្នុងថតសកម្មដោយមាន PowerShell?

Organizational Unit (OU)

តើធ្វើដូចម្តេចដើម្បីបង្កើតអង្គភាពស្ថាប័ន (OU) នៅក្នុងថតសកម្មដោយមាន PowerShell?
New-ADOrganizationalUnit -Name 'TEST' -Path 'DC=domain,DC=com'

តើធ្វើដូចម្តេចដើម្បីទទួលបានអង្គភាពស្ថាប័ន (OU) សេចក្ដីលម្អិតនៅក្នុងថតសកម្មដោយមាន PowerShell?
Get-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Properties *

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរការពិពណ៌នាមួយនៃអង្គភាពស្ថាប័ន (OU) ក្នុងថតសកម្មដោយមាន PowerShell?
Set-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Description 'My description'

តើធ្វើដូចម្តេចដើម្បីបើក/បិទមួយដែលអង្គភាពស្ថាប័ន (OU) ពីការលុបដោយចៃដន្យនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីបើកការលុបដោយចៃដន្យសម្រាប់អង្គភាពស្ថាប័នទាំងអស់ (OU) នៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីលុបអង្គភាពស្ថាប័ន (OU) ការពារពីការលុបដោយចៃដន្យនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីបម្លែងទៅជាមួយឈ្មោះកិត្តិយសនៃអង្គភាពស្ថាប័ន (OU) ដើម្បី Canonical ឈ្មោះនៅក្នុងថតសកម្មដោយមាន PowerShell?

តើធ្វើដូចម្តេចដើម្បីរាយអង្គភាពស្ថាប័នទទេ (OUs) ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីទទួលបានការគ្រប់គ្រងនៃក្រុមមួយ PowerShell?
(Get-ADGroup $dn -Properties Managedby).Managedby

Up


Regex (Regular Expression)

តើធ្វើដូចម្តេចដើម្បីទាញយកជាមួយ V4 អាសយដ្ឋាន IP (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

តើធ្វើដូចម្តេចដើម្បីទាញយក (www.powershell-guru.com) URL ដោយ 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

តើធ្វើដូចម្តេចដើម្បីទាញយក “គ្រូ” ខ្សែអក្សរដែលបានពីគំរូដោយមាន PowerShell ជាមួយ regex?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?=.com)').value

តើធ្វើដូចម្តេចដើម្បីទាញយក “guru.com” ខ្សែអក្សរដែលបានពីគំរូដោយមាន PowerShell ជាមួយ regex?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?<=.)').value

តើធ្វើដូចម្តេចដើម្បីទាញយក “powershell-guru.com” ខ្សែអក្សរដែលបានពីគំរូដោយមាន PowerShell ជាមួយ regex?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=www.)(.*\n?)').value

តើធ្វើដូចម្តេចដើម្បីទាញយក “123” ខ្សែអក្សរដែលបានពីគំរូដោយមាន PowerShell ជាមួយ regex?
$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()

តើធ្វើដូចម្តេចដើម្បីទទួលបានទំហំសតិរបស់កុំព្យូទ័រដោយមាន PowerShell?

Up


Date

តើធ្វើដូចម្តេចដើម្បីទទួលបានកាលបរិច្ឆេទបច្ចុប្បន្នដោយ PowerShell?
Get-Date
[Datetime]::Now

តើធ្វើដូចម្តេចដើម្បីបង្ហាញកាលបរិច្ឆេទក្នុងទ្រង់ទ្រាយខុសគ្នាជាមួយ PowerShell ?

តើធ្វើដូចម្តេចដើម្បីបម្លែងកាលបរិច្ឆេទ (Datetime) មួយដើម្បីកាលបរិច្ឆេទ (ខ្សែអក្សរ) ជាមួយ PowerShell?
$datetimeToString = '{0:dd/MM/yy}' -f (Get-Date 30/01/2015)
$datetimeToString = (Get-Date 31/01/2015).ToShortDateString()

តើធ្វើដូចម្តេចដើម្បីបម្លែងកាលបរិច្ឆេទ (ខ្សែអក្សរ) ទៅជាកាលបរិច្ឆេទ (Datetime) ជាមួយ PowerShell?
$stringToDatetime = [Datetime]::ParseExact('30/01/2015', 'dd/MM/yyyy', $null)

តើធ្វើដូចម្តេចដើម្បីគណនាភាពខុសគ្នា (ចំនួនថ្ងៃម៉ោងនាទីឬវិនាទី) រវាងកាលបរិច្ឆេទពីរជាមួយ 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]}

តើធ្វើដូចម្តេចដើម្បីចាប់ផ្តើមជាមួយការបញ្ឈប់ stopwatch 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

តើធ្វើដូចម្តេចដើម្បីបិទម៉ាស៊ីន V6 អាសយដ្ឋាន IP (IPv6) ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីឱ្យមានសុពលភាពជាមួយ V4 អាសយដ្ឋាន IP (IPv4) ជាមួយ PowerShell?
if([ipaddress]'10.0.0.1'){'validated'}

តើធ្វើដូចម្តេចដើម្បីស្វែងរកអាសយដ្ឋាន IP ខាងក្រៅជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកឈ្មោះម៉ាស៊ីនពីអាសយដ្ឋាន IP មួយជាមួយ PowerShell នេះ?
([System.Net.Dns]::GetHostEntry($IP)).Hostname

តើធ្វើដូចម្តេចដើម្បីស្វែងរកអាសយដ្ឋាន IP ដែលបានមកពីឈ្មោះម៉ាស៊ីនដោយប្រើ PowerShell?
([System.Net.Dns]::GetHostAddresses($computer)).IPAddressToString

របៀបស្វែងរកបានពីឈ្មោះម៉ាស៊ីន FQDN ដោយមាន PowerShell?
[System.Net.Dns]::GetHostByName($computer).HostName

តើធ្វើដូចម្តេចដើម្បីស្វែងរកការកំណត់រចនាសម្ព័ន្ធបណ្តាញ (IP បណ្ដាញរង, ផ្លូវចេញចូល, និងឈ្មោះ DNS) ជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីស្វែងរកអាសយដ្ឋាន MAC ជាមួយ PowerShell?
Get-CimInstance win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress
Get-WmiObject -Class win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress

តើធ្វើដូចម្តេចដើម្បី កុំព្យូទ័រឮសូរតឺងជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលប្រសិនបើកុំព្យូទ័រមួយដែលត្រូវបានតភ្ជាប់ទៅអ៊ីនធឺណិតជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីធ្វើការរកមើល”whois” សម្រាប់វែបសាយជាមួយ PowerShell?
$whois = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$whois.GetWhoIs('powershell-guru.com')

តើធ្វើដូចម្តេចដើម្បីទទួលបានពត៌មានលំអិតនៃ IP របស់សាធារណៈ (ទីតាំងភូមិសាស្ដ្រ) ជាមួយ 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"

តើធ្វើដូចម្តេចដើម្បីទទួលបានការកំណត់ប្រូកស៊ីដោយមាន 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()

តើធ្វើដូចម្តេចដើម្បីស្វែងរកកាលបរិច្ឆេទផុតកំណត់ពាក្យសម្ងាត់នៃគណនីក្នុងថតសកម្មដោយមាន 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?

តើធ្វើដូចម្តេចដើម្បីរាយ subkeys គន្លឹះបញ្ជីឈ្មោះជាមួយ PowerShell?

តើធ្វើដូចម្តេចដើម្បីរាយ subkeys គន្លឹះបញ្ជីឈ្មោះនៅក្នុងវិធីដែលហៅខ្លួនឯងជាមួយ PowerShell?
Get-ChildItem -Path 'HKLM:\SYSTEM' -Recurse -ErrorAction SilentlyContinue

តើធ្វើដូចម្តេចដើម្បីស្វែងរក subkeys ដែលមានឈ្មោះជាក់លាក់មួយដោយ PowerShell?
Get-ChildItem -Path 'HKLM:\SOFTWARE' -Include *Plugin* -Recurse -ErrorAction SilentlyContinue

តើធ្វើដូចម្តេចដើម្បីត្រឡប់តែឈ្មោះរបស់ subkeys បញ្ជីឈ្មោះនេះជាមួយ 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

តើធ្វើដូចម្តេចដើម្បី concatenate ខ្សែអក្សរពីរជាមួយ 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

តើធ្វើដូចម្តេចដើម្បីផ្គូផ្គង upperletters ណាមួយ (ABC) នៅក្នុងខ្សែអក្សរជាមួយ PowerShell?
$string = 'powershellguru'
$string -cmatch "^[A-Z]*$" #False

តើធ្វើដូចម្តេចដើម្បីផ្គូផ្គង “ [P “(p ករណីទាបជាង) នៅក្នុងខ្សែអក្សរជាមួយ PowerShell?
$string = '[powershellGuru]'
$string -cmatch '\[[a-z]\w+' #True

តើធ្វើដូចម្តេចដើម្បីផ្គូផ្គង “ [P បាន “(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

តើធ្វើដូចម្តេចដើម្បីវិលត្រឡប់ថេរភីអាយមកវិញជាមួយ PowerShell?
[Math]::Pi #Returns 3,14159265358979

តើធ្វើដូចម្តេចដើម្បីត្រឡប់លោការីតធម្មជាតិមូលដ្ឋាន (អ៊ីថេរ) ជាមួយ 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?

តើធ្វើដូចម្តេចដើម្បីបន្ថែមធាតុ (គូតម្លៃគ្រាប់ចុច) ដើម្បី hashtable ជាមួយ PowerShell?
$hashtable.Add('Key3', 'Value3')

តើធ្វើដូចម្តេចដើម្បីទទួលបាននូវតម្លៃជាក់លាក់នៃ hashtable ជាមួយ PowerShell?
$hashtable.Key1
$hashtable.Get_Item('Key1')

តើធ្វើដូចម្តេចដើម្បីទទួលបានតម្លៃអប្បបរមារបស់ 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'
$array = 'a,b,c'.Split(',')
$array = .{$args} a b c
$array = echo a b c

តើធ្វើដូចម្តេចដើម្បីបន្ថែមធាតុទៅអារេមួយជាមួយ PowerShell?
$array += 'D'
[void]$array.Add('D')

តើធ្វើដូចម្តេចដើម្បីកែប្រែធាតុមួយក្នុងអារេមួយជាមួយ PowerShell?
$array[0] = 'Z' # 1st item[0]

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលទំហំនៃអារេមួយជាមួយ PowerShell?
$array = 'A', 'B', 'C'
$array.Length # Returns 3

តើធ្វើដូចម្តេចដើម្បីទាញយកធាតុមួយ/ច្រើន/ទាំងអស់នៅក្នុងអារេមួយជាមួយ PowerShell?
$array = @('A', 'B', 'C')
$array[0] # One item (A)
$array[0] + $array[2] # Several items (A,C)
$array # All items (A,B,C)

តើធ្វើដូចម្តេចដើម្បីយកធាតុទទេមួយក្នុងអារេជាមួយ PowerShell?
$array = @('A', 'B', 'C', '')
$array = $array.Split('',[System.StringSplitOptions]::RemoveEmptyEntries) | Sort-Object # A,B,C

តើធ្វើដូចម្តេចដើម្បីពិនិត្យមើលប្រសិនបើធាតុមួយមាននៅក្នុងអារេមួយជាមួយ PowerShell?
$array = @('A', 'B', 'C')
'A' | ForEach-Object -Process {$array.Contains($_)} # Returns True
'D' | ForEach-Object -Process {$array.Contains($_)} # Returns False

តើធ្វើដូចម្តេចដើម្បីរកចំនួនលិបិក្រមនៃធាតុមួយក្នុងអារេមួយជាមួយ PowerShell?
$array = @('A', 'B', 'C')
[array]::IndexOf($array,'A') # Returns 0

តើធ្វើដូចម្តេចដើម្បីផ្លាស់ប្តូរលំដាប់នៃធាតុនៅក្នុងអារេមួយជាមួយ PowerShell?
$array = @('A', 'B', 'C')
[array]::Reverse($array) # C,B,A

តើធ្វើដូចម្តេចដើម្បីបង្កើតធាតុចៃដន្យពីអារេមួយជាមួយ PowerShell?
$array | Get-Random

តើធ្វើដូចម្តេចដើម្បីតម្រៀបអារេមួយនៅក្នុងការតម្រៀបឡើង/ចុះផ្លូវជាមួយ PowerShell?
$array = @('A', 'B', 'C')
$array | Sort-Object # A,B,C
$array | Sort-Object -Descending # C,B,A

តើធ្វើដូចម្តេចដើម្បីរាប់ចំនួនធាតុនៅក្នុងអារេមួយជាមួយ PowerShell?
$array.Count

តើធ្វើដូចម្តេចដើម្បីបន្ថែមអារេមួយទៅមួយផ្សេងទៀតជាមួយ PowerShell?
$array1 = 'A', 'B', 'C'
$array2 = 'D', 'E', 'F'
$array3 = $array1 + $array2 # A,B,C,D,E,F

តើធ្វើដូចម្តេចដើម្បីស្វែងរកភាពស្ទួនគ្នាពីអារេមួយជាមួយ PowerShell?
$array = 'A', 'B', 'C', 'C'
($array | Group-Object | Where-Object -FilterScript {$_.Count -gt 1}).Values # Returns C

តើធ្វើដូចម្តេចដើម្បីយកចេញស្ទួនពីអារេមួយជាមួយ PowerShell?
$array = 'A', 'B', 'C', 'C'
$array = $array | Select-Object -Unique
$array # Returns A,B,C

តើធ្វើដូចម្តេចដើម្បីបង្កើតអារេមួយដែលបានចាប់ផ្តើមដោយមានធាតុជាបុព្វបទមួយ (“user01”, “user02” … “user10”) ជាមួយ PowerShell?
$array = 1..10 | ForEach-Object -Process { "user$_" }

Up


ACL

តើធ្វើដូចម្តេចដើម្បីរាយ ACL នៃ AD អ្នកប្រើជាមួយ PowerShell ?
(Get-Acl -Path "AD:\$dn").Access

តើធ្វើដូចម្តេចដើម្បីរាយ ACL នៃថតជាមួយ PowerShell?
(Get-Acl -Path C:\scripts).Access

តើធ្វើដូចម្តេចដើម្បីរាយធាតុដែលមានការអនុញ្ញាតលើ ACL ជាក់លាក់ (អ្នកប្រើឬក្រុម) នៃ AD អ្នកប្រើមួយជាមួយ PowerShell?