FAQ POECHÈL NAN KREYÒL AYISYEN

By | May 24, 2015

Konsèp: Kesyon sou poechèl mande ki pi souvan.

Ou kapab sèvi ak lis sa a nan diferan fason:

  • A kapab bay kopi / keratin kòmandman nan yon script
  • Pou wè byen vit sentaks la nan yon lòd espesifik
  • Pou amelyore konesans teknik ou
  • Yo dekouvri nouvo kòmandman
  • Pou prepare yon entèvyou travay

À
Jiyè 02 2015
Otè powershell-guru.com
Sous haitian-creole.powershell-guru.com
Kategori
75
Kesyon
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

Ki jan yo detèmine vèsyon m ‘lan nan poechèl?

Ki jan yo kouri poechèl nan yon lòt vèsyon pou bak konpatibilite?
powershell.exe -Version 2.0

Ki jan yo mande pou yon vèsyon poechèl minim (3.0 ak pi wo) nan yon script ak poechèl?
#Requires -Version 3.0

Ki jan yo mande pou privilèj administratif pou yon script ak poechèl?

Ki jan yo tcheke paramèt yo nan yon script ak poechèl?
help -Name .\Get-ExchangeEnvironmentReport.ps1 -Full

Kòman ou kapab jwenn enfòmasyon pou itilizatè a kounye a ak poechèl?
[Security.Principal.WindowsIdentity]::GetCurrent()

Ki jan yo kreye, edite, ak Reload yon pwofil ak poechèl?

Ki jan yo fè yon pran yon poz nan 5 segonn / minit nan yon script ak poechèl?
Start-Sleep -Seconds 5
Start-Sleep -Seconds 300 # 5 minutes

Kòman ou kapab jwenn tan an bòt pase a ak poechèl?
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime

Kòman ou kapab jwenn accélérateurs kalite ak poechèl?

Ki jan yo lis pwogram yo demaraj ak poechèl?

Ki jan yo unenstal yon aplikasyon ak poechèl?

Ki jan yo pran yon D nan Desktop la tout antye oswa nan yon fenèt aktif ak poechèl?
Take-ScreenShot -Screen -File 'C:\scripts\screenshot.png' -Imagetype JPEG
Repository : Take-ScreenShot

Kòman ou kapab jwenn konte a mesaj pou MSMQ ke moun kap kriye ak poechèl?

Kouman yo mete politik la ekzekisyon ak poechèl?

Ki jan yo kreye yon chemen kout ak poechèl?

Ki jan yo PIN oswa detache yon pwogram nan ekstrè an ak poechèl?

Ki jan yo louvri yon Explorer Windows ak poechèl?
[Diagnostics.Process]::Start('explorer.exe')
Invoke-Item -Path C:\Windows\explorer.exe

Ki jan yo lis chofè aparèy ak poechèl?
Get-WmiObject -Class Win32_PnPSignedDriver
Get-WindowsDriver -Online -All
driverquery.exe

Kouman yo kreye yon GUID ak poechèl?

Kòman ou kapab jwenn kote adrès la nan anyè a pou yon ti tan pou itilizatè a kounye a ak poechèl?
[System.IO.Path]::GetTempPath()

Ki jan yo rantre nan yon chemen ak yon chemen pitit nan yon sèl chemen sèl ak poechèl?
Join-Path -Path C:\ -ChildPath \windows

Ki jan yo lis tout kmdle “Get- *” ak poechèl?
Get-Command -Verb Get

Ki jan yo lis dosye sistèm espesyal ak poechèl?

Ki jan yo mòn ISO dosye / VHD ak poechèl?
Mount-DiskImage 'D:\ISO\file.iso' # ISO
Mount-DiskImage 'D:\VHD\file.vhd' # VHD

Ki jan yo tcheke vèsyon .NET chapant enstale ak poechèl?

Ki jan yo tcheke si se vèsyon an NET chapant 4.5 enstale ak poechèl?
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -EA 0).Version -like '4.5*'

Ki jan yo kòmanse epi yo sispann yon relve nòt (yo kreye yon dosye nan sesyon-an Windows poechèl) ak poechèl?
Start-Transcript -Path 'C:\scripts\transcript.txt
Stop-Transcript

Kouman chanje anyè aktyèl la nan yon kote espesifik ak poechèl?
Set-Location -Path 'C:\scripts'

Ki jan yo klè ekran an ak poechèl?
Clear-Host
cls # Alias

Kouman chanje rezolisyon an ekspozisyon ak poechèl?
Set-DisplayResolution -Width 1280 -Height 1024 -Force # Windows 2012

Kouman yo mete “ekran plen” fenèt la ak poechèl?
mode.com 300

Kòman ou kapab jwenn dimansyon (lajè ak wotè) nan yon foto ak poechèl?

Kòman ou kapab jwenn kle a pwodwi Windows ak poechèl?

Perfmon

Kòman ou kapab jwenn aktyèl “% Processor Tan an” (mwayèn) nan dènye 5 segonn yo (10 fwa) ak poechèl?
(Get-Counter '\Processor(_total)\% Processor Time' -SampleInterval 5 -MaxSamples 10).CounterSamples.CookedValue

Assemblies

Ki jan yo chaje asanble ak poechèl?

Ki jan yo tcheke asanble .NET aktyèl chaje ak poechèl?

Ki jan yo jwenn (Cache Global Asanble) chemen an GAC ak poechèl?

Clipboard

Ki jan yo kopi rezilta nan papye a ak poechèl?

Kòman ou kapab jwenn sa ki ekri nan papye a ak poechèl?
Add-Type -AssemblyName PresentationCore
[Windows.Clipboard]::GetText()

Hotfixes

Kòman ou kapab jwenn korektif yo enstale ak poechèl?
Get-HotFix -ComputerName $computer

Kòman ou kapab jwenn korektif yo enstale avan / aprè yon dat espesifik ak poechèl?
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

Ki jan yo tcheke si se yon korektif enstale ak poechèl?
Get-HotFix -Id KB2965142

