CEISTEANNA COITIANTA POWERSHELL IN NA HÉIREANN

By | May 17, 2015

Coincheap : An D’iarr an chuid is mó go minic faoi Powershell.

Is féidir leat úsáid a bhaint an liosta ar bhealaí éagsúla :

  • A chóipeáil / orduithe ghreamú isteach i script
  • Chun féachaint ar go tapa ar an chomhréir de ar a dtoil ar leith
  • Chun do eolas teicniúil a fheabhsú
  • Chun a fháil amach orduithe nua
  • Chun agallaimh poist a ullmhú

Nuashonraithe
2 Iúil, 2015
Údar powershell-guru.com
Foinse irish.powershell-guru.com
Catagóirí
75
Ceisteanna
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

Conas a chinneadh ar mo leagan de PowerShell?

Conas a reáchtáil PowerShell i leagan eile do comhoiriúnacht gcúl?
powershell.exe -Version 2.0

Conas a cheangal ar leagan PowerShell íosta (3.0 agus níos airde) i script le PowerShell?
#Requires -Version 3.0

Conas a éilíonn ceadanna riaracháin script le PowerShell?

Conas a sheiceáil na paraiméadair de script le PowerShell?
help -Name .\Get-ExchangeEnvironmentReport.ps1 -Full

Conas faisnéis don úsáideoir reatha le PowerShell a fháil?
[Security.Principal.WindowsIdentity]::GetCurrent()

Conas a chruthú, a eagrú, agus athluchtú próifíl le PowerShell?

Conas a dhéanamh le sos de 5 soicind / nóiméad i script le PowerShell?
Start-Sleep -Seconds 5
Start-Sleep -Seconds 300 # 5 minutes

Conas a fháil ar an am tosaithe seo caite le PowerShell?
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime

Conas a fháil luasairí cineál le PowerShell?

Conas a liostú na cláir tosaithe le PowerShell?

Conas a dhíshuiteáil iarratas le PowerShell?

Conas a ghlacadh seat den deasc ar fad nó fuinneoige gníomhaí le PowerShell?
Take-ScreenShot -Screen -File 'C:\scripts\screenshot.png' -Imagetype JPEG
Repository : Take-ScreenShot

Conas a fháil ar an líon teachtaireacht do scuainí MSMQ le PowerShell?

Conas a shocrú ar an bpolasaí a fhorghníomhú le PowerShell?

Conas a chruthú aicearra le PowerShell?

Conas a bioráin nó clár unpin chuig an tascbharra le PowerShell?

Conas a oscailt Windows Explorer le PowerShell?
[Diagnostics.Process]::Start('explorer.exe')
Invoke-Item -Path C:\Windows\explorer.exe

Conas chun liosta tiománaithe gléas le PowerShell?
Get-WmiObject -Class Win32_PnPSignedDriver
Get-WindowsDriver -Online -All
driverquery.exe

Conas a chruthú GUID le PowerShell?

Conas a fháil ar an suíomh ar an eolaire sealadach don úsáideoir reatha le PowerShell?
[System.IO.Path]::GetTempPath()

Conas a bheith páirteach cosán agus cosán leanbh isteach i gceann cosán amháin le PowerShell?
Join-Path -Path C:\ -ChildPath \windows

Conas chun liosta gach cmdlets “Get- *” le PowerShell?
Get-Command -Verb Get

Conas chun liosta fillteáin córas speisialta le PowerShell?

Conas a mount ISO comhaid / VHD le PowerShell?
Mount-DiskImage 'D:\ISO\file.iso' # ISO
Mount-DiskImage 'D:\VHD\file.vhd' # VHD

Conas a sheiceáil leaganacha Creat GLAN suiteáilte le PowerShell?

Conas a sheiceáil má tá an gCreat NET Leagan 4.5 suiteáilte le PowerShell?
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -EA 0).Version -like '4.5*'

Conas a thosú agus stop a athscríbhinn (do thaifead an tseisiúin Windows PowerShell chruthú) le PowerShell?
Start-Transcript -Path 'C:\scripts\transcript.txt
Stop-Transcript

Conas a athrú ar an eolaire reatha go dtí suíomh ar leith le PowerShell?
Set-Location -Path 'C:\scripts'

Conas a ghlanadh an scáileán le PowerShell?
Clear-Host
cls # Alias

Conas a athrú ar an rún a thaispeáint le PowerShell?
Set-DisplayResolution -Width 1280 -Height 1024 -Force # Windows 2012

Conas a shocrú ar an “scáileán iomlán” fuinneog le PowerShell?
mode.com 300

Conas a fháil toisí (leithead agus airde) de pictiúr le PowerShell?

Conas a fháil ar an eochair táirge Windows le PowerShell?

Perfmon

Conas a fháil ar an láthair “Am% Próiseálaí” (meán) sna 5 soicind seo caite (10 uair) le PowerShell?
(Get-Counter '\Processor(_total)\% Processor Time' -SampleInterval 5 -MaxSamples 10).CounterSamples.CookedValue

Assemblies

Conas a tionóil le PowerShell luchtú?

Conas a sheiceáil tionóil NET reatha luchtaithe le PowerShell?

Conas a aimsiú ar an GAC (Tionól Domhanda Cache) cosán le PowerShell?

Clipboard

Conas torthaí cóip chuig an gearrthaisce le PowerShell?

Conas a fháil ar an ábhar ar an gearrthaisce le PowerShell?
Add-Type -AssemblyName PresentationCore
[Windows.Clipboard]::GetText()

Hotfixes

Conas a fháil ar an hotfixes suiteáilte le PowerShell?
Get-HotFix -ComputerName $computer

Conas a fháil ar an hotfixes isteach roimh / tar éis dháta faoi leith le 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

Conas a sheiceáil má tá hotfix suiteáilte le PowerShell?
Get-HotFix -Id KB2965142

