Windows PowerShell Integrated Scripting Environment (ISE) is a graphical host application that enables you to read, write, run, debug, and test scripts and modules in a graphic-assisted environment., see the official webpage.
You can start on the command shell with this command:
1 | powershell_ise.exe |
You can run PowerShell commands in this environment, let’s see the version of PowerShell:
1 2 3 4 5 6 7 8 9 10 11 12 | PS C:\Users\catafest> $PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.2673 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.2673 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 |
You can use this command to show how many different cmdlets are available, in this case, the number is 1624:
1 2 3 4 5 6 7 8 | PS C:\Users\catafest> Get-Command | Measure-Object Count : 1624 Average : Sum : Maximum : Minimum : Property : |
The Get-Service shows services from your operating system.
The Get-Member cmdlet looks at all the objects in its input and provides output for each distinct class.
In this case, I use Get-Service, and the result is piped to Get-Member:
1 2 3 4 5 6 7 8 9 10 11 12 | Get-Service | Get-Member TypeName: System.ServiceProcess.ServiceController Name MemberType Definition ---- ---------- ---------- ... TypeName: System.ServiceProcess.ServiceController Name MemberType Definition ---- ---------- ---------- ... |
PowerShell has provided the count of items in each set, the value of the property Handles, and shows the first 7 with Select-Object –First.
1 2 3 4 5 6 7 8 9 10 11 | Get-Process | Sort-Object –Property Handles –Descending | Select-Object –First 7 Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 3319 0 200 140 4 0 System 3178 164 205264 132064 113.36 13248 2 explorer 1576 23 13296 30220 472 0 svchost 1493 46 111700 171300 11.39 9516 2 msedge 1426 31 9812 22188 860 0 lsass 1386 109 166120 193732 13.81 7552 2 SearchApp 1268 19 9724 15736 648 0 svchost |
Script files with a .ps1 extension are called scripts.
Module files with a .psm1 extension are called script modules.
PowerShell modules were introduced in Version 2.0 and are simply PowerShell’s term for a self-contained library or
package. The operating system is delivered with a number of built-in modules. To see them, you need to use this cmdlet:
1 2 3 4 5 6 7 8 9 10 11 | Get-Module ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0.0.0 ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet} Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...} Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...} ... |
You can use –ListAvailable to switch to the list of all the modules that PowerShell can find.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | Get-Module –ListAvailable Directory: C:\Program Files\WindowsPowerShell\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0.1 Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation} Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSou... Script 3.4.0 Pester {Describe, Context, It, Should...} Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...} Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSR... Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Manifest 1.0.0.0 AppBackgroundTask {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTa... Manifest 2.0.0.0 AppLocker {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLock... Manifest 1.0.0.0 AppvClient {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add-Appv... Manifest 2.0.1.0 Appx {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, ... |