Powershell basics
Resources
What is PowerShell ?
Object-based
Command family extensible
Support command aliases
Handles console input and display
Has a pipeline
Built-in help system
PS version
Restriction policy
Bypass
Usefull for pentest.
Set
Help system
Discoverability
Compiled commands in PowerShell are called cmdlets. Cmdlets names have the form of singular "Verb-Noun" commands to make them easily discoverable.
Common verbs to use include:
Get
Start
Stop
Read
Write
New
Out
For example, the cmdlet for determining what processes are running is Get-Process and the cmdlet for retrieving a list of services and their statuses is Get-Service. There are other types of commands in PowerShell such as aliases and functions. The term PowerShell command is a generic term that's often used to refer to any type of command in PowerShell, regardless of whether or not it's a cmdlet, function, or alias.
The Three Core Cmdlets in PowerShell
Get-Command et Get-Help permettent toutes deux dâidentifier les commandes.
Get-Help
Get-Help is a multipurpose command. Get-Help helps you learn how to use commands once you find them. Get-Help can also be used to help locate commands, but in a different and more indirect way when compared to Get-Command.
Parameters :
Full
Detailed
Examples
Online
Parameter
ShowWindow
Get-Command
Get-Command is designed to help you locate commands. Running Get-Command without any parameters returns a list of all the commands on your system
Update-Help
Learn one command each day :)
Discovering objects, properties, and methods
Get-Member
Get-Member helps you discover what objects, properties, and methods are available for commands. Any command that produces object-based output can be piped to Get-Member. A property is a characteristic about an item. A method is an action that can be taken on an item.
Properties
TypeName tells you what type of object was returned. In this example, a System.ServiceProcess.ServiceController object was returned. This is often abbreviated as the portion of the TypeName just after the last period; ServiceController in this example.
Once you know what type of object a command produces, you can use this information to find commands that accept that type of object as input.
There are more properties than are displayed by default. Although these additional properties aren't displayed by default, they can be selected from the pipeline by piping the command to the Select-Object cmdlet and using the Property parameter.
Methods
Methods are an action that can be taken. Use the MemberType parameter to narrow down the results of Get-Member to only show the methods for Get-Service.
Last updated
Was this helpful?