Kòman ou kapab jwenn korektif yo enstale sou yon òdinatè aleka ak poechèl?
Get-HotFix -ComputerName $computer

Pagefile

Kòman ou kapab jwenn enfòmasyon pagefile ak poechèl?
Get-WmiObject -Class Win32_PageFileusage | Select-Object -Property Name, CurrentUsage, AllocatedBaseSize, PeakUsage, InstallDate

Kòman ou kapab jwenn gwosè a rekòmande (MB) pou pagefile la ak poechèl?
[Math]::Truncate(((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5

Kouman yo kreye yon pagefile (4096 MB) sou (D la 🙂 kondwi ak poechèl?

Ki jan yo efase yon pagefile sou (C a 🙂 kondwi ak poechèl?

Maintenance

Ki jan yo tcheke fwagmantasyon a nan yon kondwi ak poechèl?

Ki jan yo tcheke espas ki la ki gen kapasite nan kondui ak poechèl?

Up


Files

Ki jan yo louvri yon dosye ak poechèl?
Invoke-Item -Path 'C:\scripts\file.txt'
.'C:\scripts\file.txt'

Kouman li yon dosye ak poechèl?
Get-Content -Path 'C:\scripts\file.txt'
gc "C:\scripts\file.txt" # Alias

Ki jan yo ekri pwodiksyon nan yon dosye ak poechèl?
'Line1', 'Line2', 'Line3' | Out-File -FilePath 'C:\scripts\file.txt'
'Line1', 'Line2', 'Line3' | Add-Content -Path file.txt

Kòman ou kapab jwenn fullname an nan dosye a script aktyèl ak poechèl?
$MyInvocation.MyCommand.Path

Ki jan yo konpresyon / dosye postal ak poechèl?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::CreateFromDirectory($folder,$fileZIP)

Ki jan yo dekonprese / dosye ouvriers ak poechèl?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::ExtractToDirectory($fileZIP, $folder)

Ki jan yo wè dosye yo nan yon achiv postal ak poechèl?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::OpenRead($fileZIP)

Ki jan yo montre gwosè a nan yon dosye ki nan KB ak poechèl?
(Get-ChildItem -Path .\winsrv.dll).Length /1KB
(Get-ChildItem -Path .\winsrv.dll).Length /1MB
(Get-ChildItem -Path .\winsrv.dll).Length /1GB

Ki jan yo jwenn dosye pi gwo oswa mwens pase 1 GB ak poechèl?

Ki jan yo montre non an nan yon dosye san yo pa ekstansyon an ak poechèl?
[System.IO.Path]::GetFileNameWithoutExtension('C:\Windows\system32\calc.exe') # Return calc

Ki jan yo montre ekstansyon sa a nan yon dosye ak poechèl?
[System.IO.Path]::GetExtension('C:\scripts\file.txt') # Return .txt

Ki jan yo jwenn vèsyon an dosye nan yon dosye ak poechèl?

Kòman ou kapab jwenn regle la nan yon dosye ak poechèl?
(Get-FileHash $file).Hash

Kòman ou kapab jwenn nan Controls MD5 / SHA1 nan yon dosye ak poechèl?
Get-FileHash $file -Algorithm MD5
Get-FileHash $file -Algorithm SHA1

Ki jan yo montre dosye kache ak poechèl?

Ki jan yo tcheke si yon dosye gen yon ekstansyon ak poechèl?

Kouman yo mete yon dosye kòm “Read Se sèlman” ak poechèl?
Set-ItemProperty -Path .\file.txt -Name IsReadOnly -Value $true

Ki jan yo chanje “LastWriteTime” atribi nan semèn pase a pou yon dosye ak poechèl?
Set-ItemProperty -Path .\file.txt -Name LastWriteTime -Value ((Get-Date).AddDays(-7))
If not working, use Nirsoft tool: BulkFileChanger.

Ki jan yo kreye yon dosye nouvo ak poechèl?
New-Item -ItemType File -Path 'C:\scripts\file.txt' -Value 'FirstLine'

Ki jan yo chanje non yon dosye ak poechèl?
Rename-Item -Path 'C:\scripts\file.txt' -NewName 'C:\scripts\powershellguru2.txt'

Ki jan yo esansyèl / pakèt chanje non dosye miltip ak poechèl?
Get-ChildItem -Path C:\scripts\txt | Rename-Item -NewName { $_.Name -replace ' ', '_' }

Ki jan yo efase yon dosye ak poechèl?
Remove-Item -Path 'C:\scripts\file.txt'

Ki jan yo montre 10 dènye liy yo nan yon dosye ak poechèl?
Get-Content -Path 'C:\scripts\log.txt' -Tail 10

Ki jan yo dégager dosye plizyè nan yon katab ak poechèl?
Get-ChildItem -Path 'C:\scripts\Modules' | Unblock-File

Ki jan yo retire liy vid ki sòti nan yon dosye ak poechèl?
(Get-Content -Path file.txt) | Where-Object -FilterScript {$_.Trim() -ne '' } | Set-Content -Path file.txt

Ki jan yo tcheke si yon dosye ki egziste ak poechèl?

Kòman ou kapab jwenn dernye / pi ansyen dosye a ki te kreye nan yon katab ak poechèl?

Ki jan yo retire liy kopi ki sòti nan yon dosye ak poechèl?

Kòman ou kapab jwenn dosye kreye plis oswa mwens pase 1 mwa nan yon katab ak poechèl?

Kòman ou kapab jwenn dosye kreye plis oswa mwens pase 1 ane nan yon katab ak poechèl?

Ki jan yo ekspòtasyon valè a nan yon varyab nan yon dosye ak poechèl?
Set-Content -Path file.txt -Value $variable

Ki jan yo konte kantite dosye (* .txt) nan yon katab ak poechèl?

Ki jan yo rechèch yon fil andedan dosye miltip ak poechèl?
Select-String -Path 'C:\*.txt' -Pattern 'Test'

Ki jan yo montre premye / liy ki sot pase nan yon dosye ak poechèl?

Ki jan yo montre yon nimewo liy espesifik nan yon dosye ak poechèl?

Ki jan yo konte kantite liy nan yon dosye ak poechèl?

Ki jan yo konte kantite karaktè ak mo nan yon dosye ak poechèl?

Ki jan yo download yon dosye ak poechèl?
Invoke-WebRequest -Uri 'http://www.nirsoft.net/utils/searchmyfiles.zip' -OutFile 'C:\tools\searchmyfiles.zip'

Ki jan yo montre chemen an plen nan yon dosye ak poechèl?
Resolve-Path -Path .\script.ps1 # Return C:\Scripts\script.ps1

Copy

Ki jan yo kopi yon sèl dosye nan yon katab ak poechèl?
Copy-Item -Path 'C:\source\file.txt' -Destination 'C:\destination'

Ki jan yo kopi yon sèl dosye nan plizyè dosye ak poechèl?

Ki jan yo kopi dosye miltip nan yon sèl folder ak poechèl?
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

Ki jan yo jwenn serveurs Katalòg Global nan Anyè aktif ak poechèl?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs

Ki jan yo jwenn sit nan Anyè aktif ak poechèl?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites

Ki jan yo jwenn kontwolè nan domèn aktyèl ak poechèl?
(Get-ADDomainController).HostName

Ki jan yo jwenn tout contrôleur yo domèn nan yon domèn ak poechèl?

Ki jan yo jwenn echèk yo AD replikasyon ak poechèl?
Get-ADReplicationFailure dc02.domain.com # Windows 8 and 2012

Ki jan yo jwenn tout lavi a onm pou forè a nan Anyè aktif ak poechèl?

Kòman ou kapab jwenn detay nan forè / domèn nan nan Anyè aktif ak poechèl?

Kòman ou kapab jwenn chemen an nan “efase objè” veso a nan Anyè aktif ak poechèl?
(Get-ADDomain).DeletedObjectsContainer

Ki jan yo ki ap pèmèt AD Resikle Bin karakteristik nan nan Anyè aktif ak poechèl?

Ki jan retabli yon kont AD soti nan Bin a Resikle nan Anyè aktif ak poechèl?
Get-ADObject -Filter 'samaccountname -eq "powershellguru"' -IncludeDeletedObjects | Restore-ADObject

Ki jan yo jwenn wòl yo FSMO ak poechèl?

Ki jan pou konekte avèk yon kontwolè domèn espesifik ak poechèl?
Get-ADUser -Identity $user -Server 'serverDC01'

Kòman ou kapab jwenn sèvè a koneksyon aktyèl ak poechèl?

Ki jan yo fè “gpupdate” sou yon òdinatè ki gen poechèl?
Invoke-GPUpdate -Computer $computer -Force -RandomDelayInMinutes 0 # Windows 2012

Groups

Ki jan yo kreye yon gwoup nouvo nan Anyè aktif ak poechèl?

Ki jan yo retire yon gwoup nan Anyè aktif ak poechèl?
Remove-ADGroup -Identity 'PowershellGuru'

Ki jan yo ajoute yon itilizatè nan yon gwoup nan Anyè aktif ak poechèl?
Add-ADGroupMember "Powershell Guru" -Members powershellguru

Ki jan yo retire yon itilizatè soti nan yon gwoup nan Anyè aktif ak poechèl?
Remove-ADGroupMember 'Powershell Guru' -Members powershellguru

Ki jan yo jwenn gwoup vid (ki pa gen okenn manm) nan Anyè aktif ak poechèl?
Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}

Ki jan yo konte gwoup vid (ki pa gen okenn manm) nan Anyè aktif ak poechèl?
(Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}).Count

Kòman ou kapab jwenn manm yo nan yon gwoup nan Anyè aktif ak poechèl?

Kòman ou kapab jwenn manm yo nan yon gwoup ak manm repetitif nan Anyè aktif ak poechèl?

Ki jan yo konte kantite manm nan yon gwoup ki gen / san yo pa manm repetitif nan Anyè aktif ak poechèl?

Users

Kouman yo itilize yon generic an nan filtre a nan “Jwenn-ADUser” nan Anyè aktif ak poechèl?

Ki jan pou avanse pou pi yon itilizatè nan yon lòt OU nan Anyè aktif ak poechèl?
Move-ADObject -Identity $dn -TargetPath 'OU=myOU,DC=domain,DC=com'

Ki jan yo jwenn tout manm yo ki (enbrike) pou yon itilizatè ak poechèl?
Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($dn))"

Kòman ou kapab jwenn manm yo (kout Non / twonke) pou yon itilizatè ak poechèl?
(Get-ADUser $user -Properties MemberOf).MemberOf | ForEach-Object -Process {($_ -split ',')[0].Substring(3)} | Sort-Object

Ki jan yo chanje non Non a (FullName), (displayName), givenName (Prénoms), ak Siyati (Lastname) pou yon kont itilizatè nan Anyè aktif ak poechèl?

Kouman chanje Deskripsyon nan, biwo, ak nimewo telefòn pou yon kont itilizatè nan Anyè aktif ak poechèl?
Set-ADUser $samAccountName -Description 'IT Consultant' -Office 'Building B' -OfficePhone '12345'

Kouman yo mete dat ekspirasyon an nan “31/12/2015” oswa “Pa janm” pou yon kont itilizatè nan Anyè aktif ak poechèl?

Ki jan yo déblotché yon kont itilizatè nan Anyè aktif ak poechèl?
Unlock-ADAccount $samAccountName

Ki jan yo ki ap pèmèt / enfim yon kont itilizatè nan Anyè aktif ak poechèl?

Ki jan yo retire yon kont itilizatè nan Anyè aktif ak poechèl?
Remove-ADUser $samAccountName

Ki jan yo Reyajiste yon modpas pou kont yon sèl itilizatè nan Anyè aktif ak poechèl?

Ki jan yo Reyajiste yon modpas pou plizyè kont itilizatè (esansyèl) nan Anyè aktif ak poechèl?

Ki jan yo jwenn mèt kay la nan yon dosye nan Anyè aktif ak poechèl?

Ki jan yo jwenn OU la (Inite òganizasyon) pou yon itilizatè nan Anyè aktif ak poechèl?
[regex]::match("$((Get-ADUser $user -Properties DistinguishedName).DistinguishedName)",'(?=OU=)(.*\n?)').value

Ki jan yo jwenn kont itilizatè enfim nan Anyè aktif ak poechèl?

Ki jan yo jwenn kont itilizatè ekspire nan Anyè aktif ak poechèl?
Search-ADAccount -AccountExpired

Ki jan yo jwenn kont itilizatè fèmen nan Anyè aktif ak poechèl?
Search-ADAccount -LockedOut

Ki jan yo jwenn Sid la nan yon kont itilizatè nan Anyè aktif ak poechèl?
(Get-ADUser $user -Properties SID).SID.Value

Ki jan konvèti yon non itilizatè SID nan Anyè aktif ak poechèl?

Ki jan yo konvèti yon SID non itilizatè nan Anyè aktif ak poechèl?

Kouman fann Non a Distenge nan yon kont itilizatè nan Anyè aktif ak poechèl?

Ki jan yo jwenn dat la nan kreyasyon / modifikasyon nan yon kont itilizatè nan Anyè aktif ak poechèl?
Get-ADUser -Identity $user -Properties whenChanged, whenCreated | Format-List -Property whenChanged, whenCreated

Ki jan yo montre pwopriyete yo si ou vle ak obligatwa pou klas “itilizatè a” nan Anyè aktif ak poechèl?

Kòman ou kapab jwenn chemen an ldap pou yon itilizatè nan Anyè aktif ak poechèl?

Kouman chanje CN a (kanonik Non) pou yon itilizatè nan Anyè aktif ak poechèl?
Rename-ADObject $((Get-ADUser $user -Properties DistinguishedName).DistinguishedName) -NewName 'Test Powershell'

Kòman ou kapab jwenn Inite nan òganizasyon (OU) paran nan yon itilizatè nan Anyè aktif ak poechèl?

Kòman ou kapab jwenn mèt kay la nan yon itilizatè (ki te kreye kont la) nan Anyè aktif ak poechèl?

Kouman konvèti atribi nan PwdLastSet pou yon itilizatè nan Anyè aktif ak poechèl?

Computers

Ki jan yo teste kanal la sekirite ant òdinatè lokal la ak domèn nan ak poechèl?
Test-ComputerSecureChannel

Ki jan pou fè reparasyon pou kanal la sekirite ant òdinatè lokal la ak domèn nan ak poechèl?
Test-ComputerSecureChannel -Repair

Ki jan yo enfim yon kont òdinatè nan Anyè aktif ak poechèl?
Disable-ADAccount $computer

Ki jan yo jwenn òdinatè ak Sistèm espesifik Operating nan Anyè aktif ak poechèl?

Organizational Unit (OU)

Kouman yo kreye yon Inite òganizasyon (OU) nan Anyè aktif ak poechèl?
New-ADOrganizationalUnit -Name 'TEST' -Path 'DC=domain,DC=com'

Kòman ou kapab jwenn Inite òganizasyon (OU) detay nan Anyè aktif ak poechèl?
Get-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Properties *

Kouman chanje deskripsyon an nan yon inite w la òganizasyon (OU) nan Anyè aktif ak poechèl?
Set-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Description 'My description'

Ki jan yo ki ap pèmèt / enfim yon Inite òganizasyon (OU) soti nan sipresyon aksidan nan Anyè aktif ak poechèl?

Ki jan yo ki ap pèmèt sipresyon an aksidan pou tout Inite nan òganizasyon (OU) nan Anyè aktif ak poechèl?

Ki jan yo efase yon Inite òganizasyon (OU) pwoteje soti nan aksidan sipresyon nan Anyè aktif ak poechèl?

Ki jan konvèti yon Non Distenge nan yon Inite òganizasyon (OU) kanonik Non nan Anyè aktif ak poechèl?

Ki jan yo lis vid Inite òganizasyon (OUMENM) ak poechèl?

Kòman ou kapab jwenn manadjè a nan yon gwoup ki gen poechèl?
(Get-ADGroup $dn -Properties Managedby).Managedby

Up


Regex (Regular Expression)

Kòman yo ekstrè yon v4 adrès IP (80.80.228.8) ak Rjèks ak poechèl?
$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

Kòman yo ekstrè yon adrès MAC (C0-D9-62-39-61-2D) ak séparation “-” ak Rjèks ak poechèl?
$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

Kòman yo ekstrè yon adrès MAC (C0: D9: 62: 39: 61: 2D) ak séparation “:” ak Rjèks ak poechèl?
$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

Kòman yo ekstrè yon dat (10/02/2015) ak Rjèks ak poechèl?
$example = 'The date is 10/02/2015'
$date = [regex]::match($example,'(\d{2}\/\d{2}\/\d{4})').value

Kòman yo ekstrè yon URL (www.powershell-guru.com) ak Rjèks ak poechèl?
$example = 'The URL is www.powershell-guru.com'
$url = [regex]::match($example,'[a-z]+[:.].*?(?=\s)').value

Kòman yo ekstrè yon imèl (user@domain.com) ak Rjèks ak poechèl?
$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

Kòman yo ekstrè “Guru” nan egzanp lan fisèl ak Rjèks ak poechèl?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?=.com)').value

Kòman yo ekstrè “guru.com” nan egzanp lan fisèl ak Rjèks ak poechèl?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?<=.)').value

