How to Reboot Windows using PowerShell for Windows

In this blog post, I will show how to reboot Windows using PowerShell.

As you know, rebooting Windows is typically done through the graphical interface, but understanding how to reboot Windows using PowerShell can be beneficial for various reasons (e.g., automation tasks, install scripts, etc.). Also, you may find yourself in a Windows environment that requires the use of the command line (e.g., Server Core).

ℹ️  Notice

You don’t need administrator privileges to reboot a desktop version of Windows, but you do need them to reboot a Windows Server.

To reboot Windows from the command line, run the following command in a PowerShell terminal.

Restart-Computer

If you need to forcefully reboot Windows (without waiting for all the programs to close first), use the “-Force” switch.

Restart-Computer -Force


Posted in Code Snippet, Command Prompt, Computers, Internet and Servers, Operating Systems, PowerShell, Tips & Tutorials

How to Disable Windows Memory Compression for Windows 10/11

In this blog post, I will explain how to disable memory compression on a Windows 10/11 system via PowerShell.

For those who don’t know, Windows compresses infrequently used memory instead of writing them to the page file. This way if your computer needs to use that particular data, it just has to decompress it in memory rather than access the much slower page file on your hard drive or SSD.

Since memory compression uses up CPU cycles, this can potentially slow down a computer.

Interesting Fact: Microsoft disables memory compression, by default, on Windows Servers. That right there tells you memory compression can potentially slow down a computer system.

ℹ️  Notice

Disabling memory compression on computers with limited RAM ( < 16GB ) can decrease performance rather than improve it. It is always recommended to run benchmarks before and after disabling memory compression to verify that you indeed received a performance increase from turning off memory compression.

To disable memory compression on Windows 10/11, run the following command in an Administrator PowerShell terminal.

 

Disable-MMAgent -mc

 

Disable Windows Memory Compression

 

Of course, if you wish to re-enable memory compression, just type the following command.

 

Enable-MMAgent -mc

 

Enable Windows Memory Compression

 

ℹ️  Notice

It would probably be a good idea to reboot Windows after disabling or enabling memory compression to make sure the change is applied.


Posted in Code Snippet, Command Prompt, Computers, Internet and Servers, Operating Systems, PowerShell, Tips & Tutorials

Merry Christmas 2024!

Merry Christmas 2024

 

Luke 2:8-20    New American Standard Bible (NASB)

8 In the same region there were some shepherds staying out in the fields and keeping watch over their flock by night. 9 And an angel of the Lord suddenly stood before them, and the glory of the Lord shone around them; and they were terribly frightened. 10 But the angel said to them, “Do not be afraid; for behold, I bring you good news of great joy which will be for all the people; 11 for today in the city of David there has been born for you a Savior, who is Christ the Lord. 12 This will be a sign for you: you will find a baby wrapped in cloths and lying in a manger.” 13 And suddenly there appeared with the angel a multitude of the heavenly host praising God and saying,

14 “Glory to God in the highest,
And on earth peace among men with whom He is pleased.”

15 When the angels had gone away from them into heaven, the shepherds began saying to one another, “Let us go straight to Bethlehem then, and see this thing that has happened which the Lord has made known to us.”16 So they came in a hurry and found their way to Mary and Joseph, and the baby as He lay in the manger. 17 When they had seen this, they made known the statement which had been told them about this Child. 18 And all who heard it wondered at the things which were told them by the shepherds. 19 But Mary treasured all these things, pondering them in her heart. 20 The shepherds went back, glorifying and praising God for all that they had heard and seen, just as had been told them.


Posted in Biblical Accounts, Christian, Holiday

How to Repair Corrupted Windows System Files using SFC and DISM

If you have used Windows for a long enough time, you may encounter an issue with corrupted system files.

This can be due to:

  • An improper system shutdown (e.g., power loss).
  • A failing hard drive or SSD.
  • Faulty RAM
  • A failed Windows update.
  • A third-party program that modifies system files (e.g., anti-virus).
  • A user accidentally deleting a system file (rare, but can happen).

Corrupted system files can cause Windows to become unstable, leading to blue screens, application crashes, slow performance, and possible data loss.

In this blog post, I will show you how to initiate a Windows system repair using SFC and DISM.

First let’s open PowerShell as Administrator (your computer may show “Command Prompt (Admin)” instead).

Open PowerShell as Admin

Now let’s type in:  sfc /scannow

Run SFC

Wait for the process to complete.

SFC Process Complete

Now if SFC has found no issues (like shown in the image above), then you should be OK. However, if SFC finds issues that it cannot fix, or if you’re experiencing more significant problems, you can then run DISM. This tool can help fix issues that SFC might not be able to address. You can run it with the command:  DISM /Online /Cleanup-Image /RestoreHealth

Run DISM

Wait for the process to complete.

DISM Complete

Please note that in some cases, system file corruption can be too severe for these tools to resolve. If that’s the case, you may need to restore from a system backup (if available) or perform a complete re-installation of Windows.


Posted in Code Snippet, Command Prompt, Computers, Internet and Servers, Operating Systems, PowerShell, Software, Tips & Tutorials