Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows-Server ► ««« »»»

The 10 Best PowerShell Commands for Windows Server?


PowerShell is a powerful Windows Server management tool that allows administrators to efficiently automate and script tasks. Here are some handy PowerShell commands that are useful for managing a Windows Server:



1. Get System Information!
2. User Management!
3. Network and firewall! - Add firewall rule
4. File and directory management!
5. Services and processes!
6. Update management!
7. System monitoring and performance!
8. RDP management!
9. Query event logs!
10. Backups and restores!




1.) Get System Information!


- Show Hostname

Get-ComputerInfo -Property CsName
- Show Operating System Details

Get-ComputerInfo | Select-Object CsName, WindowsVersion, WindowsBuildLabEx, OsArchitecture
- Show IP Configuration

Get-NetIPAddress

2.) User Management!


- Create new user

New-LocalUser -Name "Username" -Password (ConvertTo-SecureString "Password" -AsPlainText -Force) -FullName "Full Name"
- Add user to group

Add-LocalGroupMember -Group "Administrators" -Member "Username"
- Change user password

Set-LocalUser -Name "Username" -Password (ConvertTo-SecureString "NewPassword" -AsPlainText -Force)

3.) Network and firewall! - Add firewall rule


New-NetFirewallRule -DisplayName "Allow HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
- Show active network adapters

Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
- Change DNS server

Set-DnsClientServerAddress -InterfaceAlias ​​"Ethernet0" -ServerAddresses ("8.8.8.8", "8.8.4.4")

4.) File and directory management!


- Create new directory

New-Item -Path "C:\NewDirectory" -ItemType Directory
- Copy file
:
Copy-Item -Path "C:\Source\File.txt" -Destination "C:\Destination\File.txt"
- List directory contents

Get-ChildItem -Path "C:\Directory"

5.) Services and processes!


- Show all running services

Get-Service | Where-Object {$_.Status -eq "Running"}
- Start service

Start-Service -Name "service name"
- End process

Stop-Process -Name "process name" -Force

6.) Update management!


- List available updates

Get-WindowsUpdate
- Install updates

Install-WindowsUpdate -AcceptAll -AutoReboot

7.) System monitoring and performance!


- Display CPU usage

Get-WmiObject Win32_Processor | Select-Object Name, LoadPercentage
- Display memory information

Get-WmiObject Win32_OperatingSystem | Select-Object TotalVisibleMemorySize,FreePhysicalMemory
- Show hard disk space

Get-PSDrive -PSProvider FileSystem

8.) RDP management!


- Enable RDP

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\" -Name "fDenyTSConnections" -Value 0
- Configure firewall for RDP

Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

9.) Query event logs!


- Show last 100 error events

Get-EventLog -LogName System -EntryType Error -Newest 100
- Show events from a specific date

Get-EventLog -LogName Application -After (Get-Date).AddDays(-1)

10.) Backups and restores!


- Create system image

wbadmin start backup -backupTarget:D: -include:C: -allCritical -quiet
- Show backup drives

Get-WBBackupTarget

These PowerShell commands are just a start. PowerShell is extremely flexible and can be customized to meet almost any management need. Scripts can also be combined to accomplish complex automation tasks.




FAQ 11: Updated on: 26 August 2024 17:29 Windows
Windows-Server

Main differences between Windows Server and Linux Server?


The main differences between Windows Server and Linux Server lie in several areas, including operating system structure, usability, licensing, security,
Windows-Server

Dark mode switcher Windows Server 2019, 2022, 2025?


Switching to dark mode in Windows Server 2019, 2022 or the future version 2025 is possible directly via a batch file 1. The batch file Dark Mode On and
Windows-Server

Webp Preview For Windows Explorer, Server 2019, 2022, 2025?


Here is the correct guide to enable WebP support in Windows File Explorer for Windows Server 2025, 2022 and 2019: 1. WebP Preview for Windows Server File
Windows-Server

How to enable wireless (Wi-Fi/WLAN) on Windows Server 2019/2022/2025?


Enabling wireless Wi-Fi/WLAN on Windows Server 2019, 2022 or 2025 is possible, although Windows Server editions are configured by default for use in a
Windows-Server

Error code 0x80073712, Repair Component Store on Windows Server?


Error code 0x80073712 indicates that the component store also known as the Component Store or WinSxS on your Windows server is corrupted. This store contains
Windows-Server

Problems with Install-WindowsFeature-Name wireless networking on the server?


If the Install-WindowsFeature -Name Wireless Networking command does not work on a Windows server, there are several possible causes and resolution steps
Windows-Server

Extend the Windows Server Datacenter trial period?


The standard evaluation period for Windows Server including the DataCenter version is 180 days. However, there is an option to extend this trial period

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, server, best, powershell, commands, powerful, management, tool, that, allows, administrators, efficiently, automate, script, tasks, here, some, handy, Questions, Answers, Software




  

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks
  + Security

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + QuickTextPaste
  + DesktopNoteOK
  + ShortDoorNote
  + AutoHideDesktopIcons
  + BlankAndSecure
  + AlwaysMouseWheel
  + NewFileTime
  + DesktopClock3D
  + PointerStick
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Settings | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2025 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu


► Change view to thumbnails (extra large symbols)! ◄
► Backup and restore bookmarks Windows 10 Firefox! ◄
► I would like to change the Explorer colors to the "old Norton Commander"! ◄
► The MiniBrowserOK! ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....