Kòman yo ekstrè “powershell-guru.com” nan egzanp lan fisèl ak Rjèks ak poechèl?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=www.)(.*\n?)').value

Kòman yo ekstrè “123” nan egzanp lan fisèl ak Rjèks ak poechèl?
$example = 'Powershell123'
[regex]::match($example,'(\d+)').value

Kòman yo ekstrè “$” (siy dola) soti nan egzanp lan fisèl ak Rjèks ak poechèl?
$example = 'Powershell`$123'
[regex]::match($example,'(\$)').value

Ki jan yo ranplase yon karaktè (* .com) ak yon lòt (* .fr) nan yon fisèl ak Rjèks ak poechèl?
$example = 'www.powershell-guru.com'
[regex]::Replace($example, '.com','.fr')

Ki jan yo sove yon afè ak Rjèks ak poechèl?
[regex]::Escape('\\server\share')

Up


Memory

Ki jan yo fòse yon koleksyon memwa pa pèseptè a fatra ak poechèl?
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()

Kòman ou kapab jwenn gwosè a RAM nan yon òdinatè ki gen poechèl?

Up


Date

Kòman ou kapab jwenn dat aktyèl la ak poechèl?
Get-Date
[Datetime]::Now

Ki jan yo montre dat la nan fòma diferan ak poechèl?

