MIBVUNZO PAMUSORO PEPOWERSHELL

By | July 1, 2015

translated-shona


beta-v2-0


Mibvunzo ino yakaitirweyi Mibvunzo pamusoro pePowershell

Unokwanisa kubatsirikina munzira dzakasiyana siyana

  • Kuisa mitemo muchinyorwa
  • Kuti ukasire kuona mamiriro akaita mutemo wakati newakati
  • Kuwedzera zivo pabasa rako
  • Kuwana mitemo mitsva
  • Kugadzirira bvunzo yebasa

Zvakawedzerwa
2015/28/06
Munyori Steve Renard
Zvichiwanikwa shona.powershell-guru.com
Mapato
75
Mibvunzo
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

Ndingazive sei mhando yePowershell yandiri kushandisa?

Ndingashandise sei Powershell neimwe mhando kuitira kuti zvizopindirane nemhando dzekare?
powershell.exe -Version 2.0

Ndingashandise sei Powershell yemhando yepasi (3.0 kana pamusoro) pazvinyorwa nePowershell?
#Requires -Version 3.0

Ndingawana sei mvumo yekuchinja zvinyorwa zvakaitwa nePowershell?

Ndinoona sei maparamita pazvinyorwa nePowershell?
help -Name .\Get-ExchangeEnvironmentReport.ps1 -Full

Ndingawana sei ruzivo pamusoro pemunhu arikushanda nePowershell?
[Security.Principal.WindowsIdentity]::GetCurrent()

Ndingagadzira sei, kana kunatsiridza kana kuisa zvakare tsanangudzo izere nePowershell?

Ndingamisa sei zvinyorwa kwemaseconds mashanu kana kwemanitsi mashoma) nePowershell?
Start-Sleep -Seconds 5
Start-Sleep -Seconds 300 # 5 minutes

Ndingaziva sei nguva yakapedzesera kubatidzwa kombiyuta yangu nePowershell?
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime

Ndingawana sei ma’type accelerators’ with Powershell?

Ndingatara sei zvirongwa zvekutangisisa nePowershell?

Ndingabvisa sei chirongwa nePowershell?

Ndingatora sei mufannanidzo wepeji recombuta yangu kana peji yandinnenge ndiri kushandira nePowershell?
Take-ScreenShot -Screen -File 'C:\scripts\screenshot.png' -Imagetype JPEG
Repository : Take-ScreenShot

Ndingaverenge sei tsamba dzangu ndichisandisa MSMQ nePowershell?

Ndingagadzira sei ‘Execution Policy” nePowershell?

Ndingagadzira sei nzira yekudimburira nePowershell

Ndinga isa kana kubvisa sei purogiramu pa’Taskbar’ nePowershell

Ndingavhura sei ‘Windows Explorer’ nePowershell?
[Diagnostics.Process]::Start('explorer.exe')
Invoke-Item -Path C:\Windows\explorer.exe

Ndingaronga sei madhiraivha emushina nePowershell?
Get-WmiObject -Class Win32_PnPSignedDriver
Get-WindowsDriver -Online -All
driverquery.exe

Ndingagadzira sei GUID nePowershell

Ndingaziva sei kune munhu anenge ari kushandisa Powershell panguva ipi neipi?
[System.IO.Path]::GetTempPath()

Ndingabatanidza sei path nechild path kuti zvive one path nePowershell
Join-Path -Path C:\ -ChildPath \windows

Ndingaronge sei ma cmdlets “Get,-*” nePowershell?
Get-Command -Verb Get

Ndingaronge sei ma ‘Special System Folders’ nePowershell

Ndinga isa sei mafaira e ISO/VHD nePowershell?
Mount-DiskImage 'D:\ISO\file.iso' # ISO
Mount-DiskImage 'D:\VHD\file.vhd' # VHD

Ndingaona sei kuti ma .NET Framework versions akaiswa nePowershell akamira sei?

Ndingaziva sei kuti .NET Framework version 4.5 iripo yakaiswa nePowershell?
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -EA 0).Version -like '4.5*'

Ndingatangise nekumisa sei zvinyorwa zvinenge zvaitwa nePowershell?
Start-Transcript -Path 'C:\scripts\transcript.txt
Stop-Transcript

Ndingachinje sei dhayirekitori kuti riende pandinozosarudza nePowershell?
Set-Location -Path 'C:\scripts'

Ndingabvisa sei zviri pacombuta pangu nePowershell
Clear-Host
cls # Alias

Ndingachinja sei maratdziro anoita kombuyuta nePowershell?
Set-DisplayResolution -Width 1280 -Height 1024 -Force # Windows 2012

Ndingakudze ‘screen’ yangu sei nePowershell
mode.com 300

Ndingazive sei makuriro, (kupamhamha kana kureba) kwemupikicha nePowershell?

Ndingawana sei ‘Windows Product Key’ nePowershell?

Perfmon

Ndingawana sei ‘% Processor Time” mu masekondi mashanu (kagumi) nePowershell
(Get-Counter '\Processor(_total)\% Processor Time' -SampleInterval 5 -MaxSamples 10).CounterSamples.CookedValue

Assemblies

Ndingaisa sei ma’Assemblies’ nePowershell?

Ndingaziva sei ma’.NET assemblies’ epanguva iyoyo akaiswa nePowershell?

Ndingawana sei GAC (Global Assembly Cache) nePowershell

Clipboard

Ndinga kopa sei zvinhu nePowershell?

Ndingazowana zvinhu zvandambokopa sei nePowershell?
Add-Type -AssemblyName PresentationCore
[Windows.Clipboard]::GetText()

Hotfixes

Ndingaisa ma’hot fixes’ sei nePowershell?
Get-HotFix -ComputerName $computer

Ndingawana sei ma’hotfixes’ akaiswa pazuva rakati nerakati nePowershell?
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

Ndingaone sei kana ‘Hotfix’ yakaiswa nePowershell?
Get-HotFix -Id KB2965142

Ndingaisa sei ma ‘hotfixes’ pacombuta iri kure neni?
Get-HotFix -ComputerName $computer

Pagefile

Ndingawana sei ruzivo pamusoro pe ‘Pagefile’ nePowershell
Get-WmiObject -Class Win32_PageFileusage | Select-Object -Property Name, CurrentUsage, AllocatedBaseSize, PeakUsage, InstallDate

