Search This Blog

Monday, April 22, 2024

pnputil: enable and disable device

The topic of today is how you can work with pnputil.exe to enable and disable devices on your computer.

This was some research and experiments I did to find alternative or complimentary ways to the GUI and PowerShell cmdlets.

By using pnputil.exe /? in PowerShell I found out what some of the uses are and the commands that I was interested in are the following.

To enumerate

This command basically lists all your current devices and their unique ID, in this case it is called Instance ID. Let's say you want to disable a speaker, then you need to find the Instance ID for that speaker.

pnputil /enum-devices

Should you need to enumerate classes for some reason, then this is the command.

pnputil /enum-classes

To disable device

Simply take the full Instance ID for the device, brackets and all.

pnputil /disable-device "SWD\PRINTENUM\{283C1D7C-527C-4D85-8FE7-BCFA6768EA32}"

This example disables Microsoft Print to PDF.

To enable device

It is very much like the previous example, you use the Instance ID to enable the device.

pnputil /enable-device "SWD\PRINTENUM\{283C1D7C-527C-4D85-8FE7-BCFA6768EA32}"

If you keep the device manager open at the same time, you will notice it flicker as the device is enabled/disabled.

Additional examples

You need to run this as an administrator, what you can do for example is to create a simple .ps1 file and then point a shortcut on that file. Then right click the shortcut and run as administrator.

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.

Thursday, March 21, 2024

Desktop: Upgrading OptiPlex 3070 SFF

Background

Some time ago I bought an old used Dell OptiPlex 3070 SFF to use as a Minecraft server. This computer costed me 1249 SEK.

The computer came with an i3 8100 processor, and 8 GB of ram, using an NVMe with 128gb of storage.

I wanted to focus on budget and performance primarily. 

Upgrades

The first upgrade was actually an ancient HDD from the Windows XP era that I had laying around, it was seated in the computer and it worked just fine. The practical use of this drive is backup storage of my Minecraft world. For doing this backup I have made a PowerShell script.

The second upgrade was two sticks of DDR4 RAM, each using 16GB. They were both designed to run at 2666 mhz. However it turns out that Dell OptiPlex 3070 does not offer Extreme Memory Profiles (XMP) in the BIOS. In other word, you cannot manage the RAM from the BIOS. These ones I bought for 751 SEK.

The third upgrade was an i7 8700k processor, this required me to take out the HDD and the CPU-cooler. During this operation I also noticed a lot of dust build up, so I took the time to vacuum and apply new cooling paste. This one I bought for 1271 SEK.

How to install i7 8700k in the OptiPlex 3070 is pretty straightforward. Open up the side panel, move the HDD, loosen the CPU-cooler by untightening the screws with springs on. Lift the cooler to the side and remove the current CPU. Place the i7 8700k into the CPU holder, apply enough thermal paste and tighten the mechanism. Then put the computer back in the reverse order.

All these upgrades were practically plug and play. The total cost so far has been 3271 SEK.

Future potential upgrades

Next upgrades might be a better NVMe and Low Profile GPU.

Some of the GPUs that has been recommended by Bing AI are:

NVIDIA® GeForce® GT 730 (2GB GDDR5)

AMD® Radeon™ R5 430 (2GB GDDR5)

RX 550 (2GB GDDR5)


Meanwhile this forum recommends these:

RX 6400 Low profile, 4 GB DDR6

GTX 1050 Ti Low profile, 4 GB DDR5

GTX 1650 Low profile, 4 GB DDR5

RTX A2000 Low profile, 6/12 GB DDR6

It is important to look at the power supply as a bottleneck, some of these GPU - albeit low profile - might draw too much power for the PSU to keep the entire setup running. So my focus will be on getting a lower wattage with as much performance as possible, for the lowest price.

Sunday, March 10, 2024

PowerShell: File backup script

This simple script allows you to backup a chosen folder to a set destination.

This script contains the main engine so to speak, but you can build further using this as a base. Some suggestions might be to add failsafe features or a GUI.

You can also add options to delete/manage existing backups as they exists as simple .zip-files.
Another option you might want to look into is how to revert to an older backup.

I used this script for backing up my Minecraft world, on my MC server. Basically I customized the base script to stop the bedrock_server service as well, as it was blocking the compression. Then it saved the world as a .zip file on a separate disk. This script checks if there was a backup already made today, but of course you can change this to perhaps create a more granular filename to avoid collisions 