Ki jan konvèti yon dat (datetime) nan yon dat (fisèl) ak poechèl?
$datetimeToString = '{0:dd/MM/yy}' -f (Get-Date 30/01/2015)
$datetimeToString = (Get-Date 31/01/2015).ToShortDateString()

Ki jan konvèti yon dat (fisèl) nan yon dat (datetime) ak poechèl?
$stringToDatetime = [Datetime]::ParseExact('30/01/2015', 'dd/MM/yyyy', $null)

Kouman kalkile diferans lan (kantite jou, èdtan, minit, oswa segonn) ant de dat ak poechèl?
(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

Ki jan yo konpare de dat ak poechèl?
(Get-Date 2015-01-01) -lt (Get-Date 2015-01-30) # True
(Get-Date 2015-01-01) -gt (Get-Date 2015-01-30) # False

Ki jan yo sòt yon etalaj de dat kòm “datetime” ak poechèl?
$arrayDate | Sort-Object -Property {$_ -as [Datetime]}

Ki jan yo kòmanse epi yo sispann yon kronomètr ak poechèl?
$chrono = [Diagnostics.Stopwatch]::StartNew()
$chrono.Stop()
$chrono

Kòman ou kapab jwenn jou aktyèl la nan semèn nan ak poechèl?
(Get-Date).DayOfWeek #Sunday

Kòman ou kapab jwenn dat yè a ak poechèl?
(Get-Date).AddDays(-1)

Kòman ou kapab jwenn kantite jou nan yon mwa (nan mwa fevriye 2015) ak poechèl?
[DateTime]::DaysInMonth(2015, 2)

Ki jan yo konnen yon ane kwasans ak poechèl?
[DateTime]::IsLeapYear(2015)

Ki jan yo lis zòn tan ak poechèl?
[System.TimeZoneInfo]::GetSystemTimeZones()

Up


Networking

Ki jan yo programme (nan fòma ASCII) ak dekode yon URL ak poechèl?

Ki sa ki ekivalan yo nan kòmandman rezo natif natal ak poechèl?

Kòman ou kapab jwenn adrès IP ak poechèl?
Get-NetIPAddress # Windows 8.1 & Windows 2012
Get-NetIPConfiguration # Windows 8.1 & Windows 2012

Ki jan yo enfim adrès IP V6 (IPV6) ak poechèl?

Ki jan yo valide yon adrès IP v4 (IPv4) ak poechèl?
if([ipaddress]'10.0.0.1'){'validated'}

Ki jan yo jwenn adrès IP nan ekstèn ak poechèl?

Ki jan yo jwenn ot la soti nan yon adrès IP ak poechèl?
([System.Net.Dns]::GetHostEntry($IP)).Hostname

Ki jan yo jwenn adrès la IP ki sòti nan yon ot ak poechèl?
([System.Net.Dns]::GetHostAddresses($computer)).IPAddressToString

Ki jan yo jwenn FQDN a soti nan yon ot ak poechèl?
[System.Net.Dns]::GetHostByName($computer).HostName

Ki jan yo jwenn configuration la, te rezo (Ip, subne, Gateway, ak dns) ak poechèl?

Ki jan yo jwenn adrès la MAC ak poechèl?
Get-CimInstance win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress
Get-WmiObject -Class win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress

Ki jan yo ping yon konpitè ki gen poechèl?

Ki jan yo tcheke si se yon òdinatè ki konekte nan entènèt la ak poechèl?

Ki jan yo fè yon “wwa” Passage pou yon sit entènèt ak poechèl?
$whois = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$whois.GetWhoIs('powershell-guru.com')

Kòman ou kapab jwenn detay yo de yon IP piblik (Geolocation) ak poechèl?

Ki jan yo tcheke si yon pò a louvri / fèmen ak poechèl?
New-Object -TypeName Net.Sockets.TcpClient -ArgumentList $computer, 135

Ki jan yo fè “trasèr” ak poechèl?
Test-NetConnection www.google.com -TraceRoute

Ki jan yo ranje yon rezo lakay pwofil koneksyon avèk poechèl?
Get-NetAdapter | Format-Table -Property Name, InterfaceDescription, ifIndex -AutoSize # Windows 8.1
Set-NetConnectionProfile -InterfaceIndex 6 -NetworkCategory Private

Ki jan yo montre koneksyon ki pò tchp ak poechèl?
netstat.exe -ano
Get-NetTCPConnection #Windows 8 and 2012

Ki jan yo diminye yon URL long nan yon URL ti ak poechèl?
$url = 'www.powershell-guru.com'
$tiny = Invoke-RestMethod -Uri "http://tinyurl.com/api-create.php?url=$url"

Kòman ou kapab jwenn anviwònman prokurasyon ak poechèl?
Get-ItemProperty -Path HKCU:"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

DNS

Ki jan yo tcheke kachèt a dns sou yon òdinatè lokal yo ak poechèl?
ipconfig.exe /displaydns
Get-DnsClientCache #Windows 8 and 2012

Ki jan yo klè yon kachèt dns sou yon òdinatè lokal yo ak poechèl?
ipconfig.exe /flushdns
Start-Process -FilePath ipconfig -ArgumentList /flushdns -WindowStyle Hidden
Clear-DnsClientCache #Windows 8 and 2012

Ki jan yo klè yon kachèt dns sou òdinatè aleka ak poechèl?
Invoke-Command -ScriptBlock {Clear-DnsClientCache} -ComputerName computer01, computer02

Kouman li gen tout pouvwa a yo ranpli ak poechèl?
Get-Content -Path 'C:\Windows\system32\drivers\etc\hosts'

Up


Password

Ki jan yo jenere yon modpas o aza ak poechèl?
[Reflection.Assembly]::LoadWithPartialName('System.Web')
[System.Web.Security.Membership]::GeneratePassword(30,2)

Ki jan yo chanje modpas la lokal yo, pou yon administratè sou yon sèvè aleka ak poechèl?
$admin = [ADSI]('WinNT://server01/administrator,user')
$admin.SetPassword($password)
$admin.SetInfo()

Ki jan yo jwenn dat ekspirasyon an modpas nan yon kont nan Anyè aktif ak poechèl?

Up


Printers

Ki jan yo lis tout enprimant yo pou yon sèvè espesifik ak poechèl?
Get-WmiObject -Query 'Select * From Win32_Printer' -ComputerName $computer

Ki jan yo lis tout pò yo pou yon sèvè espesifik ak poechèl?
Get-WmiObject -Class Win32_TCPIPPrinterPort -Namespace 'root\CIMV2' -ComputerName $computer

Kouman chanje kòmantè / kote adrès la nan yon printer ak poechèl?

Ki jan fè detwi (anile tout travay) nan yon printer ak poechèl?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.CancelAllJobs()

Ki jan yo enprime yon paj tès pou yon printer ak poechèl?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.PrintTestPage()

Kòman ou kapab jwenn ke moun kap kriye ekri an lèt detache pou enprimant ak poechèl?

Up


Regedit

Read

Ki jan yo lis itikè rejis ak poechèl?
Get-ChildItem -Path Registry::

Kòman ou kapab jwenn valè rejis ak kalite valè ak poechèl?

Ki jan yo lis rejis kle subkeys ak poechèl?

Ki jan yo lis subkeys kle rejis nan yon fason repetitif ak poechèl?
Get-ChildItem -Path 'HKLM:\SYSTEM' -Recurse -ErrorAction SilentlyContinue

Ki jan yo jwenn subkeys ak yon non espesifik ak poechèl?
Get-ChildItem -Path 'HKLM:\SOFTWARE' -Include *Plugin* -Recurse -ErrorAction SilentlyContinue

Ki jan yo retounen sèlman non an nan subkeys yo rejis ak poechèl?
(Get-ChildItem -Path 'HKLM:\SYSTEM').Name # Return HKEY_LOCAL_MACHINE\SYSTEM\ControlSet
Get-ChildItem -Path 'HKLM:\SYSTEM' -Name # Return ControlSet

Ki jan yo lis valè rejis ak poechèl?
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

Kouman li yon valè rejis espesifik ak poechèl?
(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ProductName

Kouman li yon valè rejis espesifik sou yon òdinatè aleka ak poechèl?

Write

Ki jan yo kreye yon nouvo kle rejis ak poechèl?
New-Item -Path 'HKCU:\Software\MyApplication'

Ki jan yo kreye yon valè rejis ak poechèl?
New-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '1.0'

Ki jan li modifye yon valè rejis ki ekziste yo ak poechèl?
Set-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '2.0'

Delete

Ki jan yo efase yon valè rejis ak poechèl?
Remove-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version'

Ki jan yo efase yon kle rejis ak poechèl?
Remove-Item -Path 'HKCU:\Software\MyApplication' -Force

Test

Ki jan yo teste si yon kle rejis egziste ak poechèl?
Test-Path -Path 'HKCU:\Software\MyApplication'

Ki jan yo teste si se yon valè rejis egziste ak poechèl?
(Get-Item -Path 'HKCU:\Software\MyApplication').GetValueNames() -contains 'Version'

Up


Strings

Ki jan yo retire karaktè blan-espas soti nan konmansman an nan yon fisèl ak poechèl?
$string = ' PowershellGuru'
$string = $string.TrimStart()

Ki jan yo retire karaktè blan-espas soti nan fen a nan yon fisèl ak poechèl?
$string = 'PowershellGuru '
$string = $string.TrimEnd()

Ki jan yo retire karaktè blan-espas (kòmanse epi ki fini) nan yon fisèl ak poechèl?
$string = ' PowershellGuru '
$string = $string.Trim()

Ki jan konvèti yon fisèl nan dosye anwo yo tou ak poechèl?
$string = 'powershellguru'
$string = $string.ToUpper()

Ki jan konvèti yon fisèl pi ba ka ak poechèl?
$string = 'POWERSHELLGURU'
$string = $string.ToLower()

Ki jan yo ka chwazi chèn “poechèl nan” nan fisèl la “PowerShellGuru” ak poechèl?
$string.Substring(0,10)

Ki jan yo ka chwazi chèn nan “Guru” nan fisèl la “PowerShellGuru” ak poechèl?
$string.Substring(10)

Ki jan yo chwazi nimewo ki “123” nan “PowerShell123Guru” ak poechèl?
$string = 'Powershell123Guru'
[regex]::match($string,'(\d+)').value

Kòman ou kapab jwenn endèks a zewo ki baze sou nan “Guru” nan fisèl “PowerShellGuru la” ak poechèl?
$string.IndexOf('Guru') # 10

Ki jan yo tcheke si yon fisèl se nil oswa vid yo avèk poechèl?
$string = $null
$string = ''
[string]::IsNullOrEmpty($string)

Ki jan yo tcheke si yon fisèl se nil, vid, oswa konsiste sèlman nan karaktè blan-espas ak poechèl?
$string = $null
$string = ''
$string = ' '
[string]::IsNullOrWhiteSpace($string)

Ki jan yo tcheke si yon fisèl gen yon lèt espesifik ak poechèl?
$string = 'PowershellGuru'
$string.Contains('s')
[regex]::match($string,'s').Success

Ki jan yo retounen longè yon fisèl ak poechèl?
$string.Length

Ki jan yo anchene de strings ak poechèl?

Ki jan yo matche ak pou youn oswa plizyè parantèz “[]” nan yon fisèl ak poechèl?
$string = '[PowershellGuru]'
$string -match '\[' # Only 1
$string -match '\[(.*)\]' # Several

Ki jan yo matche ak pou youn oswa plizyè parantèz “()” nan yon fisèl ak poechèl?
$string = '(PowershellGuru)'
$string -match '\(' # Only 1
$string -match '\((.*)\)' # Several

Ki jan yo matche ak pou youn oswa plizyè parantèz Curly “{}” nan yon fisèl ak poechèl?
$string = '{PowershellGuru}'
$string -match '\{' # Only 1
$string -match '\{(.*)\}' # Several

Ki jan yo matche ak pou youn oswa plizyè parantèz ang “<>” nan yon fisèl ak poechèl?
$string = ''
$string -match '\<' # Only 1
$string -match "\<(.*)\>" # Several

Ki jan yo matche ak nenpòt lèt miniskil (abc) nan yon fisèl ak poechèl?
$string = 'POWERSHELLGURU'
$string -cmatch "^[a-z]*$" #False

Ki jan yo matche ak nenpòt upperletters (ABC) nan yon fisèl ak poechèl?
$string = 'powershellguru'
$string -cmatch "^[A-Z]*$" #False

Ki jan yo matche ak “[p” (p pi ba a) nan yon fisèl ak poechèl?
$string = '[powershellGuru]'
$string -cmatch '\[[a-z]\w+' #True

Ki jan yo matche ak “[P” (P anwo a) nan yon fisèl ak poechèl?
$string = '[PowershellGuru]'
$string -cmatch '\[[A-Z]\w+' #True

Ki jan yo ranplase yon liy ak yon lòt liy ak poechèl?
$a = 'Line A'
$b = 'Line B'
$a = $a -replace $a, $b

Ki jan konvèti yon operasyon divizyon nan yon fisèl (pousantaj) ak poechèl?
(1/2).ToString('P')

Ki jan yo sòt strings ki gen nimewo ak poechèl?

Ki jan yo chwazi dènye mo a nan yon fraz ak poechèl?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ')[-1] # Returns Powershell

Ki jan yo ka resevwa pawòl Bondye a pi gwo nan yon fraz ak poechèl?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ') | Sort-Object -Property Length | Select-Object -Last 1 # Returns Powershell

Ki jan yo konte kantite fwa yon fisèl ki prezan nan yon fraz ak poechèl?
$sentence = 'test test test Powershell'
[regex]::Matches($sentence, 'test').Count # Returns 3

Ki jan yo kopi chak karaktè nan yon fisèl nan yon etalaj karaktè ak poechèl?

Kouman konvèti premye lèt nan majuskul nan yon fisèl ak poechèl?

Ki jan yo pad (gòch la oswa dwa) yon afè ak poechèl?

Ki jan yo programme ak dekode yon fisèl Base64 ak poechèl?

Ki jan yo konvèti yon nimewo (pou ale ak pou soti nan) binè ak poechèl?

Ki jan yo retounen sèlman folder nan paran sot pase a nan yon chemen ak poechèl?

Ki jan yo retounen sèlman dènye atik la nan yon chemen ak poechèl?

Up


Math

Ki jan yo lis metòd yo nan klas la System.Math ak poechèl?
[System.Math] | Get-Member -Static -MemberType Method

Ki jan yo retounen valè a absoli ak poechèl?
[Math]::Abs(-12) #Returns 12
[Math]::Abs(-12.5) # Returns 12.5

Ki jan yo retounen ang lan ki gen san se nimewo a espesifye ak poechèl?
[Math]::ASin(1) #Returns 1,5707963267949

Ki jan yo retounen valè a plafon ak poechèl?
[Math]::Ceiling(1.4) #Returns 2
[Math]::Ceiling(1.9) #Returns 2

Ki jan yo retounen valè a etaj ak poechèl?
[Math]::Floor(1.4) #Returns 1
[Math]::Floor(1.9) #Returns 1

Ki jan yo retounen natirèl (baz e) logaritm a nan yon nimewo ki espesifye ak poechèl?
[Math]::Log(4) #Returns 1,38629436111989

Ki jan yo retounen logaritm a baz 10 nan yon nimewo ki espesifye ak poechèl?
[Math]::Log10(4) #Returns 0,602059991327962

Ki jan yo retounen maksimòm la nan de valè ak poechèl?
[Math]::Max(2,4) #Returns 4
[Math]::Max(-2,-4) #Returns -2

Ki jan yo retounen minimòm la nan de valè ak poechèl?
[Math]::Min(2,4) #Returns 2
[Math]::Max(-2,-4) #Returns -4

Ki jan yo retounen yon nimewo leve soti vivan nan yon pouvwa espesifye ak poechèl?
[Math]::Pow(2,4) #Returns 16

Ki jan yo retounen yon valè desimal ki pi pre valè a entegral ak poechèl?
[Math]::Round(3.111,2) #Returns 3,11
[Math]::Round(3.999,2) #Returns 4

Ki jan yo retounen yon pati nan entegral nan yon nimewo desimal espesifye ak poechèl?
[Math]::Truncate(3.111) #Returns 3
[Math]::Truncate(3.999) #Returns 3

Ki jan yo retounen rasin kare yon nimewo ki espesifye ak poechèl?
[Math]::Sqrt(16) #Returns 4

Ki jan yo retounen konstan nan PI ak poechèl?
[Math]::Pi #Returns 3,14159265358979

Ki jan yo retounen baz natirèl la logaritmik (konstan e) ak poechèl?
[Math]::E #Returns 2,71828182845905

Ki jan yo tcheke si yon nonb se menm oswa enpè ak poechèl?
[bool]($number%2)

Up


Hashtables

Kouman yo kreye yon hashtable vid yo avèk poechèl?
$hashtable = @{}
$hashtable = New-Object -TypeName System.Collections.Hashtable

Kouman yo kreye yon hashtable ak atik ak poechèl?

Kouman yo kreye yon hashtable Ranje pa kle / Non (diksyonè te bay lòd) ak atik ak poechèl?

Ki jan yo ajoute atik (kle-valè pè) nan yon hashtable ak poechèl?
$hashtable.Add('Key3', 'Value3')

Kòman ou kapab jwenn yon valè espesifik nan yon hashtable ak poechèl?
$hashtable.Key1
$hashtable.Get_Item('Key1')

Kòman ou kapab jwenn valè a minimòm de yon hashtable ak poechèl?

Kòman ou kapab jwenn valè a maksimòm de yon hashtable ak poechèl?

Ki jan li modifye atik ki nan yon hashtable ak poechèl?
$hashtable.Set_Item('Key1', 'Value1Updated')

Ki jan yo retire atik ki nan yon hashtable ak poechèl?
$hashtable.Remove('Key1')

Ki jan yo klè yon hashtable ak poechèl?
$hashtable.Clear()

Ki jan yo tcheke prezans nan yon kle / valè espesifik nan yon hashtable ak poechèl?
$hashtable.ContainsKey('Key3')
$hashtable.ContainsValue('Value3')

Ki jan yo sòt pa kle / valè nan yon hashtable ak poechèl?
$hashtable.GetEnumerator() | Sort-Object -Property Name
$hashtable.GetEnumerator() | Sort-Object -Property Value -Descending

Up


Arrays

Ki jan yo kreye yon etalaj vid yo avèk poechèl?
$array = @()
$array = [System.Collections.ArrayList]@()

Ki jan yo kreye yon etalaj ak atik ak poechèl?
$array = @('A', 'B', 'C')
$array = 'A', 'B', 'C'
$array = 'a,b,c'.Split(',')
$array = .{$args} a b c
$array = echo a b c

Ki jan yo ajoute atik yo yon etalaj ak poechèl?
$array += 'D'
[void]$array.Add('D')

Ki jan li modifye yon atik nan yon etalaj ak poechèl?
$array[0] = 'Z' # 1st item[0]

Ki jan yo tcheke gwosè a nan yon etalaj ak poechèl?
$array = 'A', 'B', 'C'
$array.Length # Returns 3

Ki jan yo rekipere yon atik / plizyè / tout bagay nan yon etalaj ak poechèl?
$array = @('A', 'B', 'C')
$array[0] # One item (A)
$array[0] + $array[2] # Several items (A,C)
$array # All items (A,B,C)

Ki jan yo retire atik vid nan yon etalaj ak poechèl?
$array = @('A', 'B', 'C', '')
$array = $array.Split('',[System.StringSplitOptions]::RemoveEmptyEntries) | Sort-Object # A,B,C

Ki jan yo tcheke si yon atik ki egziste nan yon etalaj ak poechèl?
$array = @('A', 'B', 'C')
'A' | ForEach-Object -Process {$array.Contains($_)} # Returns True
'D' | ForEach-Object -Process {$array.Contains($_)} # Returns False

Ki jan yo jwenn nimewo a endèks nan yon atik nan yon etalaj ak poechèl?
$array = @('A', 'B', 'C')
[array]::IndexOf($array,'A') # Returns 0

Ki jan yo ranvèse lòd la nan atik nan yon etalaj ak poechèl?
$array = @('A', 'B', 'C')
[array]::Reverse($array) # C,B,A

Ki jan yo jenere yon atik o aza soti nan yon etalaj ak poechèl?
$array | Get-Random

Ki jan yo sòt yon etalaj nan yon / fason desann moute ak poechèl?
$array = @('A', 'B', 'C')
$array | Sort-Object # A,B,C
$array | Sort-Object -Descending # C,B,A

Ki jan yo konte kantite atik nan yon etalaj ak poechèl?
$array.Count

Ki jan yo ajoute yon etalaj nan yon lòt ak poechèl?
$array1 = 'A', 'B', 'C'
$array2 = 'D', 'E', 'F'
$array3 = $array1 + $array2 # A,B,C,D,E,F

Ki jan yo jwenn Doublon soti nan yon etalaj ak poechèl?
$array = 'A', 'B', 'C', 'C'
($array | Group-Object | Where-Object -FilterScript {$_.Count -gt 1}).Values # Returns C

Ki jan yo retire Doublon soti nan yon etalaj ak poechèl?
$array = 'A', 'B', 'C', 'C'
$array = $array | Select-Object -Unique
$array # Returns A,B,C

Ki jan yo kreye yon etalaj ak atik kòmanse avèk yon prefiks (“user01”, “user02”, … “user10”) ak poechèl?
$array = 1..10 | ForEach-Object -Process { "user$_" }

Up


ACL

Ki jan yo lis akl nan yon itilizatè AD ak poechèl?
(Get-Acl -Path "AD:\$dn").Access

Ki jan yo lis akl nan yon folder ak poechèl?
(Get-Acl -Path C:\scripts).Access

Ki jan yo lis espesifik akl pèmisyon antre (itilizatè oswa gwoup) nan yon itilizatè AD ak poechèl?

Up


Variables

Ki sa ki kalite yo done ki pi komen ak poechèl?

Ki jan yo jwenn minimòm la ak valè maksimòm pou kèk varyab kalite ak poechèl?

Ki jan yo teste datatip a ak poechèl?

Kouman yo kreye yon Isit la-fisèl varyab ak poechèl?

Ki jan yo kreye yon varyab ak poechèl?
$powershellGuru = 'Hello'

Ki jan yo kreye yon varyab konstan ak poechèl?
Set-Variable -Name powershellGuru -Value 2015 -Option Constant

Ki jan yo kreye yon varyab mondyal ak poechèl?
$Global:powershellGuru = 'Hello'

Kouman li yon varyab ak poechèl?
$powershellGuru = 'Hello' # Create
$powershellGuru # Read