Ndingaziva sei saizi (MB) inodiwa pa’Pagefile nePowershell?
[Math]::Truncate(((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5

Ndingagadzira sei ‘Pagefile’ (4096 MB) pa D drive’ nePowershell?

Ndingabisa sei ‘Pagefile pa C drive’ nePowershell?

Maintenance

Ndingazive sei kudimburwa dimburwa kwe ‘drive’ nePowershell?

Ndingazive sei dzvimbo iri pa ma ‘drives’ angu nePowershell?

Up


Files

Ndingavhur ase faira nePwershell?
Invoke-Item -Path 'C:\scripts\file.txt'
.'C:\scripts\file.txt'

Ndingaverenga sei faira rangu nePowershell?
Get-Content -Path 'C:\scripts\file.txt'
gc "C:\scripts\file.txt" # Alias

Ndinganyora sei zvandawana kufaira ndichishandisa Powershell?
'Line1', 'Line2', 'Line3' | Out-File -FilePath 'C:\scripts\file.txt'
'Line1', 'Line2', 'Line3' | Add-Content -Path file.txt

Ndingawana sei zita rizere rechinyorwa chandiri kushandisa nePowershell?
$MyInvocation.MyCommand.Path

Ndingatsindiridze sei mafaira nePowershell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::CreateFromDirectory($folder,$fileZIP)

Ndingavhura sei mafaira andambotsindira nePowershell
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::ExtractToDirectory($fileZIP, $folder)

Ndinowona sei mafaira andatsindira nePowershell?
Add-Type -AssemblyName 'System.IO.Compression.Filesystem'
[System.IO.Compression.ZipFile]::OpenRead($fileZIP)

Ndinoratidza sei saizi refaira muma KB nePowershell?
(Get-ChildItem -Path .\winsrv.dll).Length /1KB
(Get-ChildItem -Path .\winsrv.dll).Length /1MB
(Get-ChildItem -Path .\winsrv.dll).Length /1GB

Ndinowana sei mafaira akakura kana madiki ku 1GB nePowershell?

Ndingaratidza sei zita refaira ndisingashandise tambanudzo nePowershell?
[System.IO.Path]::GetFileNameWithoutExtension('C:\Windows\system32\calc.exe') # Return calc

Ndinoratidza sei tambanudzo yefaira nePowershell?
[System.IO.Path]::GetExtension('C:\scripts\file.txt') # Return .txt

Ndinoziva sei mhando yefaira nePowershell?

Ndinowana sei hashi yefaira nePowershell?
(Get-FileHash $file).Hash

Ndinowana mhinduro kana ndasanganisa MD5/SHA1 yefaira nePowershell?
Get-FileHash $file -Algorithm MD5
Get-FileHash $file -Algorithm SHA1

Ndinoratidza sei mafaira anenge akahwandiswa nePowershell?

Ndinowona sei kana faira riine tambanudzo nePowershell?

Ndinogadzira sei faira kuti rive rekuverenga bedzi nePowershell?
Set-ItemProperty -Path .\file.txt -Name IsReadOnly -Value $true

Ndinochinja sei “LastWriteTime” kuti ive resvondo yakapera pafaira nePowershell?
Set-ItemProperty -Path .\file.txt -Name LastWriteTime -Value ((Get-Date).AddDays(-7))
If not working, use Nirsoft tool: BulkFileChanger.

Ndinogadzira sei faira idzva nePowershell?
New-Item -ItemType File -Path 'C:\scripts\file.txt' -Value 'FirstLine'

Ndinopa zit aidzva sei kufaira nePowershell?
Rename-Item -Path 'C:\scripts\file.txt' -NewName 'C:\scripts\powershellguru2.txt'

Ndingamazita manyowani kumafaira akawanda panguva imwe sei nePowershell?
Get-ChildItem -Path C:\scripts\txt | Rename-Item -NewName { $_.Name -replace ' ', '_' }

Ndingadzima sei faira nePowershell?
Remove-Item -Path 'C:\scripts\file.txt'

Ndingaratidza sei mitsetse gumi yekupedzisira yefaira nePowershell?
Get-Content -Path 'C:\scripts\log.txt' -Tail 10

Ndingavhura sei mafaira akawanda akaiswa muforodha nePowershell?
Get-ChildItem -Path 'C:\scripts\Modules' | Unblock-File

Ndinobvisa sei mitsara isina zvinhu pafaira nePowershell?
(Get-Content -Path file.txt) | Where-Object -FilterScript {$_.Trim() -ne '' } | Set-Content -Path file.txt

Ndingawana sei kuti faira riripo zveshuwa nePowershell?

Ndingawana sei faira idzva kana tsaru pamafaira ari muforodha nePowershell?

Ndinobvisa sei mitsetse yakadzokorodzwa mufaira nePowershell?

Ndingawana sei mafaira akagadzirwa panguva inoita mwedzi kana kupfuura muforodha nePowershell?

Ndingawana sei mafaira akagadirwa munguva inoita gore kana kupfuura nePowershell?

Ndingatumira sei huremu hwe zvisiyanwa kufaira nePowershell?
Set-Content -Path file.txt -Value $variable

Ndingaverenge sei huhwandu hwemafaira (*.txt) muforodha nePowershell?

Ndingatsvage sei tambo mukati memafaira akawanda nePowershell?
Select-String -Path 'C:\*.txt' -Pattern 'Steve'

Ndingaratidza sei mutsara wekutanga kana kuguma nepowershell?

Ndingaratidza mutsetse wemufaira wandiri kuda nePowershell?

Ndingaverenge sei mitsetse yemufaira nePowershell?

Ndingaverenge sei mazwi kana mavara ari mufaira nePowershell?

Ndingavhura sei faira nePowershell?
Invoke-WebRequest -Uri 'http://www.nirsoft.net/utils/searchmyfiles.zip' -OutFile 'C:\tools\searchmyfiles.zip'

Ndingaratidza sei nzira izere yefaira nePowershell?
Resolve-Path -Path .\script.ps1 # Return C:\Scripts\script.ps1

Copy

Ndinga kopa sei faira kuforodha nePowershell?
Copy-Item -Path 'C:\source\file.txt' -Destination 'C:\destination'

Ndingakopa sei faira rimwechete kumaforodha akawanda nePowershell?

Ndingakopa sei mafaira akawanda kuisa ku forodha rimwe nePowershell?
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

Ndingawana sei ‘Global Catalog servers’ mudirekitori riri kushanda nePowershell?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs

Ndingawana sei nzvimbo mudirekitori riri kushanda nePowershell?
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites

Ndingaziva sei kuti domain randiri kushandisa riri kushanda sei nePowershell?
(Get-ADDomainController).HostName

Ndingawana sei nzvimbo dzose dziri kubata domain rangu Nepowershell?

Ndingawana sei pari kukundikana maAD replication nePowershell?
Get-ADReplicationFailure dc02.domain.com # Windows 8 and 2012

Ndingawana sei nguva inoshanda ‘tombstone’ musango re direkitori randiri kushandisa nePowershell?

Ndingawana sei ruzivo pamusoro pesango/domain mudirekirori randiri kushandisa nePowershell?

Ndingawana sei nzira dzezvinyorwa zvadzimwa mudirekitori nePowershell?
(Get-ADDomain).DeletedObjectsContainer

Ndinomutsa sei bhinhi reAD mudirekitori nePowershell?

Ndinodzosa sei AD Account kubva mubhini mudhayirekitori nePowershell?
Get-ADObject -Filter 'samaccountname -eq "powershellguru"' -IncludeDeletedObjects | Restore-ADObject

Ndinowana seibasa re FSMO nePowershell?

Ndinobatanidza sei ma’domain controller’ nePowershell?
Get-ADUser -Identity $user -Server 'serverDC01'

Ndinowona sei pa sevha pandiri nePowershell?

Ndinoita sei ‘gpupdate’ pakombiyuta nePowershell?
Invoke-GPUpdate -Computer $computer -Force -RandomDelayInMinutes 0 # Windows 2012

Groups

Ndinogadzira sei bato idzva mudhayirekitori nePowershell?

Ndinobvisa sei bato mudhayirekitori nePowershell?
Remove-ADGroup -Identity 'PowershellGuru'

Ndinoisa sei mumwe munhu mubato redhayirekitori nePowershell?
Add-ADGroupMember "Powershell Guru" -Members powershellguru

Ndinobvisa munhu mubato riri mudhayirekitori nePowershell?
Remove-ADGroupMember 'Powershell Guru' -Members powershellguru

Ndinowona sei mabato asina vanhu mudhayirekitori nePowershell?
Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}

Ndinoverenga sei mabato asina vanhu mudhayirekitori nePowershell?
(Get-ADGroup -Filter * -Properties Members | Where-Object -FilterScript {-not $_.Members}).Count

ndinowana sei vanhu vari mubato redhayirekitori nePowershell?

Ndingawana sei vanhu vari mubato vanoita zvakafanana mudhayirekitori nePowershell?

Ndingaverenga sei vanhu vari mubato rimwe vane maitiro akafana kana akasiyana nePowershell?

Users

Ndingashandisa sei “wildcard’ mufirita ye “Get-ADUser” mudhayirekitori nePowershell?

Ndingabvisa sei munhu kuenda kune imwe OU mudhayirekitori nePowershell?
Move-ADObject -Identity $dn -TargetPath 'OU=myOU,DC=domain,DC=com'

Ndingawana sei zvinhu zvose zvakabatanidzwa pamwe nePowershell?
Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($dn))"

Ndingawana sei zita rekudimburira rezvinhu zvose zvemunhu nePowershell?
(Get-ADUser $user -Properties MemberOf).MemberOf | ForEach-Object -Process {($_ -split ',')[0].Substring(3)} | Sort-Object

Ndinga chinja sei, zita rizere, kana rekushandisa, zita remunhu neremhuri kumunhu ari kushandisa dhayirekitori nePowershell?

Ndinga chinja sei nhoroondo, hofisi kana nhare remunhu mudhayirekitori nePowershell?
Set-ADUser $samAccountName -Description 'IT Consultant' -Office 'Building B' -OfficePhone '12345'

Ndingaisa sei zuva rekupera kushanda sa 31/12/2015 kana kuti hapana zuva rekuguma kushandisa kumunhu mudhayirekitori nePowershell?

Ndingakiyinura sei akaundi yemunhu mudhayirekitori nePowershell?
Unlock-ADAccount $samAccountName

Ndinga vhura kana kuvhara sei akaundi mudirekitori nePowershell?

Ndingamvisa sei akaundi mudhayirekitori nePowershell?
Remove-ADUser $samAccountName

Ndingaisa sei pasiwedhi patsva muakaundi yemunhu mudhayirekitori nePowershell?

Ndingaisa pasiwedhi matsva kuvanhu vakawanda mjudhayirekitori nePowershell?

Ndingawana sei muridzi wefaira muidhayirekitori nePowershell?

Ndingawana sei OU (organizational unit) yemunhu mudhayirekitori nePowershell?
[regex]::match("$((Get-ADUser $user -Properties DistinguishedName).DistinguishedName)",'(?=OU=)(.*\n?)').value

Ndingawana sei maakaundi amiswa kushanda mudhayirekitori nePowershell?

Ndingawana sei maakaundi asisashande mudhayirekitori nePowewrshell?
Search-ADAccount -AccountExpired

Ndingawana sei maakaundi avhvarwa mudhairekitori nePowershell?
Search-ADAccount -LockedOut

Ndingawana sei SID ye akaundi mudhairekitori nePowershell?
(Get-ADUser $user -Properties SID).SID.Value

Ndingachinja sei zita rinoshandiswa kuenda ku SID mudhairekitori nePowershell?

Ndingachinja sei SID kuita zita rekushandisa mudhairekitori nePowershell?

Ndinga kamura sei zita rakapihwa akaundi mudhairekitori nePowershell?

Ndingawana sei zita rakagadzirwa kana kuchinjwa akaundi mudhairekitori nePowershell?
Get-ADUser -Identity $user -Properties whenChanged, whenCreated | Format-List -Property whenChanged, whenCreated

Ndingaratidza zvino sarudzwa kana zvinotofanira kuitwa nemunhu mudhayirekitori nePowershell?

Ndingawana sei LDAP yemunhu mudhairekitori nePowershell?

Ndingachinja sei CN (Canonical Name) remunhu mudhairekitori ne Powershell?
Rename-ADObject $((Get-ADUser $user -Properties DistinguishedName).DistinguishedName) -NewName 'Steve Renard'

Ndingawana sei panotangira Organizational Unit (OU) remunhu mudhairekitori nePowershell?

Ndingawana sei munhu akagadzira akaundi mudhairekitori nePowershell?

Ndingapindurudza sei PwdLastSet yemunhu mudhairekitori nePowershell?

Computers

Ndingaongorore sei nzira iri pakati pekombuita yepandiri ne ‘domain’ nePowershell?
Test-ComputerSecureChannel

Ndingagadzirisa sei nzira yakachengetedzeka pakati pekombuta yandiri nedomain nePowershell?
Test-ComputerSecureChannel -Repair

Ndingamisa sei kombuyuta kushanda mudhayirekitori nePowershell?
Disable-ADAccount $computer

Ndingawana sei makombuyuta ane mashandiro akadayi mudhayirekitori nePowershell

Organizational Unit (OU)

Ndingagadzira sei Organizational Unit (OU) mudhayirekitori nePOwershell?
New-ADOrganizationalUnit -Name 'STEVE' -Path 'DC=domain,DC=com'

Ndingawana sei zivo pamusoro peOrganizational Unit (OU) nePowershell?
Get-ADOrganizationalUnit 'OU=STEVE,DC=domain,DC=com' -Properties *

Ndingachinje sei tsanangudzo yeOrganizational Unit mudhayirekitori nePowershell?
Set-ADOrganizationalUnit 'OU=STEVE,DC=domain,DC=com' -Description 'My description'

Ndingatendera kana kurambidza sei Organizationa Unit kubva mukudzimika munhu asingade?

Ndingabvumidza sei kudzimika manga manga kweOrganizational Unit (OU) mudhayirekitori nePowershell?

Ndingabvisa sei Organizational Unit (OU) rakachengetwa kubva mukudzimwa manga manga

Ndingashandura sei zita rakapihwa kuOrganizational Unit (OU) kuenda ku Canonical Name’ mudhayirekitori nePOwershell?

Ndingataara sei maOrganizational Units asina zvinhu nePowershell?

Ndingawana sei minija webato nePowershell?
(Get-ADGroup $dn -Properties Managedby).Managedby

Up


Regex (Regular Expression)

Ndingawana sei kero yeIP v4 (80.80.228.8) ndichishnadisa Regex nePowershell?
$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

Ndingawana sei kero yeMAC (C0-D9-62-39-61-2D) nechinopatsanura “_” neRegex nePowershell?
$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

Ndingawana sei kero ye MAC (c0:d9:62:39:61:2D) nechinopatsanura neRegex nePowershell?
$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

Ndingawana sei zuva (10/02/2015) neRegex nePowershell?
$example = 'The date is 10/02/2015'
$date = [regex]::match($example,'(\d{2}\/\d{2}\/\d{4})').value

Ndingawana sei URL (www.powershell-guru.com) neRegex nePowershell?
$example = 'The URL is www.powershell-guru.com'
$url = [regex]::match($example,'[a-z]+[:.].*?(?=\s)').value

Ndingawana sei email’ (userdomain.com) neRegex nePowershell?
$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

Ndingawana sei ‘guru” kubva mustring example neRegex nePowershell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?=.com)').value