Conas a fháil ar an hotfixes suiteáilte ar ríomhaire iargúlta le PowerShell?
Get-HotFix -ComputerName $computer

Pagefile

Conas eolas Pagefile a fháil le PowerShell?
Get-WmiObject -Class Win32_PageFileusage | Select-Object -Property Name, CurrentUsage, AllocatedBaseSize, PeakUsage, InstallDate

Conas a fháil ar an méid molta (MB) don Pagefile le PowerShell?
[Math]::Truncate(((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5

Conas a chruthú Pagefile (4096 MB) ar an (D 🙂 thiomáint le PowerShell?

Conas a scriosadh Pagefile ar an (C 🙂 thiomáint le PowerShell?

Maintenance

Conas a sheiceáil leis an ilroinnt a thiomáint le PowerShell?

Conas a sheiceáil leis an spás diosca ar thiomáineann le PowerShell?

Up


Files

Conas a comhad le PowerShell oscailt?
Invoke-Item -Path 'C:\scripts\file.txt'
.'C:\scripts\file.txt'

Conas a léamh comhad le PowerShell?
Get-Content -Path 'C:\scripts\file.txt'
gc "C:\scripts\file.txt" # Alias

Conas aschur a scríobh chun an comhad le PowerShell?
'Line1', 'Line2', 'Line3' | Out-File -FilePath 'C:\scripts\file.txt'
'Line1', 'Line2', 'Line3' | Add-Content -Path file.txt

Conas a fháil ar an fullname an chomhaid script reatha le PowerShell?
$MyInvocation.MyCommand.Path

Conas a compress / comhaid zip le PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::CreateFromDirectory($folder,$fileZIP)

Conas a uncompress / comhaid unzip le PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::ExtractToDirectory($fileZIP, $folder)

Conas a fheiceáil na comhaid i gcartlann ZIP leis PowerShell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::OpenRead($fileZIP)

Conas a thaispeáint ar an méid comhad i KB le PowerShell?
(Get-ChildItem -Path .\winsrv.dll).Length /1KB
(Get-ChildItem -Path .\winsrv.dll).Length /1MB
(Get-ChildItem -Path .\winsrv.dll).Length /1GB

Conas a aimsiú comhaid níos mó nó níos lú ná 1 GB le PowerShell?

Conas a thaispeáint ainm an comhad gan an síneadh le PowerShell?
[System.IO.Path]::GetFileNameWithoutExtension('C:\Windows\system32\calc.exe') # Return calc

Conas a thaispeáint ar an síneadh comhad le PowerShell?
[System.IO.Path]::GetExtension('C:\scripts\file.txt') # Return .txt

Conas a fháil ar an leagan comhad comhad le PowerShell?

Conas a fháil ar an hash comhad le PowerShell?
(Get-FileHash $file).Hash

Conas a fháil ar an sheiceála MD5 / sha1 de chomhad le PowerShell?
Get-FileHash $file -Algorithm MD5
Get-FileHash $file -Algorithm SHA1

Conas a comhaid fholaithe taispeáint le PowerShell?

Conas a sheiceáil má tá síneadh le PowerShell comhad?

Conas a shocrú comhad mar “Léigh Amháin” le PowerShell?
Set-ItemProperty -Path .\file.txt -Name IsReadOnly -Value $true

Conas a athrú ar an “LastWriteTime” tréith go seachtain seo caite le haghaidh comhad le PowerShell?
Set-ItemProperty -Path .\file.txt -Name LastWriteTime -Value ((Get-Date).AddDays(-7))
If not working, use Nirsoft tool: BulkFileChanger.

Conas a chruthú comhad nua le PowerShell?
New-Item -ItemType File -Path 'C:\scripts\file.txt' -Value 'FirstLine'

Conas a athainmniú comhad le PowerShell?
Rename-Item -Path 'C:\scripts\file.txt' -NewName 'C:\scripts\powershellguru2.txt'

Conas a mórchóir / bhaisc athainmniú comhaid iomadúla le PowerShell?
Get-ChildItem -Path C:\scripts\txt | Rename-Item -NewName { $_.Name -replace ' ', '_' }

Conas a scriosadh comhad le PowerShell?
Remove-Item -Path 'C:\scripts\file.txt'

Conas a thaispeáint ar an 10 línte is déanaí de comhad le PowerShell?
Get-Content -Path 'C:\scripts\log.txt' -Tail 10

Conas a unblock roinnt comhaid de fillteán le PowerShell?
Get-ChildItem -Path 'C:\scripts\Modules' | Unblock-File

Conas a bhaint línte folamh ó chomhad le PowerShell?
(Get-Content -Path file.txt) | Where-Object -FilterScript {$_.Trim() -ne '' } | Set-Content -Path file.txt

Conas a sheiceáil má tá comhad le PowerShell?

Conas a fháil ar an / comhad newest cruthaíodh sine i bhfillteán le PowerShell?

Conas a bhaint línte dhúbailt ó chomhad le PowerShell?

Conas chun comhaid a cruthaíodh níos mó nó níos lú ná 1 mhí i bhfillteán le PowerShell a fháil?

Conas chun comhaid a cruthaíodh níos mó nó níos lú ná 1 bliain i bhfillteán le PowerShell a fháil?

Conas le luach athróg a onnmhairiú go dtí comhad le PowerShell?
Set-Content -Path file.txt -Value $variable

Conas a chomhaireamh ar líon na gcomhad (* txt) i bhfillteán le PowerShell?

Conas a chuardach ar shraith taobh istigh comhaid il leis PowerShell?
Select-String -Path 'C:\*.txt' -Pattern 'Test'

Conas a thaispeáint ar an chéad líne / dheireanach de chomhad le PowerShell?

Conas a thaispeáint ar roinnt líne ar leith de comhad le PowerShell?

Conas a chomhaireamh ar líon na línte comhad le PowerShell?

Conas a comhaireamh ar líon na carachtair agus focail comhad le PowerShell?

Conas a íoslódáil comhad le PowerShell?
Invoke-WebRequest -Uri 'http://www.nirsoft.net/utils/searchmyfiles.zip' -OutFile 'C:\tools\searchmyfiles.zip'

Conas a thaispeáint ar an chonair iomlán de comhad le PowerShell?
Resolve-Path -Path .\script.ps1 # Return C:\Scripts\script.ps1

Copy

Conas comhad amháin a chóipeáil i bhfillteán le PowerShell?
Copy-Item -Path 'C:\source\file.txt' -Destination 'C:\destination'

Conas comhad amháin chóipeáil do fillteáin il leis PowerShell?

Conas comhaid il chóipeáil go fillteán amháin le 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

Conas a aimsiú freastalaithe Catalog Domhanda i Eolaire Gníomhach le PowerShell?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs

Conas a láithreáin i Eolaire Gníomhach le PowerShell aimsiú?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites

Conas teacht ar an rialaitheoir fearainn atá ann faoi láthair le PowerShell?
(Get-ADDomainController).HostName

Conas a aimsiú ar na rialaitheoirí bhfearann ​​i réimse le PowerShell?

Conas a aimsiú ar an teipeanna macasamhlú AD le PowerShell?
Get-ADReplicationFailure dc02.domain.com # Windows 8 and 2012

Conas teacht ar an saolré Tombstone don fhoraois i Eolaire Gníomhach le PowerShell?

Conas sonraí na foraoise / bhfearann ​​i Eolaire Gníomhach le PowerShell a fháil?

Conas a fháil ar an cosán ar an “Scriosta Cuspóirí” coimeádán i Eolaire Gníomhach le PowerShell?
(Get-ADDomain).DeletedObjectsContainer

Conas a chur ar chumas an AD gné Athchúrsáil Bin i Eolaire Gníomhach le PowerShell?

Conas Cuntas AD ón Bin Athchúrsáil a chur ar ais i Eolaire Gníomhach le PowerShell?
Get-ADObject -Filter 'samaccountname -eq "powershellguru"' -IncludeDeletedObjects | Restore-ADObject

Conas a fháil ar an ról FSMO le PowerShell?

Conas a ceangal a dhéanamh le rialaitheoir fearainn ar leith le PowerShell?
Get-ADUser -Identity $user -Server 'serverDC01'

Conas a fháil ar an freastalaí logáil isteach faoi láthair le PowerShell?

Conas a dhéanamh “gpupdate” ar ríomhaire le PowerShell?
Invoke-GPUpdate -Computer $computer -Force -RandomDelayInMinutes 0 # Windows 2012

Groups

Conas a chruthú grúpa nua i Eolaire Gníomhach le PowerShell?

Conas a bhaint ar ghrúpa i Eolaire Gníomhach le PowerShell?
Remove-ADGroup -Identity 'PowershellGuru'

Conas a chur ar úsáideoir a chur ar ghrúpa i Eolaire Gníomhach le PowerShell?
Add-ADGroupMember "Powershell Guru" -Members powershellguru

Conas a bhaint úsáideoir ó ghrúpa i Eolaire Gníomhach le PowerShell?
Remove-ADGroupMember 'Powershell Guru' -Members powershellguru

Conas a aimsiú do ghrúpaí folamh (gan aon baill) i Eolaire Gníomhach le PowerShell?
Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}

Conas a chomhaireamh do ghrúpaí folamh (gan aon baill) i Eolaire Gníomhach le PowerShell?
(Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}).Count

Conas a fháil baill de ghrúpa i Eolaire Gníomhach le PowerShell?

Conas a fháil baill de ghrúpa le baill Athchúrsach i Eolaire Gníomhach le PowerShell?

Conas a chomhaireamh ar líon na mball de ghrúpa le / gan baill Athchúrsach i Eolaire Gníomhach le PowerShell?

Users

Conas a úsáid saoróg i an scagaire ar “Get-ADUser” i Eolaire Gníomhach le PowerShell?

Conas a bhogadh úsáideoir a OU eile i Eolaire Gníomhach le PowerShell?
Move-ADObject -Identity $dn -TargetPath 'OU=myOU,DC=domain,DC=com'

Conas a aimsiú ar na Feisirí atá (neadaithe) le haghaidh úsáideoir le PowerShell?
Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($dn))"

Conas a fháil ar Chomhaltaí (ainm gearr / teasctha) le haghaidh úsáideoir le PowerShell?
(Get-ADUser $user -Properties MemberOf).MemberOf | ForEach-Object -Process {($_ -split ',')[0].Substring(3)} | Sort-Object

Conas a athainmniú an Ainm (FullName), (DisplayName), GivenName (Céadainm), agus Sloinne (LastName) le haghaidh cuntas úsáideora i Eolaire Gníomhach le PowerShell?

Conas a athrú ar an Cur síos, Oifig, agus Uimhir ghutháin haghaidh cuntas úsáideora i Eolaire Gníomhach le PowerShell?
Set-ADUser $samAccountName -Description 'IT Consultant' -Office 'Building B' -OfficePhone '12345'

Conas a shocrú ar an dáta éagtha a “31/12/2015” nó “Ná” le haghaidh cuntas úsáideora i Eolaire Gníomhach le PowerShell?

Conas a dhíghlasáil cuntas úsáideora i Eolaire Gníomhach le PowerShell?
Unlock-ADAccount $samAccountName

Conas a chur ar chumas / cuntas úsáideora dhíchumasú i Eolaire Gníomhach le PowerShell?

Conas a bhaint cuntas úsáideora i Eolaire Gníomhach le PowerShell?
Remove-ADUser $samAccountName

Conas a athshocrú focal faire do chuntas úsáideora amháin i Eolaire Gníomhach le PowerShell?

Conas a athshocrú focal faire le haghaidh cuntais éagsúla úsáideora (mórchóir) i Eolaire Gníomhach le PowerShell?

Conas a fháil ar an úinéir comhad i Eolaire Gníomhach le PowerShell?

Conas a aimsiú ar an OU (Aonad eagrúcháin) le haghaidh úsáideoir i Eolaire Gníomhach le PowerShell?
[regex]::match("$((Get-ADUser $user -Properties DistinguishedName).DistinguishedName)",'(?=OU=)(.*\n?)').value

Conas a aimsiú cuntais úsáideora faoi mhíchumas i Eolaire Gníomhach le PowerShell?

Conas a aimsiú cuntais úsáideora in éag i Eolaire Gníomhach le PowerShell?
Search-ADAccount -AccountExpired

Conas a aimsiú cuntais úsáideora faoi ghlas i Eolaire Gníomhach le PowerShell?
Search-ADAccount -LockedOut

Conas a fháil ar an SID cuntas úsáideora i Eolaire Gníomhach le PowerShell?
(Get-ADUser $user -Properties SID).SID.Value

Conas ainm úsáideora a thiontú go SID i Eolaire Gníomhach le PowerShell?

Conas a Slándála a thiontú go ainm úsáideora i Eolaire Gníomhach le PowerShell?

Conas a scoilt an Ainm Oirirce cuntas úsáideora i Eolaire Gníomhach le PowerShell?

Conas a fháil ar an dáta a chruthú / a mhodhnú cuntas úsáideora i Eolaire Gníomhach le PowerShell?
Get-ADUser -Identity $user -Properties whenChanged, whenCreated | Format-List -Property whenChanged, whenCreated

Conas a thaispeáint ar na hairíonna roghnach agus éigeantach don aicme “Úsáideoir” i Eolaire Gníomhach le PowerShell?

Conas a fháil ar an cosán LDAP do úsáideoir i Eolaire Gníomhach le PowerShell?

Conas a athrú ar an CN (Canonical Ainm) le haghaidh úsáideoir i Eolaire Gníomhach le PowerShell?
Rename-ADObject $((Get-ADUser $user -Properties DistinguishedName).DistinguishedName) -NewName 'Test Powershell'

Conas a fháil ar an Aonad eagrúcháin (OU) tuismitheoir úsáideoir i Eolaire Gníomhach le PowerShell?

Conas a fháil ar an úinéir úsáideoir (a chruthaigh an gcuntas) i Eolaire Gníomhach le PowerShell?

Conas a thiontú ar an tréith PwdLastSet do úsáideoir i Eolaire Gníomhach le PowerShell?

Computers

Conas a thástáil an cainéal slán idir an ríomhaire áitiúil agus an bhfearann ​​le PowerShell?
Test-ComputerSecureChannel

Conas a dheisiú ar an gcainéal slán idir an ríomhaire áitiúil agus an bhfearann ​​le PowerShell?
Test-ComputerSecureChannel -Repair

Conas cuntas ríomhaire i Eolaire Gníomhach le PowerShell a chur ar ceal?
Disable-ADAccount $computer

Conas a ríomhairí le Córais Oibriúcháin ar leith i Eolaire Gníomhach a aimsiú le PowerShell?

Organizational Unit (OU)

Conas a chruthú Aonad eagrúcháin (OU) i Eolaire Gníomhach le PowerShell?
New-ADOrganizationalUnit -Name 'TEST' -Path 'DC=domain,DC=com'

Conas a fháil Aonad eagrúcháin (OU) mionsonraí i Eolaire Gníomhach le PowerShell?
Get-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Properties *

Conas a athrú ar an cur síos ar an Aonad eagrúcháin (OU) i Eolaire Gníomhach le PowerShell?
Set-ADOrganizationalUnit 'OU=TEST,DC=domain,DC=com' -Description 'My description'

Conas a chur ar chumas / a dhíchumasú Aonad eagrúcháin (OU) ó scriosadh thaisme i Eolaire Gníomhach le PowerShell?

Conas a chur ar chumas a scriosadh thaisme do na Aonad eagrúcháin (OU) i Eolaire Gníomhach le PowerShell?

Conas a scriosadh Aonad eagrúcháin (OU) a chosaint ó scriosadh thaisme i Eolaire Gníomhach le PowerShell?

Conas a Ainm Oirirce Aonad eagrúcháin (OU) a thiontú go Canonical Ainm i Eolaire Gníomhach le PowerShell?

Conas chun liosta Aonaid eagrúcháin folamh (ous) le PowerShell?

Conas a fháil ar an bainisteoir grúpa a bhfuil PowerShell?
(Get-ADGroup $dn -Properties Managedby).Managedby

Up


Regex (Regular Expression)

Conas a bhaint as an seoladh IP V4 (80.80.228.8) le RegEx le 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

Conas a bhaint ar ainm MAC (C0-D9-62-39-61-2D) le deighilteoir “-” le RegEx le 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

Conas a bhaint ar ainm MAC (C0: D9: 62: 39: 61: 2D) le deighilteoir “:” le RegEx le 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

Conas a bhaint le dáta (2015/10/02) le RegEx le PowerShell?
$example = 'The date is 10/02/2015'
$date = [regex]::match($example,'(\d{2}\/\d{2}\/\d{4})').value

Conas a bhaint URL (www.powershell-guru.com) le RegEx le PowerShell?
$example = 'The URL is www.powershell-guru.com'
$url = [regex]::match($example,'[a-z]+[:.].*?(?=\s)').value

Conas a bhaint as r-phost (user@domain.com) le RegEx le 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

Conas a bhaint as “Gúrú” as an sampla teaghrán le RegEx le PowerShell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?=.com)').value

Conas a bhaint as “guru.com” as an sampla teaghrán le RegEx le PowerShell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?<=.)').value

