Windows PowerShell 30 Language Quick Reference

Listen to this Post

Featured Image
PowerShell is a powerful scripting language and command-line shell designed for system administration and automation. Below is a comprehensive guide to essential PowerShell 3.0 commands, syntax, and practical examples.

You Should Know:

Basic PowerShell Commands

1. Get-Command – Lists all available cmdlets.

Get-Command 

2. Get-Help – Displays help information for cmdlets.

Get-Help Get-Process 

3. Get-Process – Lists all running processes.

Get-Process 
  1. Stop-Process – Terminates a process by name or ID.
    Stop-Process -Name "notepad" -Force 
    

5. Get-Service – Displays all system services.

Get-Service 

6. Start-Service / Stop-Service – Manages services.

Start-Service -Name "Spooler" 
Stop-Service -Name "Spooler" 

File and Directory Operations

  1. Get-ChildItem – Lists files and directories (similar to `dir` or ls).
    Get-ChildItem C:\ 
    

8. Copy-Item – Copies files or folders.

Copy-Item "C:\file.txt" -Destination "D:\backup\" 

9. Remove-Item – Deletes files or directories.

Remove-Item "C:\temp\oldfile.txt" -Force 
  1. New-Item – Creates a new file or directory.
    New-Item -ItemType File -Path "C:\newfile.txt" 
    

System Management

11. Get-WmiObject – Retrieves system information via WMI.

Get-WmiObject -Class Win32_OperatingSystem 

12. Restart-Computer – Reboots the system.

Restart-Computer -Force 

13. Test-NetConnection – Checks network connectivity (replaces `ping`).

Test-NetConnection -ComputerName "google.com" 

Scripting & Automation

  1. ForEach-Object – Processes each item in a pipeline.
    1..10 | ForEach-Object { Write-Output "Number: $_" } 
    

15. If-Else Conditions – Basic conditional logic.

$value = 10 
if ($value -gt 5) { Write-Output "Greater than 5" } else { Write-Output "Less than 5" } 

16. Functions – Creating reusable code blocks.

function Get-Square { param($num) $num  $num } 
Get-Square -num 5 

Security-Related Cmdlets

  1. Get-Acl – Retrieves security descriptors of files/registry keys.
    Get-Acl "C:\Windows\System32" 
    

18. Set-ExecutionPolicy – Configures script execution permissions.

Set-ExecutionPolicy RemoteSigned 

19. Get-NetFirewallRule – Lists firewall rules.

Get-NetFirewallRule | Where-Object { $_.Enabled -eq $true } 

What Undercode Say

PowerShell remains a critical tool for IT professionals, enabling automation, system management, and security auditing. Mastering these commands enhances productivity and system control. For further learning, explore Microsoft’s official PowerShell documentation.

Expected Output:

  • A structured PowerShell 3.0 cheat sheet.
  • Practical commands for file management, system administration, and scripting.
  • Security-focused cmdlets for auditing and configuration.

References:

Reported By: Https: – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram