Search This Blog

Showing posts with label Windows 11. Show all posts
Showing posts with label Windows 11. Show all posts

Thursday, May 1, 2025

PowerShell: New .ps1 in context menu

The context menu is the menu that shows up when you right-click in your explorer window. This is where you can create new files, folders and shortcuts.

So as I am a bit of a PowerShell nerd I thought it would be handy to have the .ps1 file in the context menu where you create new files as well. I found a reliable source at Winaero and a reg file created by Sergey Tkachenko (press the click here to download) to get the zip folder.

Compiling the research this is essentially the steps you need to take:

1. Open regedit as administrator and go to HKEY_CLASSES_ROOT and find the key for .ps1 files.

2. Change the value of "(Default)" to ps1legacy. Mine was set to ps1_file_auto


3. Create a new key (folder) under the .ps1 extension in the left pane. Name it ShellNew and within it create a new string value called NullFile and make sure the data is empty.


4. On the top level of HKEY_CLASSES_ROOT, create a new key for it named ps1legacy, give the "(Default)" the data Windows PowerShell Script. Create a new string value in the same place with the name FriendlyTypeName, give it the same data as the other string value.




Here is the result! 😊



Lastly, let's explore how we with some lines of PowerShell code could create the same result. This code snippet is boiled down to the essentials on purpose for simple step-through, reviewing and modification.

# Run as admin #

Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.ps1" -Name "(Default)" -Value "ps1legacy"

New-Item -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew" -Force

Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew" -Name "NullFile" -Value ""

New-Item -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Force

Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Name "(Default)" -Value "Windows PowerShell Script"

Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Name "FriendlyTypeName" -Value "Windows PowerShell Script"



Saturday, April 6, 2024

Windows: Microsoft PC Manager

Some time ago I heard about the latest program from Microsoft, called the Microsoft PC manager. A maintenance tool for computers, that combines already existing tools into a GUI.

Download is available from the Microsoft Store, but since I didn't want to log in, I found a so called offline installer, using Bing. The link for the offline installer (beta) is available here: https://aka.ms/PCManagerOFL30101

The functionality that the app contains are the following features:

Updating your system, including drivers that you can find in Windows Update.

Disk clean up, which includes the classic disk cleanup and removing temporary files for example. A function I found interesting was the scan for duplicate files.

Memory freeing activities, such as closing open processes.

You also can fix startup apps that slows up your booting.

Additionally you have a PC boosting button and a health check. You also have access to Microsoft Defender Antivirus scanning. 


Many of these functions are already available in your Windows 11 installation, but this program gathers these tools nicely under one app. A great addition to your home server management.

Friday, January 19, 2024

Raspberry Pi 5: Installing Windows 11

Previously I have had a Raspberry Pi 3b+  and after that I had a Raspberry Pi 4, 8GB, both which I ran Windows 10 on. Times have changed and I got the next generation of this single board computer now. During my research I found out that there now are people that have managed to get Windows 11 Enterprise running on a Raspberry Pi 5. 

Keep in mind that the platform uses ARM processor so that you will get that version of Windows, but it is also supposed to have a built-in system that can simulate the x64 architecture.

One of my experiments that I have planned, is to keep a Minecraft Bedrock server running on my Raspberry Pi 5 that will be installed with Windows 11.

The hardware

For this project I got the following hardware which set me back €178 or 1999 SEK.
The following is a breakdown of the costs converted to EUR.

SanDisk Extreme microSD card (128gb) €27

Kingston DataTraveler Micro Metal (256gb) €22

Raspberry Pi 5 (8gb) €76

Original case with fan €9

Charger €11

Import fee/VAT €33

I bought my Raspberry Pi 5 from The Pi Hut. The purchase experience was relatively smooth, but the transport time was super slow (keep in mind that I had already been waiting quite some time since my pre-purchase). Then the Pi got stuck in transit because I had to pay €30 in import fees as well. It was shipped around 29:th of December and has to this date not yet arrived. Something to keep in mind when you pick your point of purchase in other words.

The installation process

For this experiment, I followed this video to get Windows 11 on Raspberry Pi 5.

You will need UEFI-files (the files used for booting up pretty much) which can be downloaded here
Once downloaded, unzip the archive and place the files on your SD-card. The SD-card needs to be formatted as FAT32, I had trouble flashing it so had to partition it to a part that was smaller than 32GB.