Conas a bhaint as “powershell-guru.com” as an sampla teaghrán le RegEx le PowerShell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=www.)(.*\n?)').value

Conas a bhaint as “123” as an sampla teaghrán le RegEx le PowerShell?
$example = 'Powershell123'
[regex]::match($example,'(\d+)').value

Conas a bhaint as “$” (comhartha dollar) as an sampla teaghrán le RegEx le PowerShell?
$example = 'Powershell`$123'
[regex]::match($example,'(\$)').value

Conas a chur in ionad carachtar (* com) le duine eile (* .fr) i teaghrán le RegEx le PowerShell?
$example = 'www.powershell-guru.com'
[regex]::Replace($example, '.com','.fr')

Conas chun éalú teaghrán le RegEx le PowerShell?
[regex]::Escape('\\server\share')

Up


Memory

Conas chun bhfeidhm bailiúchán de chuimhne ag an bailitheoir truflais le PowerShell?
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()

Conas a fháil ar an méid RAM ríomhaire le PowerShell?

Up


Date

Conas a fháil ar an dáta atá ann faoi láthair le PowerShell?
Get-Date
[Datetime]::Now

Conas a thaispeáint ar an dáta i bhformáidí éagsúla le PowerShell?

Conas dáta (datetime) a thiontú go dtí seo (Teaghrán) le PowerShell?
$datetimeToString = '{0:dd/MM/yy}' -f (Get-Date 30/01/2015)
$datetimeToString = (Get-Date 31/01/2015).ToShortDateString()