Param(

  [string]$Path = 'C:\Temp\App',

  [string]$DestinationPath = 'D:\Backup\'

)

If (-Not (Test-Path $Path)) 

{

  Throw "The source directory $Path does not exist, please specify an existing directory"

}

$date = Get-Date -format "yyyy-MM-dd"

$DestinationFile = "$($DestinationPath + 'backup-' + $date + '.zip')"

If (-Not (Test-Path $DestinationFile)) 

{

  Compress-Archive -Path $Path -CompressionLevel 'Fastest' -DestinationPath "$($DestinationPath + 'backup-' + $date)"

  Write-Host "Created backup at $($DestinationPath + 'backup-' + $date + '.zip')"

} Else {

  Write-Error "Today's backup already exists"

}

Monday, February 12, 2024

Arc Browser: Initial testing on Windows

It all begun with me seeing looking for the best web browser and going through a couple of videos on Youtube, I stumbled upon a new name in the scene called Arc browser. It looked quite clean and modifiable so I wanted to test it out. Unfortunately it wasn't available on Windows yet so they offered a waitlist, with nothing to lose I signed up and the wait begun.

What feels like ages of waiting since I signed up for the beta testing of Arc on Windows has now resulted in an installation of an early beta version of the Arc browser. First thing I did was to open process explorer and check how much resources it consumes. 

This is a sample of having one Youtube video running in the Arc browser. Not too bad, compared with an even more resource consuming Microsoft Edge.


What the Arc browser intends to do uniquely

Their idea is to combine browser, search engine and webpages. You type your question, it goes out and gets the information for you and builds your own page. "A browser that browses for you" is the way that The Browser Company explains it in a video, and they also want it to anticipate your needs as well.

It is available on Mac and iOS and this is their website: Arc from The Browser Company

How to join the waitlist

Joining the wait list was simple, I signed up on this link and then I waited. Today the download link and some basic instructions arrived in the email. Nothing too complicated really.

The instructions tell you to create and use a login for the browser, much like Mozilla Firefox, this account helps you sync your data. You are also asked not to share the download link or your login. 

Installation was simple, a regular app installer was downloaded which you then could execute.

Initial experience of Arc browser on Windows 11

Keep in mind that it is an early beta version so there are functionalities missing and not entirely chiseled out. On the side you have your tabs, folders/groups of pages, and access to your Gmail and Google Calendar.

The tab system on the left seems really clean at the beginning, I am curious to see how it will work when the amount of pages ramps up however.

Entering text into the search bar will Google it for you like usual, I wasn't able to intuitively get it to perform the Arc magic, the search bar was also a bit smaller than the Edge search bar I am used to so it was less easy to click.

So the first impressions is that it looks modern, feels clean but I am lacking a bit of the intuitive aspect and functionality.
Let's keep our eyes on the browser for what more is to come in the future.

Wednesday, January 24, 2024

Raspberry Pi: How to mine Monero

As I was looking for projects for Raspberry Pi I found a video on Youtube that NetworkChuck had posted. One project that I wanted to try for a few days was to mine cryptocurrency on the device, mostly to see if it was possible and learn what the process looks like. While the Pi 5 is the most powerful yet, it does not compare to dedicated mining machines. Simply put, it was interesting to learn but not a profitable venture in the slightest.

Some things to consider are the following:

- You are part of a miner pool, since your hardware might be weak you pool your resources with others and thus share the rewards with the pool

- There is a minimum payment threshold before the currency is sent to your wallet, I mined for 4-5 days straight and did not see any results in the wallet.

Download and install the wallet

I used the basic GUI wallet from Monero, they have a regular installer for Windows.

You install it like any other app, keep in mind that you can avoid the 90gb storage by running it in simple mode. It will take a while to sync the so called blockchain when starting up the wallet, but you avoid having to deal with 90gb of storage. A server somewhere else will be handling this for you, so it is also less anonymous if that is important for you.

Pro tip: Store your account recovery details, passwords etc. safely.

In your wallet you can find your wallet address under the account tab, use this when you start your Monero miner on the Raspberry Pi 5 later.

To install the miner

First I created a folder called monero.

Then went into the folder, ran the following code from the terminal:

sudo apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev -y

git clone https://github.com/xmrig/xmrig.git

cd xmrig

mkdir build && cd build

cmake ..

make

To start the miner 

Be in the build folder and enter the command below. You define which pool, which address and what you want to name your miner in case you have several computers mining at the same time.