Download the Win11 Enterprise ARM64 image as well from this link, this is what you flash to the USB.
As of January 2024 I used the following settings: Windows 11, latest build, ARM64 architecture, Enterprise edition and English (UK) as language.

You will need the WoR (Windows on Raspberry) program, this contains the script that allows flashing of the iso. Download and then extract contents to a new folder that you name to something intelligible.

Start WoR.exe as admin, go through the guide, make sure to choose Raspberry Pi 3. This is because boot files and main OS are kept separately at this stage. This step took a long time, so make sure to start early.

Put the SD card and the USB into the Raspberry Pi and your peripherals, then boot it up. After that it is pretty much a standard Windows 11 experience, but you are not running an activated version so you will miss out on certain customization.

Verdict

Well, after a lot of struggle I managed to get it running. The experience albeit familiar, it was also extremely slow, you can not do anything practical with this setup at this point. There can be minutes of delay after pressing a key and SFC /scannow and the DISM restorehealth commands can take hours, just to fail. Getting a bedrock server on this setup would not be feasible, neither RDP or Enable-PSRemoting worked.

Perhaps in the future there will be a better experience, but for now my recommendation is to not run with this setup. It was a good experiment.


Sunday, June 25, 2023

Dual Boot: Windows 11 and Kali Linux

After running Kali Linux as a live OS, from a USB-drive I thought it would be smoother to just have access to a linux distro directly installed on the PC instead of carrying around the USB-drive all the time.

When you want to run two operative systems on your computer it is often referred to as dual booting and using it can be pretty easy after you have prepared the necessary steps.

You will need a USB-drive for putting the Kali Linux ISO file on (I used a 16 gb one) and some 40 gb of space to spare on the computer that you want to dual boot. 

The following are the steps I took:

  1. First you want to create a partition with descent amount of available disk.
    Start computer management on the computer that you are going to dual boot. Find your primary partition, right click it and shrink it by roughly 40000 mb. This will create around 40 gb of free unallocated space to use.

  2. Download Rufus and download the latest Kali Linux ISO for bare metal installations. Bare metal simply means that it gets installed directly on the computer, not a virtual machine or a USB.

  3. Now run Rufus and flash the Kali Linux ISO to the USB-drive. I used the option "DD image" that pops up. Leave the USB-drive plugged in.

  4. Boot into UEFI of your computer and turn fast boot and secure boot off, then boot from the USB. Run the graphical installer and when it comes to partition, make a main partition with about 35 gb and then a swap partition with the rest (about 5 gb). Once you're near the end of the installation, it will ask you to unplug. Do so and continue to boot.

  5. You will notice that you now get the option of choosing what to boot into when starting or restarting the computer. In my case it auto boots to Kali if I just leave it for a few seconds, but using the arrow keys and enter key I can choose between my Windows 11 and Kali Linux.

  6. On your Kali installation you might want to open the terminal (ctrl + alt + T) and enter the following command in order to update and upgrade the OS/programs.

    sudo apt-get update && apt-get upgrade

  7. Don't forget to customize your installation further, such as rearranging the task bar, installing keyboard layouts and choosing a nice background.
Best of luck with your dual booting!

Sunday, May 7, 2023

VPN: Adding Proton VPN to Windows manually

The basics of VPN

The idea behind a VPN (Virtual Private Network) is partly to connect computers over a virtual network, in a business setting it could mean that you can access your company resources from outside the dedicated network. While you are at home or when traveling for example.

Today VPN:s are also sold to the average user as a magical defense against the cyber dark arts, but it's not entirely true. While it redirects your traffic and also encrypts data, it's not a one size fits all solution. Alternatives such as HTTPS will also encrypt your traffic and browsers like TOR (The Onion Router) redirects your connection through different nodes three times so that you become anonymized.

When you use a VPN you also entrust your information to another company than your Internet Service Provider (ISP).

The benefit of a VPN is that you can control what country you appear to browse the internet from. It can for example make you appear as an Italian user, thus allowing you to browse material restricted to Italy. Such as media sites and news websites. The downside is that some VPN:s messes your search experience up, putting you through annoying recaptchas. 