Conas dáta (Teaghrán) a thiontú go dtí seo (datetime) le PowerShell?
$stringToDatetime = [Datetime]::ParseExact('30/01/2015', 'dd/MM/yyyy', $null)

Conas a ríomh ar an difríocht (líon Laethanta, Uaireanta, Miontuairiscí, Soicind nó) idir dhá dátaí le 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

Conas a chur i gcomparáid dhá dátaí le 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

Conas a shórtáil le sraith de dátaí mar “datetime” le PowerShell?
$arrayDate | Sort-Object -Property {$_ -as [Datetime]}

Conas a thosú agus stop a stopwatch le PowerShell?
$chrono = [Diagnostics.Stopwatch]::StartNew()
$chrono.Stop()
$chrono

Conas a fháil ar an láthair lá den tseachtain le PowerShell?
(Get-Date).DayOfWeek #Sunday

Conas a fháil an lae inné dáta le PowerShell?
(Get-Date).AddDays(-1)

Conas a fháil ar an líon na laethanta i mí (i mí Feabhra 2015) le PowerShell?
[DateTime]::DaysInMonth(2015, 2)

Conas a fhios mbliain bhisigh le PowerShell?
[DateTime]::IsLeapYear(2015)

Conas criosanna ama le PowerShell chun liosta?
[System.TimeZoneInfo]::GetSystemTimeZones()

