Draft:An Introduction to Powershell: Difference between revisions
MigrationBot (talk | contribs) Import from cypat.guide: docs/windows/scripting/introduction_powershell.md |
MigrationBot (talk | contribs) Backfill (v3.0 review queue): added to the review queue |
||
| Line 75: | Line 75: | ||
[[Category:Windows PowerShell|008]] | [[Category:Windows PowerShell|008]] | ||
[[Category:Migrated from cypat.guide]] | [[Category:Migrated from cypat.guide]] | ||
[[Category:Pending review]] | |||
Latest revision as of 05:42, 22 September 2026
This draft is ready for review. If you're the author, click below to notify a reviewer. A reviewer will check it for structure, sourcing, and accuracy. You may continue editing while you wait.Request reviewApprove draftReject draft
Author(s): Byrch
Last Updated: 07-30-2025
| Recommended Prerequisites (click to expand) |
|---|
|
None |
What is PowerShell?
PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.
Why it's important
Powershell is important due to the nature of the competition. You are tasked with securing systems in a timely manner, while also being compliant to industry best security practices. Powershell provides a fast way to automate security checks, apply patches, disable insecure configurations, and manage users.
- Powershell can run scripts to remediate the tedious, time consuming tasks
- It allows mass bulk changes, greatly improving productivity and time usage
- It's faster and more consistent than manually navigating through GUI
How to open/use PowerShell
On Windows (Recommended):
- Press Start and type
Powershell - Choose Windows Powershell or Powershell 7 (if installed)
- To run with administrative privileges, right-click and select Run as Administrator
If the steps above do not work, try the solutions outlined in the Microsoft documentation: https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell
Syntax basics
Cmdlets: PowerShell commands follow the Verb-Noun naming convention.
Example:
Get-Service
Pipelines (|): Pass the output of one command into another.
Get-Service | Stop-Service
DO NOT run code blindly from the internet. Always assess the code and potential risks before executing it. For example, the code above will "get" all services and pipe them into the "stop" command, which might stop critical services and potentially damage the host or guest system.
Variables: Use $ to define variables.
$name = "User"
${this can also be a variable} = "password"
Scripts: Save commands in a .ps1 file and execute it:
.\script.ps1
Help:
Get-Help <command>
Helpful websites, forums, and communities
Cypat Community Discord (Recommended)