Ndingawana sei “guru.com” kubva mustring example neRegex nePowershell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=-)(.*\n?)(?<=.)').value

Ndingawana sei “powershell-guru.com” kubva mustring nePowershell?
$example = 'www.powershell-guru.com'
[regex]::match($example,'(?<=www.)(.*\n?)').value

Ndingawana sei “123” kubva mustring example neRegex nePowershell?
$example = 'Powershell123'
[regex]::match($example,'(\d+)').value

Ndingawana sei $ (saini yedora) kubva mustring example?
$example = 'Powershell`$123'
[regex]::match($example,'(\$)').value

Ndingachinjanise saini (*.com) ne (*.fr) mustring example?
$example = 'www.powershell-guru.com'
[regex]::Replace($example, '.com','.fr')

Ndingabuda sei kubva pastring neRegex nePowershell?
[regex]::Escape('\\server\share')

Up


Memory

Ndingamanikidza sei chikwata chezvakamboitwa kubva kunorasirwa nePowershell
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()

Ndingawana sei saizi yeRAM yekomboyuta nePowershell?

Up


Date

Ndinowana sei zuva ranhasi nePowershell?
Get-Date
[Datetime]::Now

Ndingaratidza sei zuva zvakasiyana siyana nePowershell?

Ndingashandura sei zuva (Datetime) kuenda kuzuva(string) nePowershell?
$datetimeToString = '{0:dd/MM/yy}' -f (Get-Date 30/01/2015)
$datetimeToString = (Get-Date 31/01/2015).ToShortDateString()

Ndingashadura sei zuva (Date) kuenda ku (Datetime) nePowershell?
$stringToDatetime = [Datetime]::ParseExact('30/01/2015', 'dd/MM/yyyy', $null)

Ndingawone sei musiyano (hweuwandu hwemazuva, maawa, maminitsi kana masekondi) pakati pemazuva maviri nePowershell?
(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

Ndingayenzanise sei mazuva maviri nePowershell?
(Get-Date 2015-01-01) -lt (Get-Date 2015-01-30) # True
(Get-Date 2015-01-01) -gt (Get-Date 2015-01-30) # False

Ndingaronge sei mazuva akasiyana siyana se “Datetime” nePowershell?
$arrayDate | Sort-Object -Property {$_ -as [Datetime]}

Ndingatanga nekumisa sei wachi nePowershell
$chrono = [Diagnostics.Stopwatch]::StartNew()
$chrono.Stop()
$chrono

Ndingawane sei kuti musi wechingani NePowershell?
(Get-Date).DayOfWeek #Sunday

Ndingawane sei kuti zuro waiva musi waani nePowershell?
(Get-Date).AddDays(-1)

Ndingawane sei kuti mumwedzi mune mazuva mangani (muna Kukadzi 2015) nePowershell?
[DateTime]::DaysInMonth(2015, 2)

Ndinoziva sei kuti Kukadzi wegore rino akareba nePowershell?
[DateTime]::IsLeapYear(2015)

Ndinotara sei mapazi akasiyana siyana enguva nePowershell?
[System.TimeZoneInfo]::GetSystemTimeZones()

Up


Networking

Ndinga isa code kana kuvhura kodhi ye URL seyi nePowershell?

Zvimvwe zvinoenderana ne ‘native network commands’ ndezvipi nePowershell?

Ndingawana kero dze IP sei nePowershell?
Get-NetIPAddress # Windows 8.1 & Windows 2012
Get-NetIPConfiguration # Windows 8.1 & Windows 2012

Ndingakonesa kuti kero ye IP ishande sei nePowershell?

Ndingaone sei chokwadi chekero yeIP v$ (IPV4) nePowershell?
if([ipaddress]'10.0.0.1'){'validated'}

Ndingawana sei kero yekunze yeIP nePowershell?

Ndingawana sei zita remuridzi we kero yeIP nePowershell?
([System.Net.Dns]::GetHostEntry($IP)).Hostname

Ndingawama sei kero yeIP kubva kuzita romuridzi?
([System.Net.Dns]::GetHostAddresses($computer)).IPAddressToString

Ndingawana sei FQDN kubva kuzita remuridzi nePowershell?
[System.Net.Dns]::GetHostByName($computer).HostName

Ndingawana sei zvizere pamusoro penetiweki (IP, sabhuneti, gateway ne DNS) ndichishandisa Powershell?

Ndingawana sei kero ye MAC nePowershell?
Get-CimInstance win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress
Get-WmiObject -Class win32_networkadapterconfiguration | Select-Object -Property Description, Macaddress

Ndingateveredza nzira yekombuyuta sei nePowershell?

Ndingawona seyi kana kombuyuta iine indaneti nePowershell?

Ndinoita sei kana ndichida kutsvaga “ndiyani”/whois yewebusaiti nePowershell?
$whois = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$whois.GetWhoIs('powershell-guru.com')

Ndingawane sei ruzivo pa kero yeIP yeruzhinji (Geolocation) nePowershell?

Ndingawone sei kana poti yakavhurika kana kuvharwa nePowershell?
New-Object -TypeName Net.Sockets.TcpClient -ArgumentList $computer, 135

Ndingaita ‘tracert’ sei nePowershell?
Test-NetConnection www.google.com -TraceRoute

Ndingagadzira sei neetiweki yepamba nePowershell?
Get-NetAdapter | Format-Table -Property Name, InterfaceDescription, ifIndex -AutoSize # Windows 8.1
Set-NetConnectionProfile -InterfaceIndex 6 -NetworkCategory Private

Ndinoratidza sei mabatanidzirwo akaitwa TCP poti nePowershell?
netstat.exe -ano
Get-NetTCPConnection #Windows 8 and 2012

Ndingapfupikisa sei URL yakareba kuiita kadiki diki nePowershell?
$url = 'www.powershell-guru.com'
$tiny = Invoke-RestMethod -Uri "http://tinyurl.com/api-create.php?url=$url"

Ndingawane sei maitirwo akaitwa Proxy nePowershell?
Get-ItemProperty -Path HKCU:"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

DNS

Ndingaone sei DNS cache pakombuyuta yepedo nePowershell?
ipconfig.exe /displaydns
Get-DnsClientCache #Windows 8 and 2012

Ndingabvisa sei DNS cache pakombuyuta yepedo nePOwershell?
ipconfig.exe /flushdns
Start-Process -FilePath ipconfig -ArgumentList /flushdns -WindowStyle Hidden
Clear-DnsClientCache #Windows 8 and 2012

Ndingabvisa sei DNS cache pakombuyuta yekure nePowershell?
Invoke-Command -ScriptBlock {Clear-DnsClientCache} -ComputerName computer01, computer02

Ndingaverenga sei zvinyorwa zvemafaira epo nePowershell?
Get-Content -Path 'C:\Windows\system32\drivers\etc\hosts'

Up


Password

Ngingaisa sei pasiwedhi chiripo ripocho nePowershell?
[Reflection.Assembly]::LoadWithPartialName('System.Web')
[System.Web.Security.Membership]::GeneratePassword(30,2)

Ndingachinja sei pasiwedhi yemutariri weepanzvimbo ipapo kusevha iri kure naye
$admin = [ADSI]('WinNT://server01/administrator,user')
$admin.SetPassword($password)
$admin.SetInfo()

Ndingawane sei musi unomira kushanda pasiwedhi mudhairekitori nePowershell?

Up


Printers

Ndingatara sei mapirinta esevha rimwe nePowershell?
Get-WmiObject -Query 'Select * From Win32_Printer' -ComputerName $computer

Ndingatara sei mapoti esevha rimwe nePowershell?
Get-WmiObject -Class Win32_TCPIPPrinterPort -Namespace 'root\CIMV2' -ComputerName $computer

Ndingachinja sei zvakanyorwa kana panowanikwa pirinta nePowershell

Ndingabvisa sei basa rose ranga ratumirwa kupirinta nePowershell?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.CancelAllJobs()

Ndingatumira sei peji rekuongorora pirinta nePowershell?
$printer = Get-WmiObject -Class win32_printer -Filter "Name='HP Deskjet 2540 series'"
$printer.PrintTestPage()

Ndingawane sei miraini yepirinta nePowershell?

Up


Regedit

Read

Ndingatara sei mapato emaregistiri nePowershell
Get-ChildItem -Path Registry::

Ndingawane sei udzamo uye mhando dzemaregistiri nePowershell?

Ndingatara sei makiyi nemakiyi anotevera eregistiri nePowershell?

Ndingatara sei makiyi nemakiyi anotevera eregistiri nenzira indzokororeka?
Get-ChildItem -Path 'HKLM:\SYSTEM' -Recurse -ErrorAction SilentlyContinue

Ndingawana sei makiyi anotevera aine zita rawo nePowershell?
Get-ChildItem -Path 'HKLM:\SOFTWARE' -Include *Plugin* -Recurse -ErrorAction SilentlyContinue

Ndingadzosa sei zita bedzi remakiyi anotevera eregistiri nePowershell?
(Get-ChildItem -Path 'HKLM:\SYSTEM').Name # Return HKEY_LOCAL_MACHINE\SYSTEM\ControlSet
Get-ChildItem -Path 'HKLM:\SYSTEM' -Name # Return ControlSet

Ndingatara sei udzamo we registiri nePowershell?
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

Ndingaverenga sei regisitiri iri nePowershell
(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ProductName

ndingaverenga sei udzamo weregisitiri iri pakombuyuta iri kure nePowershell?

Write

Ndingagadzira sei regisitiri nyowani nePowershell?
New-Item -Path 'HKCU:\Software\MyApplication'

Ndingagadzira sei udzamo weregisitiri nePowershell?
New-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '1.0'

Ndingachinja sei udzamo weregisitiri riripo nePowershell?
Set-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version' -Value '2.0'

Delete

Ndingadzime sei udzamo weregisitiri nePowershell?
Remove-ItemProperty -Path 'HKCU:\Software\MyApplication' -Name 'Version'

Ndingadzime sei kiyi yeregisitiri nePowershell?
Remove-Item -Path 'HKCU:\Software\MyApplication' -Force

Test

Ndingaongorore sei kuti kiyi yerigisitiri iripo nePowershell?
Test-Path -Path 'HKCU:\Software\MyApplication'

Ndingaongorore sei kuti udzamo weregisitiri huripo nePowershell?
(Get-Item -Path 'HKCU:\Software\MyApplication').GetValueNames() -contains 'Version'

Up


Strings

Ndingabvisa sei mavara kana masaini e’white-space” kubva panotangira ‘string’ nePowershell?
$string = ' PowershellGuru'
$string = $string.TrimStart()

Ndingabvisa sei mavara kana masaini kunoperera ‘string’ nePowershell?
$string = 'PowershellGuru '
$string = $string.TrimEnd()

Ndingabvisa sei mavara kana masaini kunotangira kana kuperera ‘string’ nePowershell?
$string = ' PowershellGuru '
$string = $string.Trim()

Ndingachinja sei ‘string’ kuti ive nemavara makuru nePowershell?
$string = 'powershellguru'
$string = $string.ToUpper()

Ndingachinja sei ‘string’ kuti ive nemavara maduku nePowershell?
$string = 'POWERSHELLGURU'
$string = $string.ToLower()

Ndingasarudza sei ‘substring’ Powershell ye ‘string’ “PowerShellGuru” nePowershell?
$string.Substring(0,10)

Ndingasarudza sei ‘substring’ “Guru” ye string’ “PowerShellGuru” nePowershell?
$string.Substring(10)

Ndingasarudza sei nhamba dzinoti “123” dze ‘Powershell” nePowershell?
$string = 'Powershell123Guru'
[regex]::match($string,'(\d+)').value

Ndingawana sei chikamu che zero-based che “Guru” chestring “PowerShellGuru” nePowershell?
$string.IndexOf('Guru') # 10

Ndingazive sei kana ‘string’ isina basa kana isina chinhu nePowershell?
$string = $null
$string = ''
[string]::IsNullOrEmpty($string)

Ndingazive sei kana ‘string’ isina basa, isina chinhu kana iiine ‘white space characters’ nePowershell
$string = $null
$string = ''
$string = ' '
[string]::IsNullOrWhiteSpace($string)

Ndingazive sei kana ‘string’ iine vara rakati nePowershell?
$string = 'PowershellGuru'
$string.Contains('s')
[regex]::match($string,'s').Success

Ndingadzosa seihurefu hwe ‘string’ nepOwershell?
$string.Length

Ndingabatanidza sei ma ‘string’ maviri nePowershell?

Ndingamechese sei chiumbiridzo chimwe kana zvakawanda “[ ]”mu ‘string’ nePowershell?
$string = '[PowershellGuru]'
$string -match '\[' # Only 1
$string -match '\[(.*)\]' # Several

Ndingamechese sei chiumbiridzo chimwe kana zvakawanda “( )” mustring nePowershell?
$string = '(PowershellGuru)'
$string -match '\(' # Only 1
$string -match '\((.*)\)' # Several

Ndingamechese sei chiumbiridzo chimwe kana zvakawanda “{ }” mustring nePowershell?
$string = '{PowershellGuru}'
$string -match '\{' # Only 1
$string -match '\{(.*)\}' # Several

Ndingamechese sei chiumbiridzo chimwe kana zvakawanda “< >” mu’string’ nePowershell?
$string = ''
$string -match '\<' # Only 1
$string -match "\<(.*)\>" # Several

Ndingamechese sei mavara maduku (abc) mu’string’ nePowershell
$string = 'POWERSHELLGURU'
$string -cmatch "^[a-z]*$" #False

Ndingamechese sei mavara majuru (ABC) mu’string’ nePowershell?
$string = 'powershellguru'
$string -cmatch "^[A-Z]*$" #False

Ndingameche sei “”[p” (p muduku) mustring nePowershell?
$string = '[powershellGuru]'
$string -cmatch '\[[a-z]\w+' #True

Ndingameche sei “[P” (P mukuru) mu’string’ nePowershell?
$string = '[PowershellGuru]'
$string -cmatch '\[[A-Z]\w+' #True

Ndingaisa mutsetse panga paine umwe tsetse sei nePowershell?
$a = 'Line A'
$b = 'Line B'
$a = $a -replace $a, $b

Ndingashandura sei oparesheni yekuputsa kuenda ku’string’ (mapesendi) nePowershell?
(1/2).ToString('P')

Ndingaronga sei ma’strings’ ane manhamba nePowershell?

Ndingasarudza sei izwi rekupedzisira mumutsara nePowershell?
$sentence = 'My name is Steve Renard'
$sentence.Split(' ')[-1] # Returns Renard

Ndingasarudza sei izwi hombesa mumutsara nePowershell?
$sentence = 'My name is Steve Renard'
$sentence.Split(' ') | Sort-Object -Property Length | Select-Object -Last 1 # Returns Renard

Ndingaverega sei kuti ‘string’ iri kuwanikwa kangani mumutsara nePowershell?
$sentence = 'steve steve steve renard'
[regex]::Matches($sentence, 'steve').Count # Returns 3

Ndinga kopa sei vara kana saini mu’string’ ndichizvironga pamwe nePowershell?

Ndingachinja sei vara rekutanga kuti rtiite guru nePowershell?

Ndingachinja sei (kuruboshwe kana kuruji) nePowershell?

Ndinga kodha kana kuziva kodhi sei ye’string’ kuenda ku Base64 nePowershell?

Ndingachinja sei nhamba (kuenda kana kubva) kubhainari nePowershell?

Ndingadzosa sei forodha rekutangisisa chete muhurongwa nePowershell?

Ndingadzosa sei chinhu chiri kwekupedzisisra muhurongwa nePowershell?

Up


Math

Ndingaronga sei nzira dze ‘System.Math’ kirasi nePowershell?
[System.Math] | Get-Member -Static -MemberType Method

Ndingadzokera sei ku huzamo hwekutangisisa nePOwershell?
[Math]::Abs(-12) #Returns 12
[Math]::Abs(-12.5) # Returns 12.5

Ndingadzokera sei ku ‘angle’ yekuti ‘sine’ yacho ndiyo nhamba yakarehwa nePowershell?
[Math]::ASin(1) #Returns 1,5707963267949

Ndingadzosa sei ‘ceiling value’ nePowershell?
[Math]::Ceiling(1.4) #Returns 2
[Math]::Ceiling(1.9) #Returns 2

Ndingadzosa sei ‘floor value’ nePowershell?
[Math]::Floor(1.4) #Returns 1
[Math]::Floor(1.9) #Returns 1

Ndingadzosa sei ‘natural (base e) logarithm yenhamba nePowershell?
[Math]::Log(4) #Returns 1,38629436111989

Ndingadzosa sei ‘base 10 logarithm’ yenhamba nePowershell?
[Math]::Log10(4) #Returns 0,602059991327962

Ndingadzosa sei ‘maximum’ yemanhamba maviri nePowershell?
[Math]::Max(2,4) #Returns 4
[Math]::Max(-2,-4) #Returns -2

Ndingadzosa sei ‘minimum’ yemanhamba maviri nePowershell?
[Math]::Min(2,4) #Returns 2
[Math]::Max(-2,-4) #Returns -4

Ndingadzosa sei nhamba inenge yakapetwa zvakati nePowershell?
[Math]::Pow(2,4) #Returns 16

Ndingadzosa seyi ‘decimal value’ kuiunza kunhamba yakazara nePowershell?
[Math]::Round(3.111,2) #Returns 3,11
[Math]::Round(3.999,2) #Returns 4

Ndingadzosa sei nhamba yakazara yedecimal nhamba nePowershell?
[Math]::Truncate(3.111) #Returns 3
[Math]::Truncate(3.999) #Returns 3

Ndingadzosa sei ‘square root’ yenhamba nePowershell?
[Math]::Sqrt(16) #Returns 4

Ndingadzosa sei ‘PI constsnt’ nePowershell?
[Math]::Pi #Returns 3,14159265358979

Ndingadzosa sei ‘natural logarithmic base (constant e) nePowershell?
[Math]::E #Returns 2,71828182845905

Ndingaone sei kana nhamba iri ‘even’ kana ‘odd’ nePowershell?
[bool]($number%2)

Up


Hashtables

Ndingagadzira sei ‘hashtable’isina zvinhu nePowershell?
$hashtable = @{}
$hashtable = New-Object -TypeName System.Collections.Hashtable

Ndingagadzira sei ‘hashtable’ ine zvinhu nePowershell?

Ndingagadzira sei ‘hashtable’ ine zvinhu zvakarongeka nekuda kwekiyi kana zita nePowershell?

Ndingaise sei zvimwe zvinhu (kiyi-nhamba) ku ‘hashtable’ nePowershell?
$hashtable.Add('Key3', 'Value3')

Ndingawana sei nhamba ye’hashtable’ nePowershell?
$hashtable.Key1
$hashtable.Get_Item('Key1')

Ndingawana sei nhmaba yepasi pasi ye’hashtable’ nePowershell?

Ndingawana sei nhmaba yepamusoro soro ye’hashtable’ nePowershell?

Ndingachinja sei zvinhu mu’hashtable’ nePowershell?
$hashtable.Set_Item('Key1', 'Value1Updated')

Ndingabvisa sei zvinhu mu’hashtable’ nePowershell?
$hashtable.Remove('Key1')

Ndingabvisa sei ‘hashtable’ nePowershell?
$hashtable.Clear()

Ndingaone sei kuti kiyi/nhamba yandirikuda irimu ‘hashtable’ nePowershell?
$hashtable.ContainsKey('Key3')
$hashtable.ContainsValue('Value3')

Ndingaronga sei kiyi/nhamba mu’hashtable’ nePowershell?
$hashtable.GetEnumerator() | Sort-Object -Property Name
$hashtable.GetEnumerator() | Sort-Object -Property Value -Descending

Up


Arrays

Ndingagadzira sei ‘array’ isina chinhu nePowershell?
$array = @()
$array = [System.Collections.ArrayList]@()

Ndingagadzira sei ‘array’ ine zvinhu nePowershell?
$array = @('A', 'B', 'C')
$array = 'A', 'B', 'C'
$array = 'a,b,c'.Split(',')
$array = .{$args} a b c
$array = echo a b c

Ndingawedzera sei zvinhu mu’array’ nePowershell?
$array += 'D'
[void]$array.Add('D')

Ndingachinja sei zvinhu zviri mu’array’ nePowershell?
$array[0] = 'Z' # 1st item[0]

Ndingaona sei makuriro e’array’ nePowershell?
$array = 'A', 'B', 'C'
$array.Length # Returns 3

ndingabuditsa sei chinhu kana zvinhu zvakawanda kana zvose mu’array’ nePowershell?
$array = @('A', 'B', 'C')
$array[0] # One item (A)
$array[0] + $array[2] # Several items (A,C)
$array # All items (A,B,C)

Ndingabvisa sei zvinhu zvisina chinhu mu’array’ nePowershell?
$array = @('A', 'B', 'C', '')
$array = $array.Split('',[System.StringSplitOptions]::RemoveEmptyEntries) | Sort-Object # A,B,C

Ndingawona sei kuti chinhu chandiri kutsvaga chirimo here mu’array’ nePwershell?
$array = @('A', 'B', 'C')
'A' | ForEach-Object -Process {$array.Contains($_)} # Returns True
'D' | ForEach-Object -Process {$array.Contains($_)} # Returns False

Ndingawana sei ‘index number’ yechinhu hiri mu’array’ nePowershell?
$array = @('A', 'B', 'C')
[array]::IndexOf($array,'A') # Returns 0

Ndinga rivhesa sei marongerwo akaitwa zvinhu mu’array’ nePowershell?
$array = @('A', 'B', 'C')
[array]::Reverse($array) # C,B,A

Ndinga gadzira sei chinhu kubva muarray nePowershell?
$array | Get-Random

Ndingaronge sei ‘array’ zvichikwidza kana kudzika nePowershell?
$array = @('A', 'B', 'C')
$array | Sort-Object # A,B,C
$array | Sort-Object -Descending # C,B,A

Ndingaverenge sei huwandu hwezvinhu zviri mu’array’ nePowershell?
$array.Count

Ndingaisa sei ‘array’ pane imwe nePowershell?
$array1 = 'A', 'B', 'C'
$array2 = 'D', 'E', 'F'
$array3 = $array1 + $array2 # A,B,C,D,E,F

Ndingawana sei zvinhu zvakadzokorodzwa mu’array’ nePowershell?
$array = 'A', 'B', 'C', 'C'
($array | Group-Object | Where-Object -FilterScript {$_.Count -gt 1}).Values # Returns C

Ndingabvisa sei zvakadzokorodzwa mu’array’ nePowershell?
$array = 'A', 'B', 'C', 'C'
$array = $array | Select-Object -Unique
$array # Returns A,B,C

Ndingagadzira sei ‘array’ ine zvinhu zvinotanga na (“user01″,”user02”,… “user10”) nePowerShell?
$array = 1..10 | ForEach-Object -Process { "user$_" }

Up


ACL

Ndingaronge sei ACL ye AD nePowershell?
(Get-Acl -Path "AD:\$dn").Access

Ndingaronge sei ACL yeforodha nePowershell?
(Get-Acl -Path C:\scripts).Access

Ndingaronge sei ma ACL permission entries (users/groups) emunhu ari kushandisa AD nePowershell?

Up


Variables

Mhando dze ‘data’ dzakanyanya ndedzipi nePowershell

Ndingawana sei ‘minimum’ ne ‘maximum’ yedzimwe mhando nePowershell

Ndingaongorore sei ma ‘dtatype’ nePowershell?

Ndingagadzira sei ‘variable’ ye Here-string’ nePowershell?

Ndingagadzira ‘variable’ nePowershell?
$powershellGuru = 'Hello'

Ndingagadzira sei ‘constant variable’ nePowershell?
Set-Variable -Name powershellGuru -Value 2015 -Option Constant

Ndingagadzira sei ‘global variable’ nePowershell?
$Global:powershellGuru = 'Hello'

Ndingaverenga sei ‘variable’ nePowershell?
$powershellGuru = 'Hello' # Create
$powershellGuru # Read
Get-Variable -Name powershellGuru -ValueOnly # Read

Ndingawona sei mhando yevariable nePowershell?
$powershellGuru.GetType()

Ndingawane sei ma ‘vriables’ mu ‘global scope’ nePowershell?
Get-Variable -Scope Global

Ndingawane sei ma ‘variables’ ndichiadoma nemazita nePowershell?
Get-Variable -Include *Preference -Exclude W*

Ndingapa sei ‘data-type’ ku ‘variable’ nePowershell?
[int64]$variable = 100
[string]$variable = 'PowershellGuru'

Ndingatanga sei ma’variables’ akawanda panhamba imwechete nePowershell?
$a = $b = $c = $d = $e = 0

Rimwe zita re ‘variable’ “$_” ichi nePowershell?
Get-Process | Where-Object -FilterScript {$_.Handles -gt 1000} # Using $_
Get-Process | Where-Object -FilterScript {$PSItem.Handles -gt 1000} # Using $PSItem (since version 3)

Ndingabvisa sei ma ‘variables’ ane zita rinotanga na ‘count’ nePowershell?
Remove-Variable -Name count*

Ndingawana sei ma ‘local environmentalvariables’ nePowershell
Get-ChildItem -Path Env:

Ndingawana sei ‘Path Environmental variable’ mutsara nemutsara nePowershell?
($env:Path) -replace(';', "`n")
[Environment]::GetEnvironmentVariable('Path') -replace(';', "`n")

Ndingaisa isa sei nzira itsva (ex. C:\SysinternalsSuite) ku Path Environmental Variable nePowershell?
$env:Path += ';C:\SysinternalsSuite'
$env:Path = $env:Path + ';C:\SysinternalsSuite'

Ndingabatanidza sei ma ‘variables’ nePowershell?
$a = 'Powershell'
$b = '- Guru'
$c = $a + $b

Ndingashandisa sei ‘ErrorVariable’ nePowershell
Get-ChildItem -Path 'C:\PerfLogs' -ErrorAction SilentlyContinue -ErrorVariable AccessDenied
$AccessDenied | ForEach-Object -Process {$_.Exception}
$AccessDenied | ForEach-Object -Process {$_.TargetObject}

Ndingatangisa kana kumisa sei zvakaenderena ne “Option Explicit” (VBScript: inod akuti variable idomwe) nePowershell?

Up


Static .NET Methods

Ndingawana sei ma ‘static member’ nePowershell?
[DateTime] | Get-Member -Static

Up


Sounds

Ndingabuditse izwi rekuti’beep” nePowershell?
[System.Console]::Beep()

Ndingabuditse sei izwi rekuti “asterisk” nePowershell?
[System.Media.SystemSounds]::Asterisk.Play()

Ndingabuditsa sei izwi rekuti “exclamation” nePowershell?
[System.Media.SystemSounds]::Exclamation.Play()

Ndingaziva sei mazwi aripo nePOwershell?
[System.Media.SystemSounds] | Get-Member -Static

Ndingabuditse sei mazwi ekuti “WAV” nePowershell?
$soundPlayer = New-Object -TypeName System.Media.SoundPlayer -ArgumentList "$env:windir\Media\Ringout.wav"
$soundPlayer.Play()
or
$soundPlayer.PlayLooping()
$soundPlayer.Stop()

Ndingagone sei kuti mazwi akanyorwa mushurwe mekutaurwa ashande nePowershell?
Add-Type -AssemblyName System.Speech
$speech = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$speech.Speak('Hello PowershellGuru')

Up


XML

Ndingaverenge sei faira re XML nePowershell?
[xml]$sitemap = Get-Content -Path .\sitemap.xml
$sitemap.urlset.url

Ndingatumira sei mashoko sefaira re XML nePowershell?
Get-Process | Export-Clixml -Path C:\scripts\processes.xml

Ndingatora sei mashoko kubva kufaira re CLIXML nePowershell?
$importProcesses = Import-Clixml -Path C:\scripts\processes.xml

Up


GUI

Ndingagadzira sei GUI 9(reWindows) nePowershell?

Up


Characters

Ndingashandura sei nhamba muASC11 kuenda ku saini nePowershell?
[char]64

Ndingashandura sei saini kuend aku ASC11 nePowershell?
[int][char]'@'

Ndingawana sei arifabeti yechirungu nePowershell?
[char[]](97..122)

Up


Compare

Ndingaenzanise sei ma ‘array’ maviri nePowershell?

Ndingaenzanise sei mafambiro ezvinhu maviri nePowershell?

Up


Microsoft Exchange

Ndingadzosa sei zvinyorwa zvemadhivhaisi akabatindzwa kumunhu ari kushandisa tsamba nePowershell?
Get-ActiveSyncDeviceStatistics

Ndingapa sei mvumo izere kutsamba nePowershell?
Add-MailboxPermission -Identity $dn -User 'DOMAIN\powershellguru' -AccessRights 'FullAccess'

Ndingabvisa sei mvumo izere kutsamba NePowershell?
Remove-MailboxPermission -Identity $dn -User 'DOMAIN\powershellguru' -AccessRights 'FullAccess' -InheritanceType 'All'

Ndingaisa sei mvumo kuita “Send As” kutsamba nePowershell?
Add-ADPermission -Identity $dn -User 'DOMAIN\powershellguru' -ExtendedRights 'Send-As'

Ndingabvisa sei mvumo kuita “Send As” kutsamba nePowershell?

Ndingawana sei mitemo yakaiswa patsamba nePowershell?
Get-InboxRule -Mailbox 'Powershell.Guru'

Ndingawana sei kero ye STMP yevanhu vanokwanisa kushandisa OWA (Outlook Web Access) nePowershell?
Get-CASMailbox -Filter{OWAEnabled -eq $true} | Select-Object -Property Name, PrimarySMTPAddress

Exchange 2007

Ndingaisa sei zvinodiwa pasevha Exchange Server 2007 Hub Transport, Mailbox (MBX), neClient Access Server CAS nePowershell?

Exchange 2010

Ndingaisa sei zvinodiwa pasevha Exchange Server 2010 Hub Transport, Mailbox (MBX), neClient Access Server CAS nePowershell?

Exchange 2013

Ndingaisa sei zvinodiwa pasevha Exchange Server 2013 Mailbox (MBX), neClient Access Server CAS nePowershell?

Ndingaisa sei zvinodiwa pasevha Exchange Server 2013 Client Access Server CAS chete nePowershell?