> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PowerShell Basics on Windows Server: Commands to Know

> PowerShell basics for Windows Server: open it as administrator, find commands with Get-Command and Get-Help, manage services, files and network, and run scripts.

PowerShell is the command shell and scripting language built into Windows Server. Open it as administrator, then use `Get-Command` to find commands, `Get-Help <command> -Examples` to see how they work, and verb-noun cmdlets such as `Get-Service`, `Restart-Service`, `Get-ChildItem` and `Test-NetConnection` for daily tasks. Windows Server 2019, 2022 and 2025 include Windows PowerShell 5.1, and scripts run by default under the `RemoteSigned` execution policy.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 20 minutes to learn the basics | Windows Server 2019 / 2022 / 2025 (Desktop Experience and Server Core) | Remote Desktop or console access |

## Before you start

* Sign in with [Remote Desktop](https://help.freakhosting.com/portals/other/how-to-connect-to-windows-server-with-remote-desktop.md) or the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md).
* Most admin tasks need an elevated window (run as administrator). Commands that change the system fail with an access-denied error in a normal window.

## How to open PowerShell as administrator

> [tab] Desktop Experience
>
> Select **Start**, type `PowerShell`, right-click **Windows PowerShell** and choose **Run as administrator**. The title bar starts with **Administrator:**.

> [tab] Server Core
>
> On Windows Server 2022 and 2025, **SConfig** opens at sign-in; choose **15** (**Exit to command line (PowerShell)**). PowerShell is the default shell on Server Core from Windows Server 2022. On Windows Server 2019 the default shell is Command Prompt: type `powershell` and press **Enter**.

## How PowerShell commands are named

Cmdlets (PowerShell commands) use a **Verb-Noun** pattern: `Get-Service` reads services, `Stop-Service` stops one, `Set-TimeZone` changes a setting. Parameters start with a hyphen: `Get-Service -Name W3SVC`. Press **Tab** to complete command and parameter names.

## How to find commands and get help

```powershell theme={null}
Get-Command -Noun Service
Get-Command *firewall*
Get-Help Restart-Service -Examples
```

The modules that come with Windows don't include full help files, so `Get-Help` shows only basic information until you download them. Do that once, in an admin window:

```powershell theme={null}
Update-Help
```

`Get-Help <command> -Online` opens the Microsoft Learn page for that command in your browser.

## Commands you will use every day

### System information

```powershell theme={null}
hostname
Get-ComputerInfo -Property "*Version"
Get-TimeZone
Get-Volume
```

`Get-Volume` shows each drive with its free and total space.

### Services

```powershell theme={null}
Get-Service | Where-Object Status -eq 'Running'
Get-Service -Name W3SVC
Restart-Service -Name W3SVC
Set-Service -Name sshd -StartupType Automatic
```

Use the service's **Name** (not its display name) from `Get-Service`. Here `W3SVC` stands for the IIS web service and `sshd` for OpenSSH Server.

### Processes

```powershell theme={null}
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
Stop-Process -Name notepad
```

The first line lists the ten processes that have used the most CPU time.

### Files and folders

```powershell theme={null}
Get-ChildItem C:\inetpub\wwwroot
New-Item -ItemType Directory -Path C:\Backups
Copy-Item C:\inetpub\wwwroot\web.config C:\Backups\web.config
Get-Content C:\Logs\server.log -Tail 50
Get-Content C:\Logs\server.log -Tail 20 -Wait
```

`-Tail 50` shows the last 50 lines. Adding `-Wait` keeps the file open and prints new lines as they are written, like `tail -f` on Linux; press **Ctrl+C** to stop.

### Download and unzip

```powershell theme={null}
Invoke-WebRequest -UseBasicParsing -Uri "https://example.com/files/tool.zip" -OutFile "C:\Temp\tool.zip"
Expand-Archive -Path C:\Temp\tool.zip -DestinationPath C:\Tools\tool
Get-FileHash C:\Temp\tool.zip -Algorithm SHA256
```

In Windows PowerShell 5.1, `-UseBasicParsing` avoids a security prompt and stops the downloaded page from running script ([Invoke-WebRequest on Microsoft Learn](https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1)).

### Network

```powershell theme={null}
Get-NetIPAddress -AddressFamily IPv4
Test-NetConnection -ComputerName example.com -Port 443
Get-NetTCPConnection -State Listen | Sort-Object LocalPort
```

`Test-NetConnection` shows `TcpTestSucceeded : True` when the port answers. `Get-NetTCPConnection -State Listen` lists every port the server is listening on.

### Restart and shut down

```powershell theme={null}
Restart-Computer
Stop-Computer
```

> [!WARNING]
>
> `Stop-Computer` powers the server off. On a VPS you then need to [boot it from the VPS Panel](https://help.freakhosting.com/portals/vps-panel/how-to-start-stop-restart-and-power-off-your-vps.md). Use `Restart-Computer` unless you really want it off.

## How the pipeline works

The `|` (pipe) passes objects from one command to the next. PowerShell passes whole objects with properties, not just text, so you can filter and sort on any property:

```powershell theme={null}
Get-Service | Where-Object StartType -eq 'Automatic' | Where-Object Status -ne 'Running'
```

This lists services that should start automatically but aren't running, a quick health check after a restart.

## How to run a PowerShell script

Save commands in a file ending in `.ps1`, for example `C:\Scripts\cleanup.ps1`, and run it:

```powershell theme={null}
& "C:\Scripts\cleanup.ps1"
```

Check the execution policy:

```powershell theme={null}
Get-ExecutionPolicy -List
```

On Windows Server the default is **RemoteSigned**: scripts you write on the server run, but scripts downloaded from the internet must be signed or unblocked first ([about\_Execution\_Policies](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1)). If you trust a downloaded script, unblock it:

```powershell theme={null}
Unblock-File -Path C:\Scripts\downloaded.ps1
```

> [!WARNING]
>
> Don't set the execution policy to `Unrestricted` or `Bypass` for the whole machine to get one script working. Unblock or sign that script instead.

## Windows PowerShell 5.1 or PowerShell 7?

| | Windows PowerShell 5.1 | PowerShell 7 |
| - | - | - |
| Included with Windows Server | Yes | No, install it yourself |
| Command | `powershell` | `pwsh` |
| Windows Server modules (ServerManager, IIS and others) | All work | Some need the Windows Compatibility feature, some only run in 5.1 |

PowerShell 7 installs side by side with 5.1. Microsoft recommends the MSI package for Windows Server; on Windows Server 2025 with Desktop Experience you can also use `winget install --id Microsoft.PowerShell --source winget` ([Microsoft Learn](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows)). For server administration, 5.1 is enough to start.

## Frequently asked questions

### What is the difference between PowerShell and Command Prompt?

Command Prompt (`cmd.exe`) runs older commands and batch files. PowerShell runs those same tools plus cmdlets that return objects, which makes filtering, scripting and remote management much easier. Most Microsoft documentation for Windows Server now uses PowerShell.

### Is PowerShell case-sensitive?

No. `get-service` and `Get-Service` do the same thing. Some values you pass, such as winget package Ids with `-e`, can be case-sensitive.

### How do I see my command history?

Run `Get-History`, or press the **Up arrow** to step through earlier commands.

### Can I use Linux commands like ls and cat?

Yes, as aliases: `ls` and `dir` run `Get-ChildItem`, and `cat` runs `Get-Content`. Their options are PowerShell's, not Linux's.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Install software with winget](https://help.freakhosting.com/portals/other/how-to-install-software-with-winget-on-windows-server.md)
>
> Package manager on Windows Server 2025.

> [card] [Install roles and features](https://help.freakhosting.com/portals/other/how-to-install-roles-and-features-on-windows-server.md)
>
> Install-WindowsFeature explained.

> [card] [Enable OpenSSH Server](https://help.freakhosting.com/portals/other/how-to-enable-openssh-server-on-windows.md)
>
> Run PowerShell over SSH.

> [card] [Use Event Viewer to find errors](https://help.freakhosting.com/portals/other/how-to-use-event-viewer-to-find-errors.md)
>
> Read Windows logs.

***

> [!NOTE]
>
> **Checked against Microsoft Learn: [PowerShell 5.1 cmdlet reference](https://learn.microsoft.com/powershell/module/microsoft.powershell.management/?view=powershell-5.1), [about\_Execution\_Policies](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1), [SConfig](https://learn.microsoft.com/en-us/windows-server/administration/server-core/server-core-sconfig) and [Install PowerShell on Windows](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows)** on 4 November 2026. Not tested on a live Windows server for this page.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.