This post is not intending to guide you to a choice of VPN or to recommend one over the other. The simple fact is that I'm using Proton VPN when I need to use a VPN and I'm reasonably happy using their service and I trust them enough. All that aside, this is a guide on how to use Windows 11:s built-in VPN service by setting up a connection to a Proton VPN server. For a beginner I would simply recommend their downloadable app, it's available for Mac, PC and Linux. I even think I got it working on my Raspberry Pi 4 (Kali Linux).

Setting up a connection to a Proton VPN server manually in Windows 11

1. You need to create an account on the Proton VPN website if you aren't already registered. Then continue by login into the dashboard.


2. Take note of your login credentials if you need them again, if you are going to download their app you will need it to log in there as well.


3. When you are logged into their website go to https://account.protonvpn.com/account

At this page, make sure to copy your OpenVPN/IKEv2 username and password. These aren't the same as you use to log into the website/VPN app.


4. You are also going to copy a specific server address for the country/server that you want to use.

Go to https://account.protonvpn.com/downloads and scroll down to OpenVPN configuration files.

Pick a country and server, press the arrow key next to download to get the server address.

It can look like this for a Japanese server: jp-free-11.protonvpn.net



5. At this stage you have prepared your login details and a server address of your choice.

Time to install drivers.

Go to https://protonvpn.com/download/ProtonVPN_ike_root.der and download the certificate.

Open the file and click install certificate

Choose local machine and next

Choose to place all certificates in the following store, navigate and select the folder "Trusted Root Certification Authorities" and continue

Make sure that the installation is finished.


6. Now it's time to create a VPN connection in Windows.

Navigate to Settings -> Network & internet -> VPN. You can go there with PowerShell "start-process ms-settings:network-vpn" or by doing run "ms-settings:network-vpn".

Click "Add VPN"



Fill in the following:

VPN provider = Windows (built-in)

Connection name = Choose a suitable name for the connection

Server name or address = The server address you got from Proton VPN website, see step 4.

VPN type = IKEv2

Type of sign-in info = Username and password

Username = IKEv2 username, see step 3

Password = IKEv2 password, see step 3


7. Your connection should show up in the list. 

Test it out directly to see if you get any errors.


Fixing policy match error with Proton VPN

1. If you get a policy match error you can fix it in the registry

2. Create a .reg file with the following text:

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters]

"NegotiateDH2048_AES256"=dword:00000002


3. Run the .reg file when you have created it 

4. Try connecting your VPN again

5. Confirm that your IP has changed by visiting a "what is my IP" site for example

Thursday, January 19, 2023

Windows 11: Unsupported Hardware

One of the challenges when installing Windows 11 is meeting the hardware requirements, the download itself is quite easy.

Installing Windows 11 comes with requirements such as having a compliant CPU, having secure boot and TPM 2.0.

There are many ways in which you could bypass these if you run so called unsupported hardware.

In my case the computer didn't meet any of the requirements mentioned above, but the saving grace is perhaps a good amount of storage and an i7 processor. Things could be worse I guess. 

After trying some registry modifications I was close to giving up, but eventually I found a way that worked. My HP Elitebook 2540p managed to get Windows 11 installed, despite 4GB of ram it is running surprisingly well. Even the battery life seems to have gotten better.

So this is how I installed Windows 11 on my 2540p:
 
First download the English International version of the ISO here.
 
I made sure I had downloaded the latest Rufus software to create my USB and I used a USB-drive with at least 32GB of storage. 

In Rufus I then had the option to bypass TPM check and the like, so I used these options to ignore the requirements that kept me from just installing the regular Windows 11 ISO.

After flashing the drive with the modified ISO I could then install it on my PC the usual way, but I had to activate UEFI. After that I only had to configure Windows the usual way.

Using a legit Windows activation key I was then able to use the computer normally and even perform Windows Updates. There wasn't really any bugs and only some niche settings were locked due to the old age of the computer. To some degree I even experienced better user experience with Win11 than Win10.

Sunday, December 4, 2022

Registry: Show detailed Windows messages

Whenever you turn your computer on or off you can see messages such as "updating, please don't turn your computer off" at the boot screen.

Sometimes your computer can get stuck here or it takes a long time and you might wonder what is happening. Using the registry you can enable more detailed status messages at the boot up or restart.

Create a .reg-file with the following information:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]

“verbosestatus”=dword:00000001

Now you can see what the computer is doing when it previously only would indicate that it was working.