1.
Get-Help:
Description: Retrieves information about cmdlets and their parameters.
Example: Get-Help Get-Process
2. Get-Command:
Description: Retrieves all commands matching the specified criteria.
Example: Get-Command -Name *process*
3. Get-Process:
Description: Gets the processes that are running on the local or a remote computer.
Example: Get-Process
4. Get-Service:
Description: Gets the status of services on a local or remote computer.
Example: Get-Service
5. Get-EventLog:
Description: Gets the events in the event log on a local or remote computer.
Example: Get-EventLog -LogName Application
6. Get-Item:
Description: Gets the item at the specified location.
Example: Get-Item C:\Windows
7. Get-ChildItem:
Description: Gets the items and child items in one or more specified locations.
Example: Get-ChildItem C:\
8. Set-ExecutionPolicy:
Description: Sets the user preference for the PowerShell script execution policy.
Example: Set-ExecutionPolicy RemoteSigned
9. New-Item:
Description: Creates a new item at a specified location.
Example: New-Item -ItemType Directory -Path C:\NewFolder
10. Copy-Item:
Description: Copies an item from one location to another.
Example: Copy-Item -Path C:\File.txt -Destination D:\Backup
11. Move-Item:
Description: Moves an item from one location to another.
Example: Move-Item -Path C:\File.txt -Destination D:\Archive
12. Remove-Item:
Description: Deletes an item.
Example: Remove-Item -Path C:\OldFile.txt
13. Get-Content:
Description: Gets the content of a file.
Example: Get-Content -Path C:\Example.txt
14. Set-Content:
Description: Writes new content to a file.
Example: Set-Content -Path C:\Example.txt -Value "Hello, World!"
15. Select-Object:
Description: Selects specific properties of an object.
Example: Get-Process | Select-Object Name, CPU, Handles
16. Where-Object:
Description: Filters objects based on specified criteria.
Example: Get-Process | Where-Object { $_.CPU -gt 50 }
17. ForEach-Object:
Description: Performs an operation on each item in a collection.
Example: Get-ChildItem | ForEach-Object { $_.Name }
18. Invoke-Command:
Description: Runs commands on local and remote computers.
Example: Invoke-Command -ComputerName Server01 -ScriptBlock { Get-Process }
19. Get-Variable:
Description: Gets the values of variables in the current session.
Example: Get-Variable
20. Write-Output:
Description: Sends output to the console.
Example: Write-Output "Hello, PowerShell!"
Data Types
1. String:
Description: A sequence of characters. It is used to represent textual data.
Example: "Hello, World!"
2. Integer:
Description: A whole number without a decimal point.
Example: 42
3. Float/Double:
Description: A number with a decimal point.
Example: 3.14
4. Boolean:
Description: Represents true or false values.
Example: $true or $false
5. Array:
Description: An ordered collection of values. Elements can be of different data
types.
Example: @("Apple", "Banana", "Orange")
6. Hash Table:
Description: A collection of key-value pairs. Each value is associated with a unique
key.
Example: @{ "Name" = "John"; "Age" = 25 }
7. DateTime:
Description: Represents a date and time.
Example: Get-Date
8. Null:
Description: Represents the absence of a value.
Example: $null
9. Object:
Description: An instance of a class or a custom data structure.
Example: $object = New-Object PSObject -Property @{ Name = "Alice"; Age = 30 }
10. Cmdlet:
Description: A special type representing PowerShell commands.
Example: Get-Process
11. ScriptBlock:
Description: A block of code that can be executed.
Example: { Write-Host "Hello, ScriptBlock!" }