Up


Networking

Conas a ionchódú (go formáid ASCII) agus dhíchódú URL le PowerShell?

Cad iad na gcoibhéisí na n-orduithe líonra dúchais le PowerShell?

Conas a fháil seoltaí IP le PowerShell?
Get-NetIPAddress # Windows 8.1 & Windows 2012
Get-NetIPConfiguration # Windows 8.1 & Windows 2012

Conas a chur ar ceal seoladh IP V6 (IPv6) le PowerShell?

Conas a bhailíochtú an seoladh IP V4 (IPv4) le PowerShell?
if([ipaddress]'10.0.0.1'){'validated'}

Conas teacht ar an seoladh IP seachtracha PowerShell?

Conas a aimsiú an t-óstainm ó seoladh IP le PowerShell?
([System.Net.Dns]::GetHostEntry($IP)).Hostname

Conas teacht ar an seoladh IP ó óstainm le PowerShell?
([System.Net.Dns]::GetHostAddresses($computer)).IPAddressToString

Conas a aimsiú ar an FQDN ó óstainm le PowerShell?
[System.Net.Dns]::GetHostByName($computer).HostName

Conas teacht ar an chumraíocht líonra (Ip, Subnet, Geata, agus DNS) le PowerShell?

Conas a fháil ar an seoladh MAC le PowerShell?
Get-CimInstance win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress
Get-WmiObject -Class win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress

Conas a ping ar ríomhaire le PowerShell?

Conas a sheiceáil má tá ríomhaire atá ceangailte leis an idirlíon le PowerShell?

Conas a dhéanamh ar “whois” lookup do láithreán gréasáin le PowerShell?
$whois = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$whois.GetWhoIs('powershell-guru.com')

Conas a sonraí ar IP poiblí (Geolocation) le PowerShell a fháil?

Conas a sheiceáil má tá port oscailte / dúnta le PowerShell?
New-Object -TypeName Net.Sockets.TcpClient -ArgumentList $computer, 135

Conas a dhéanamh “tracert” le PowerShell?
Test-NetConnection www.google.com -TraceRoute

Conas próifíl nasc líonra bhaile le PowerShell a shocrú?
Get-NetAdapter | Format-Table -Property Name, InterfaceDescription, ifIndex -AutoSize # Windows 8.1
Set-NetConnectionProfile -InterfaceIndex 6 -NetworkCategory Private

Conas a thaispeáint ar an naisc calafoirt TCP le PowerShell?
netstat.exe -ano
Get-NetTCPConnection #Windows 8 and 2012

Conas a ghiorrú URL fada isteach URL bídeach le PowerShell?
$url = 'www.powershell-guru.com'
$tiny = Invoke-RestMethod -Uri "http://tinyurl.com/api-create.php?url=$url"

Conas a fháil socruithe seachfhreastalaí le PowerShell?
Get-ItemProperty -Path HKCU:"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

DNS

Conas a sheiceáil leis an taisce DNS ar ríomhaire áitiúil le PowerShell?
ipconfig.exe /displaydns
Get-DnsClientCache #Windows 8 and 2012

Conas a ghlanadh le taisce DNS ar ríomhaire áitiúil le PowerShell?
ipconfig.exe /flushdns
Start-Process -FilePath ipconfig -ArgumentList /flushdns -WindowStyle Hidden
Clear-DnsClientCache #Windows 8 and 2012