./xmrig -o gulf.moneroocean.stream:10128 -u <wallet adress goes here> -p pi5

While it is mining you can press H to check your hashrate, higher is better. To see what you have contributed press S. Press C to check your connection, such as your difficulty.

To stop the miner

Ctrl + C, like any other command in a terminal

Friday, January 19, 2024

Raspberry Pi 5: Ubuntu server installation

Prerequisites

To get Ubuntu Server on Raspberry Pi it was actually as easy as just getting the Raspberry Pi imager from the official website.

Install it and run it directly.

Choose device (raspberry pi 5), choose OS (other general-purpose OS -> Ubuntu -> Ubuntu Server)

Choose a device to flash it to.

You will have options to include into your file, these are important. You want to set up wifi, make sure SSH is active and set an admin login, this is used later when you SSH in with PowerShell and when you login to the server with RDP. 

Flash the OS to the SD card, you are now done with the first step.

First time booting Ubuntu Server on Raspberry Pi 5

Put the SD card in the device. Keyboard, mouse and monitor is optional as you can manage the device wirelessly and remotely right away if you performed the options detailed in part 1.

Go to your router and find the IP address of the device, this is used in next step.

Open PowerShell and write ssh admin@192.168.0.X where admin is the user name and X is the last part of the IP address. Confirm with password. SSH is a secure alternative to Telnet.

You will then be taken to an admin prompt that takes linux commands.
You might want to start with the following command:

sudo apt-get update && sudo apt-get upgrade

Make sure to confirm if it prompts you.  

GUI and RDP to Ubuntu Server

The last step was to configure a desktop experience and RDP.

For the deskop experience I simply ran two commands, it would seem that the first one is required.

sudo apt install ubuntu-desktop-minimal

sudo apt-get install xfce4

If prompted, I went with the option lightdm and I restarted all serviced that asked me too, some which also disconnected me from the internet.

For the RDP I first ran the following command:

sudo apt install xrdp -y

Followed by this command that shows you if the installation went alright.

sudo systemctl status xrdp

After that I could RDP using the built-in solution on Windows. Some sources claim you need to fix ssl certs and restart the service, but I could start it right away.

Configure your RDP from your Windows computer

Configure a RDP link on your desktop with the following steps:

1. Open remote desktop connection from your start menu

2. Pick "show options"

3. Computer should be the IP address, user name is the one you entered at the flashing of the image

4. Save as, place it in a good location. Now you can use it and just entering your password.

When you login using RDP you will be greeted with a more familiar desktop experience.


Enjoy!

Windows 11: Hosting a Minecraft Bedrock server

This post will cover various steps to get a Minecraft server running on Windows 11.

For my experiment I was running it on an old laptop with x64 processor, it can also run bedrock server on the ARM-architecture and Ubuntu Server. For the sake of this post we will in other words just assume that you are running Win 11 and want to install the Bedrock server.

Prerequisites

I downloaded the server first and noticed that I was missing the Visual C++ Redistributable.
So my recommendation is to download both.



Once both are installed you need extract the bedrock zip-file as well, and place the extracted folder in a place that you are familiar with. I created a C:\Minecraft\ folder in which I placed it.

Configuring your server

As I already have a world on another computer, I wanted to transfer this world and keep it on the server instead.

To find your world, go to %localappdata% then go to 

...\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds

Within this directory each world has its own folder. Move this folder to your server computer.
You will have configuration file in your bedrock server folder in which you can point towards this world.

Getting your server online and available

If you don't make any changes and just run the bedrock_server.exe right of the bat, it becomes instantly available in the Minecraft client on another computer on the same network. Basically it is considered a LAN server and it is not available online for others to join.

Joining the server

To join the server on regular LAN, just open your Minecraft Bedrock client on the computer you intend to play from and make sure you are on the same network. Then you should find the world in the "server" section in the game.


Review: SanDisk Extreme 128GB and Kingston DataTraveler Micro Metal 256GB

As part of my Raspberry Pi 5 inital experimentation, I got some high quality hardware as well.

I decided to test the hardware using CrystalDiskMark.
These are the results of some quick testing.

Kingston DataTraveler Micro Metal 256GB:




SanDisk Extreme 128GB:



As you can see, the SD card performs well where the USB drive is not, and vice versa. I am currently running my Ubuntu Server off of the SD-card and using the USB drive as extra storage.

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.