Conas a ghlanadh le taisce DNS ar ríomhairí iargúlta le PowerShell?
Invoke-Command -ScriptBlock {Clear-DnsClientCache} -ComputerName computer01, computer02

Conas a léamh ar an Óstríomhairí comhad le PowerShell?
Get-Content -Path 'C:\Windows\system32\drivers\etc\hosts'

Up


Password

Conas a ghiniúint focal faire randamach le PowerShell?
[Reflection.Assembly]::LoadWithPartialName('System.Web')
[System.Web.Security.Membership]::GeneratePassword(30,2)

Conas a athrú ar an focal faire áitiúil le haghaidh riarthóir ar fhreastalaí iargúlta le PowerShell?
$admin = [ADSI]('WinNT://server01/administrator,user')
$admin.SetPassword($password)
$admin.SetInfo()

Conas teacht ar an dáta éagtha phasfhocal de cuntas i Eolaire Gníomhach le PowerShell?

Up


Printers

Conas a liostú go léir na clódóirí do fhreastalaí ar leith le PowerShell?
Get-WmiObject -Query 'Select * From Win32_Printer' -ComputerName $computer

Conas a liostú ar fad na calafoirt ar feadh fhreastalaí ar leith le PowerShell?
Get-WmiObject -Class Win32_TCPIPPrinterPort -Namespace 'root\CIMV2' -ComputerName $computer

Conas a athrú ar an trácht / suíomh printéir le PowerShell?

Conas le sciúradh (gach post ar ceal) do printéir le PowerShell?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.CancelAllJobs()

Conas a phriontáil leathanach tástáil le haghaidh printéir le PowerShell?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.PrintTestPage()

Conas a fháil scuainí cló le clódóirí le PowerShell?

Up


Regedit

Read

Conas chun liosta hives registry le PowerShell?
Get-ChildItem -Path Registry::

Conas a fháil ar luachanna chlár agus cineálacha luach le PowerShell?

Conas chun liosta subkeys eochair sa Chlárlann le PowerShell?

Conas chun liosta subkeys eochair clárlainne bhealach recursive le PowerShell?
Get-ChildItem -Path 'HKLM:\SYSTEM' -Recurse -ErrorAction SilentlyContinue

Conas a subkeys le ainm sonrach le PowerShell aimsiú?
Get-ChildItem -Path 'HKLM:\SOFTWARE' -Include *Plugin* -Recurse -ErrorAction SilentlyContinue

Cé chomh ach ainm an subkeys chlár le PowerShell a thabhairt ar ais?
(Get-ChildItem -Path 'HKLM:\SYSTEM').Name # Return HKEY_LOCAL_MACHINE\SYSTEM\ControlSet
Get-ChildItem -Path 'HKLM:\SYSTEM' -Name # Return ControlSet

Conas chun liosta luachanna registry le PowerShell?
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

Conas a léamh le luach ar leith chlár le PowerShell?
(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ProductName

Conas a léamh le luach ar leith chlár ar ríomhaire iargúlta le PowerShell?

Write

Conas a chruthú eochair nua registry le PowerShell?
New-Item -Path 'HKCU:\Software\MyApplication'

Conas a chruthú luach clárlann le PowerShell?
New-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '1.0'

Conas a luach chlár atá ann cheana féin le PowerShell mhodhnú?
Set-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '2.0'

Delete

Conas a scriosadh luach clárlainne le PowerShell?
Remove-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version'

Conas a scriosadh eochair sa Chlárlann le PowerShell?
Remove-Item -Path 'HKCU:\Software\MyApplication' -Force

Test

Conas a thástáil má tá eochair sa Chlárlann le PowerShell?
Test-Path -Path 'HKCU:\Software\MyApplication'

Conas a thástáil má tá luach clárlainne le PowerShell?
(Get-Item -Path 'HKCU:\Software\MyApplication').GetValueNames() -contains 'Version'

Up


Strings

Conas a bhaint carachtair white- space ó thús teaghrán le PowerShell?
$string = ' PowershellGuru'
$string = $string.TrimStart()

Conas a bhaint carachtair white- space ó dheireadh a teaghrán le PowerShell?
$string = 'PowershellGuru '
$string = $string.TrimEnd()

Conas a bhaint carachtair white- space (ag tosú agus dar críoch) de shraith le PowerShell?
$string = ' PowershellGuru '
$string = $string.Trim()

Conas teaghrán a thiontú go cás uachtair le PowerShell?
$string = 'powershellguru'
$string = $string.ToUpper()

Conas a thiontú ar shraith cás níos ísle le PowerShell?
$string = 'POWERSHELLGURU'
$string = $string.ToLower()

Conas a roghnú an bhfotheaghrán “PowerShell” an teaghrán “PowerShellGuru” le PowerShell?
$string.Substring(0,10)

Conas a roghnú an bhfotheaghrán “Gúrú” an teaghrán “PowerShellGuru” le PowerShell?
$string.Substring(10)

Conas a roghnú an uimhir “123” ar “PowerShell123Guru” le PowerShell?
$string = 'Powershell123Guru'
[regex]::match($string,'(\d+)').value

Conas a fháil ar an t-innéacs náid-bhunaithe de “Gúrú” an teaghrán “PowerShellGuru” le PowerShell?
$string.IndexOf('Guru') # 10

Conas a sheiceáil an bhfuil teaghrán Eolas faoin margadh saothair nó folamh le PowerShell?
$string = $null
$string = ''
[string]::IsNullOrEmpty($string)

Conas a sheiceáil má tá teaghrán null, folamh, nó a comhdhéanta ach de charachtair bán-spás le PowerShell?
$string = $null
$string = ''
$string = ' '
[string]::IsNullOrWhiteSpace($string)

Conas a sheiceáil má tá teaghrán litir ar leith le PowerShell?
$string = 'PowershellGuru'
$string.Contains('s')
[regex]::match($string,'s').Success

Conas a thabhairt ar ais an fad ar shreang le PowerShell?
$string.Length

Conas a comhcheangail dhá teaghráin le PowerShell?

Conas a mheaitseáil ar cheann amháin nó roinnt lúibíní “[]” i teaghrán le PowerShell?
$string = '[PowershellGuru]'
$string -match '\[' # Only 1
$string -match '\[(.*)\]' # Several

Conas a mheaitseáil ar cheann amháin nó roinnt lúibíní “()” i teaghrán le PowerShell?
$string = '(PowershellGuru)'
$string -match '\(' # Only 1
$string -match '\((.*)\)' # Several

Conas a mheaitseáil ar cheann amháin nó roinnt lúibíní chatach “{}” i teaghrán le PowerShell?
$string = '{PowershellGuru}'
$string -match '\{' # Only 1
$string -match '\{(.*)\}' # Several

Conas a mheaitseáil ar cheann amháin nó roinnt lúibíní uillinn “<>” i teaghrán le PowerShell?
$string = ''
$string -match '\<' # Only 1
$string -match "\<(.*)\>" # Several

Conas a mheaitseáil aon litreacha CásÍochtair (abc) i teaghrán le PowerShell?
$string = 'POWERSHELLGURU'
$string -cmatch "^[a-z]*$" #False

Conas a mheaitseáil aon upperletters (ABC) i teaghrán le PowerShell?
$string = 'powershellguru'
$string -cmatch "^[A-Z]*$" #False

Conas a mheaitseáil “[p” (p cás níos ísle) i teaghrán le PowerShell?
$string = '[powershellGuru]'
$string -cmatch '\[[a-z]\w+' #True

Conas a mheaitseáil “[P” (P cás uachtair) i teaghrán le PowerShell?
$string = '[PowershellGuru]'
$string -cmatch '\[[A-Z]\w+' #True

Conas a chur in ionad líne le líne eile le PowerShell?
$a = 'Line A'
$b = 'Line B'
$a = $a -replace $a, $b

Conas oibríocht rannán a thiontú go teaghrán (céatadán) le PowerShell?
(1/2).ToString('P')

Conas a teaghráin ina bhfuil uimhreacha le PowerShell sórtáil?

Conas a roghnú an focal deireanach de phianbhreith le PowerShell?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ')[-1] # Returns Powershell

Conas a fháil ar an focal is mó de phianbhreith le PowerShell?
$sentence = 'My name is Test Powershell'
$sentence.Split(' ') | Sort-Object -Property Length | Select-Object -Last 1 # Returns Powershell

Conas a chomhaireamh an líon uaireanta is teaghrán i láthair faoi cheann pianbhreith le PowerShell?
$sentence = 'test test test Powershell'
[regex]::Matches($sentence, 'test').Count # Returns 3

Conas a chóipeáil gach carachtar i teaghrán le sraith carachtar le PowerShell?

Conas a thiontú an chéad litir a chás uachtair de shraith le PowerShell?

Conas a eochaircheap (ar chlé nó ar dheis) ar shraith le PowerShell?

Conas a ionchódú agus ar shraith dhíchódú go Base64 le PowerShell?

Conas uimhir a thiontú (chuig agus ó) dhénártha le PowerShell?

Conas a thabhairt ar ais ach an fillteán tuismitheoir deireanach i cosán le PowerShell?

Conas a thabhairt ar ais ach an mír seo caite i cosán le PowerShell?

Up


Math

Conas a liostú na modhanna rang System.Math le PowerShell?
[System.Math] | Get-Member -Static -MemberType Method

Conas a thabhairt ar ais ar an luach iomlán le PowerShell?
[Math]::Abs(-12) #Returns 12
[Math]::Abs(-12.5) # Returns 12.5

Conas a thabhairt ar ais an uillinn a bhfuil a tsínis é an líon sonraithe le PowerShell?
[Math]::ASin(1) #Returns 1,5707963267949

Conas a thabhairt ar ais ar an luach uasteorainn le PowerShell?
[Math]::Ceiling(1.4) #Returns 2
[Math]::Ceiling(1.9) #Returns 2

Conas a thabhairt ar ais ar an luach urlár le PowerShell?
[Math]::Floor(1.4) #Returns 1
[Math]::Floor(1.9) #Returns 1

Conas a thabhairt ar ais ar an nádúrtha (bonn e) logarithm de líon sonraithe le PowerShell?
[Math]::Log(4) #Returns 1,38629436111989

Conas a thabhairt ar ais an bonn 10 logarithm de líon sonraithe le PowerShell?
[Math]::Log10(4) #Returns 0,602059991327962

Conas a thabhairt ar ais an t-uasmhéid de dhá luach le PowerShell?
[Math]::Max(2,4) #Returns 4
[Math]::Max(-2,-4) #Returns -2

Conas a thabhairt ar ais an t-íosmhéid de dhá luach le PowerShell?
[Math]::Min(2,4) #Returns 2
[Math]::Max(-2,-4) #Returns -4

Conas a thabhairt ar ais ar roinnt ardaithe do chumhacht shonraithe le PowerShell?
[Math]::Pow(2,4) #Returns 16

Conas a thabhairt ar ais luach deachúil leis an luach lárnach gaire le PowerShell?
[Math]::Round(3.111,2) #Returns 3,11
[Math]::Round(3.999,2) #Returns 4

Conas a thabhairt ar ais ar an chuid lárnach de roinnt deachúil sonraithe le PowerShell?
[Math]::Truncate(3.111) #Returns 3
[Math]::Truncate(3.999) #Returns 3

Conas a thabhairt ar ais an fhréamh cearnach de líon sonraithe le PowerShell?
[Math]::Sqrt(16) #Returns 4

Conas a thabhairt ar ais ar an tairiseach PI le PowerShell?
[Math]::Pi #Returns 3,14159265358979

Conas a thabhairt ar ais ar an bonn logartamach nádúrtha (tairiseach e) le PowerShell?
[Math]::E #Returns 2,71828182845905

Conas a sheiceáil an bhfuil líon níos nó corr le PowerShell?
[bool]($number%2)

Up


Hashtables

Conas a chruthú hashtable folamh le PowerShell?
$hashtable = @{}
$hashtable = New-Object -TypeName System.Collections.Hashtable

Conas a chruthú hashtable le míreanna le PowerShell?

Conas a chruthú hashtable curtha in eagar ag eochair / ainm (Foclóir ordaigh) le míreanna le PowerShell?

Conas chun míreanna (eochair-luach péire) le hashtable le PowerShell chur?
$hashtable.Add('Key3', 'Value3')

Conas a fháil ar luach ar leith de hashtable le PowerShell?
$hashtable.Key1
$hashtable.Get_Item('Key1')

Conas a fháil ar an luach íosta de hashtable le PowerShell?

Conas a fháil ar an luach is mó de hashtable le PowerShell?

Conas a míreanna i hashtable le PowerShell mhodhnú?
$hashtable.Set_Item('Key1', 'Value1Updated')

Conas chun míreanna a bhaint i hashtable le PowerShell?
$hashtable.Remove('Key1')

Conas a ghlanadh le hashtable le PowerShell?
$hashtable.Clear()

Conas a sheiceáil ar an láthair eochair / luach ar leith i hashtable le PowerShell?
$hashtable.ContainsKey('Key3')
$hashtable.ContainsValue('Value3')

Conas a shórtáil de réir eochair / luach i hashtable le PowerShell?
$hashtable.GetEnumerator() | Sort-Object -Property Name
$hashtable.GetEnumerator() | Sort-Object -Property Value -Descending

Up


Arrays

Conas a chruthú le sraith folamh le PowerShell?
$array = @()
$array = [System.Collections.ArrayList]@()

Conas a chruthú le sraith le míreanna le PowerShell?
$array = @('A', 'B', 'C')
$array = 'A', 'B', 'C'
$array = 'a,b,c'.Split(',')
$array = .{$args} a b c
$array = echo a b c

Conas chun míreanna a chur leis le sraith le PowerShell?
$array += 'D'
[void]$array.Add('D')

Conas mír a mhodhnú i sraith le PowerShell?
$array[0] = 'Z' # 1st item[0]

Conas a sheiceáil leis an méid de eagar le PowerShell?
$array = 'A', 'B', 'C'
$array.Length # Returns 3

Conas a fháil mír amháin / éagsúla / gach ítim i sraith le PowerShell?
$array = @('A', 'B', 'C')
$array[0] # One item (A)
$array[0] + $array[2] # Several items (A,C)
$array # All items (A,B,C)

Conas a bhaint míreanna folamh i sraith le PowerShell?
$array = @('A', 'B', 'C', '')
$array = $array.Split('',[System.StringSplitOptions]::RemoveEmptyEntries) | Sort-Object # A,B,C

Conas a sheiceáil má tá mír i sraith le PowerShell?
$array = @('A', 'B', 'C')
'A' | ForEach-Object -Process {$array.Contains($_)} # Returns True
'D' | ForEach-Object -Process {$array.Contains($_)} # Returns False

Conas a fháil ar an treoir-uimhir mír i sraith le PowerShell?
$array = @('A', 'B', 'C')
[array]::IndexOf($array,'A') # Returns 0

Conas a athrú ar an ord na míreanna i sraith le PowerShell?
$array = @('A', 'B', 'C')
[array]::Reverse($array) # C,B,A

Conas a ghiniúint mír randamach as sraith le PowerShell?
$array | Get-Random

Conas a shórtáil le sraith i ardaitheach / íslitheach ar bhealach le PowerShell?
$array = @('A', 'B', 'C')
$array | Sort-Object # A,B,C
$array | Sort-Object -Descending # C,B,A

Conas a chomhaireamh ar líon na míreanna i sraith le PowerShell?
$array.Count

Conas a chur le sraith eile le PowerShell?
$array1 = 'A', 'B', 'C'
$array2 = 'D', 'E', 'F'
$array3 = $array1 + $array2 # A,B,C,D,E,F

Conas a dúbailt ó sraith le PowerShell aimsiú?
$array = 'A', 'B', 'C', 'C'
($array | Group-Object | Where-Object -FilterScript {$_.Count -gt 1}).Values # Returns C

Conas a dúbailt a bhaint as sraith le PowerShell?
$array = 'A', 'B', 'C', 'C'
$array = $array | Select-Object -Unique
$array # Returns A,B,C

Conas a chruthú le sraith le míreanna tosú le réimír (“user01”, “user02”, … “user10”) le PowerShell?
$array = 1..10 | ForEach-Object -Process { "user$_" }

Up


ACL

Conas a liostú ACL ar úsáideoirí AD le PowerShell?
(Get-Acl -Path "AD:\$dn").Access

Conas a liostú ACL de fillteán le PowerShell?
(Get-Acl -Path C:\scripts).Access

Conas chun liosta iontrálacha ar leith cead ACL (úsáideoirí nó grúpaí) de úsáideoir AD le PowerShell?

Up


Variables

Cad iad na cineálacha sonraí is coitianta le PowerShell?

Conas a aimsiú an t-íosmhéid agus luachanna uasta do roinnt athróg cineál le PowerShell?

Conas a thástáil an datatype le PowerShell?

Conas a chruthú Anseo-Teaghrán athróg le PowerShell?

Conas a chruthú athróg le PowerShell?
$powershellGuru = 'Hello'

Conas a chruthú athróg leanúnach le PowerShell?
Set-Variable -Name powershellGuru -Value 2015 -Option Constant

Conas a chruthú athróg domhanda le PowerShell?
$Global:powershellGuru = 'Hello'

Conas a léamh athróg le PowerShell?
$powershellGuru = 'Hello' # Create