Search This Blog

Tuesday, December 26, 2023

PowerShell: Automating Cheats in Star Wars Knights of the Old Republic

Hello,

This blog post builds a bit on techniques such as sendkey/sendwait, allowing the PowerShell user to automate keystrokes which helps a lot when entering lengthy cheat codes into older games.
As I am using a nordic keyboard layout the way to open the Kotor 2 console is to press shift + backtick.
Keep in mind that you have to edit one of the files in the Steam folder to enable cheats for Knights of the Old Republic 2.

The PowerShell code:

# KOTOR 2 Auto Cheater #

# Sendkey functions #
$Backtick = "+(´)"
$Space = " "
$Enter = "{ENTER}"

<# Cheats hard codes from https://steamcommunity.com/sharedfiles/filedetails/?id=149123471
These variable each contains the actual cheat code of choice, giving you a long list of favorite codes.#>
$treat = "settreatinjury 40"
$compuse = "setcomputeruse 40"
$demo = "setdemolitions 40"
$stealth = "setstealth 40"
$aware = "setawareness 40"
$charm = "setcharisma 40"
$wis = "setwisdom 40"
$int = "setintelligence 40"
$const = "setconstitution 40"
$dex = "setdexterity 40"
$str = "setstrength 40"
$sec = "setsecurity 40"
$rep = "setrepair 40"
$pers = "setpersuade 40"
$exp = "addexp 999999"

# List used in loop, here you simply add variables that you want to include in the loop. #
$listofcheats = $treat, $compuse, $demo, $stealth, $aware, $charm, $wis, $int, $const, $dex, $str, $sec, $rep, $pers, $exp

# This function is responsible for opening the console only. One function, one purpose. #
function Open-Console {
[System.Windows.Forms.SendKeys]::SendWait($Backtick)
[System.Windows.Forms.SendKeys]::SendWait($Space)
}

# This function is responsible for using the cheat that was typed into the Kotor 2 console. #
function Send-Cheat {
[System.Windows.Forms.SendKeys]::SendWait($Enter)
}

<# This is a simple one of function, that accurately lets you reuse a single cheat code without the worry of misspelling #>
function Use-Cheat($code) {
Start-Sleep -Seconds 5;
Open-Console;
[System.Windows.Forms.SendKeys]::SendWait($code);
Send-Cheat;
}

# This is is the automatic function, it runs through the entire list you customize in the script. #
function Use-AllCheats {
    foreach ($cheat in $listofcheats) {
        Start-Sleep -Seconds 5;
        Open-Console;
        [System.Windows.Forms.SendKeys]::SendWait($cheat);
        Send-Cheat;
    }
}

Sunday, December 17, 2023

Windows: Automatic login

Introduction

This post will briefly show how you can set up your Windows device to automatically login upon starting the computer, it works for restarts as well.

It consists of two parts, first part is the GUI way and if that way doesn't work there is registry way.

The necessary security caveat:
Do not add this to a computer that can fall into the hands of the wrong person. It will decrease your device security and it is not encouraged, this post simply illustrates how it can be done.

The GUI way

Start netplwiz from either run or PowerShell.

Right away you will see an option "users must enter a user name and password to use this computer".

Uncheck this, confirm with your password. 

If the option is missing you will have to do the registry way instead.

The registry way

Create a registry file with the following text:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device\]
"DevicePasswordLessBuildVersion"=dword:00000000

After you have saved it as a .reg-file, you can run it and it will make the necessary changes.
You can probably see the option now in step one if you are curious.

Give the computer a restart and it should now automatically log you into the user.


PowerShell: Create scheduled task

Case where a scheduled task comes in handy

Lately I've been suffering from a explorer process that is not starting upon boot of the computer.

I log in to Windows and the screen is completely black, apart from the mouse pointer sometimes. I've had this issue on a couple of computers over the years, while it is nothing dangerous and easy to fix, it is still annoying.

The quick fix is easy, start task manager using Ctrl + Shift + Escape and run the new task "explorer.exe".

However, I wanted to explore the PowerShell way of perhaps creating a scheduled task that simply checks if the explorer is running, and if not, apply the quick fix automatically. Also I explored whether I could use .bat-file to run a PowerShell script that registers this scheduled task. Unfortunately, for a quick and safe fix it didn't work, you either have to write a more complicated workaround or run the bat file as an admin, which then introduced some other issues. The goal was to keep it very simple.

The PowerShell script that is a failsafe for the explorer process

The code for the fix script looks like this:

function Start-Explorer {

    Start-Process explorer.exe;

}

$Explorer = Get-Process -Name explorer -ErrorAction SilentlyContinue

if (-Not($Explorer)) {

    Start-Explorer;

}

Manually scheduling a task in taskschd.msc

It is completely fine to save this to a .ps1-file and then manually create a scheduled task. Simply start task scheduler, hit "new basic task" once you are in the main folder of tasks.

Trigger:
Being logging in.

Action:
Start a program.

Program/script:
powershell.exe

The added arguments:
-windowstyle hidden -executionpolicy bypass -scope currentuser "C:\temp\PathToScript.ps1"

Basically this tells the computer that upon login (by the user creating the task), run the specified script while bypassing execution policy and only for the user, this time.

Scheduling a task using PowerShell, the basics

This is the very basic method of a PowerShell script that is intended to register a task in the task scheduler. When I tried dot sourcing it, it failed to bypass the execution policy and when I dot sourced it as an admin it created a scheduled task for all users of the computer. This could probably be altered with more detailed parameters and a permanent fix of the execution policy, but it is beside the point of this post. The point of this segment is to show the basic mechanics of using PowerShell to schedule a task.

$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-executionpolicy bypass -file `\"C:\Temp\Sample.ps1`\""
$trigger = New-ScheduledTaskTrigger -AtLogon
$task = New-ScheduledTask -Action $action -Trigger $trigger
Register-ScheduledTask NameOfTask -InputObject $task

As you can see it is a quite interesting and straightforward mechanic.

  1. The very first step is that you tell the computer what to do, in this case run a script with a few parameters, the extra symbols in the file path helps to character escape the extra quotes.
  2. Secondly you tell the computer when to do it, the trigger, in this case upon logging in.
  3. Third you combine the what and when into a task variable.
  4. Lastly you register this task, giving it a name and supplying the task variable to the cmdlet.
When working with PowerShell and the task scheduler, you can of course supply much more details, for example which user should be affected. However, from what I could see you are required to run this script as an admin if you want to run it from the console (dot sourcing).

Creating a .bat-file that runs a PowerShell script

As an added bonus and to wrap up the post of today, I will show you a simple way to use a bat file to kickstart a .ps1-file, with supplied parameters like execution policy bypass.

Open notepad, create a file with the following command:

powershell.exe -ExecutionPolicy Bypass -File .\ScriptInSameDirectory.ps1

You can add parameters like 
-nologo 
-windowstyle hidden 
-executionpolicy bypass and to specify current user add -scope currentuser

Note that if the .bat-file is not in the same folder as the target .ps1 you need to specify full path.

Good luck!

Thursday, December 7, 2023

Review: Alogic MX3 Docking station

A while back ago I got an Alogic MX3, it is a docking station with 3 displayports that I use to connect both my work computer and personal computer.

They are both connected using a USB-C cable to the dock, so when my work day is complete I can connect my personal computer instead.

So far I am rather okay with it, but I've noticed some unfortunate characteristics.

It is too underpowered to reliably power my Surface Pro 7, my Surface Dock 2 does not have that issues. The symptom is that the Alogic MX3 dock does show content on all three monitors but it doesn't charge the battery. Peripherals does not seem to be affected. 

When switching from my work computer to my personal computer it sometimes does not activate my third monitor as well.

The solution to the power issue is to turn the dock off for a few seconds and then turn it on again, that way it seems to start charging the computer again. As for the monitor issue it is simply a matter of extending the screen again to the third monitor.

The over all impression is that the dock looks good, has the right ports for my needs, is easy to work with but I would not recommend a purchase due to the quality of life issues I am experiencing.

Sunday, November 26, 2023

Cryptography: Enciphering with PowerShell

The idea came to me after having followed some ARG's (alternate reality games), where people solve puzzles, often decoding some enciphered texts using more or lesser known cipher techniques, such as the classic Caesar Cipher, where you shift a letter in the alphabet a number of steps.

I wanted to see if I could create a script in PowerShell that would perform this action, after prompting ChatGPT a bit I managed to get the main logic behind the shifting.

This was put into an encoding function and a decoding function. Later on after the script matured, I decided to create a basic GUI for it, based off of the simple password generator I had created earlier.

This version offers you case cleaing, optional clipboard copy and decoding/encoding. In the future there might be some error handling put into the code, such as handling empty text fields.




This is what the code looks like:

# Caesar cipher /w GUI #


[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")


$Main = New-Object System.Windows.Forms.Form

$Main.text = "Caesar Cipher 1.1"

$Main.size = New-Object system.drawing.size(600,200)

$Main.BackColor = "DarkGray"

$Main.FormBorderStyle = "FixedDialog"


$PlainText = New-Object System.Windows.Forms.TextBox

$PlainText.Size = New-Object System.Drawing.Size(400,100)

$PlainText.Location = New-Object System.Drawing.Size(50,30)

$PlainText.BackColor = "Black"

$PlainText.ForeColor = "LightGreen"

$Main.Controls.Add($PlainText)


$CipherText = New-Object System.Windows.Forms.TextBox

$CipherText.Size = New-Object System.Drawing.Size(400,100)

$CipherText.Location = New-Object System.Drawing.Size(50,50)

$CipherText.BackColor = "Black"

$CipherText.ForeColor = "LightGreen"

$Main.Controls.Add($CipherText)


$Clipboard = New-Object System.Windows.Forms.CheckBox

$Clipboard.Size = New-Object System.Drawing.Size(80,40)

$Clipboard.Location = New-Object System.Drawing.Size(50,75)

$Clipboard.Checked = $False

$Clipboard.Text = "Clipboard"

$Main.Controls.Add($Clipboard)


$CipherKey = New-Object System.Windows.Forms.TextBox

$CipherKey.Size = New-Object System.Drawing.Size(30,50)

$CipherKey.Location = New-Object System.Drawing.Size(140,87)

$CipherKey.Text = "1"

$Main.Controls.Add($CipherKey)


function Encode-CaesarCipher {

    param ($pt, $ck)

    $pt = $PlainText.Text;

    $ck = $CipherKey.Text;

    $e = ""

    foreach ($c in $pt.ToUpper().ToCharArray()) {

        $x = [int][char]$c

        if ($x -ge 65 -and $x -le 90) { $e += [char](65 + (($x - 65 + $ck) % 26)) }

        elseif ($x -ge 97 -and $x -le 122) { $e += [char](97 + (($x - 97 + $ck) % 26)) }

        else { $e += $c }

    }

    $CipherText.text = $e

    if ($Clipboard.checked) {$e | Set-Clipboard}

}


function Decode-CaesarCipher {

    param ($ct, $ck)

    $ct = $CipherText.Text;

    $ck = $CipherKey.Text;

    $m = ""

    foreach ($c in $ct.ToUpper().ToCharArray()) {

        $x = [int][char]$c

        if ($x -ge 65 -and $x -le 90) { $m += [char](65 + (($x - 65 - $ck + 26) % 26)) }

        elseif ($x -ge 97 -and $x -le 122) { $m += [char](97 + (($x - 97 - $ck + 26) % 26)) }

        else { $m += $c }

    }

    $PlainText.text = $m

    if ($Clipboard.checked) {$m | Set-Clipboard}

}


$EncodeButton = New-Object System.Windows.Forms.Button

$EncodeButton.Size = New-Object System.Drawing.Size(60,40)

$EncodeButton.Location = New-Object System.Drawing.Size(180,87)

$EncodeButton.Text = "Encode"

$EncodeButton.BackColor = "Green"

$EncodeButton.ForeColor = "Yellow"

$EncodeButton.Add_Click({Encode-CaesarCipher;})

$Main.Controls.Add($EncodeButton)


$DecodeButton = New-Object System.Windows.Forms.Button

$DecodeButton.Size = New-Object System.Drawing.Size(60,40)

$DecodeButton.Location = New-Object System.Drawing.Size(250,87)

$DecodeButton.Text = "Decode"

$DecodeButton.BackColor = "Green"

$DecodeButton.ForeColor = "Yellow"

$DecodeButton.Add_Click({Decode-CaesarCipher;})

$Main.Controls.Add($DecodeButton)


[void] $Main.ShowDialog()

Friday, October 6, 2023

Keyboard: Remapping function keys

Looking at my keyboard I was wondering if there was a way for me to change the built in functions of the keyboard such as "open default mail app" or "play/pause music".

Seems like there is a way by editing the registry.

The following way will change the settings for all users of the computer, and as always, the registry is a dangerous place to edit if you aren't careful.

1. Open regedit as administrator and go to the following adress:  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\

2. You will see numbered folders (called "keys"). Folder number 16 is your media player, in my case it was preset to open Windows Media Player. Thus a good candidate to be replaced.

3. Within the folder of your choice create a string value (REG_SZ) called ShellExecute.
Open that file up and set its value to a path leading to your program, put within quotation marks.
In my case I chose the path to PowerShell: "C:\Program Files\PowerShell\7\pwsh.exe"


In my case the effect was immediate, no restart was required. However, the day after it was not working as intended. It seemed to be working only if I had an admin session of regedit open. Trying to add it to Current User hive did not seem to work either.

We know that folder number 16 equated to the media button. What other buttons might there be?
Well this article lists all the potential numbers, obviously your keyboard might not have the email button and you might not be able to remap the email button to another program. I only chose to inspect/modify the already existing registry keys (15, 16, 17, 18, 7) instead of creating new ones.

Based of the article we can see the following examples of registry keys and their inherent functions:

1 = Browser navigation backward, 2 = forward, 3 = refresh, 4 = stop, 5 = search, 6 = favorites, 7 = home.

8 = mute volume, 9 = volume down, 10 = volume up, 11 = next track, 12 = previous track, 13 = stop, 14 = play/pause

15 = mail, 16 = media, 17 = app 1, 18 = app 2, 19 = bass down, 20 = bass boost, 21 = bass up, 22 = treble down, 23 = treble up

The numbers are arbitrary, you have to look where the functions are located physically on your keyboard. In my case the number 16 (media) was located on fn + escape. Thus, when I pressed fn + escape it started my PowerShell window. Beware, it seems to be unstable and might stop working for you though.

Here is the reg file content that you can work with, as you can see I experimented with Current User.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AppKey\16]
"ShellExecute"="C:\\Program Files\\PowerShell\\7\\pwsh.exe"

Enjoy!

Tuesday, September 19, 2023

Maintenance: Updating your Surface Pro 7

In my job I have been updating a few docking stations with fresh firmware. Personally I find it to be a nice little routine to keep the firmware and software up to date, like putting things to order.

For example there is firmware for both Lenovo and Dell docking stations, and keeping that in mind I was looking for a way to update the firmware for my Surface Dock 2.

Updating your Surface Dock 2:
The easy way is to use the Surface app, downloadable from the Microsoft Store.
After installing it and opening it, you get an easy to use menu. You can interact with your dock, mouse and pen for example.


By clicking clicking on the dock you can make sure that your firmware is up to date. There you can also turn different ports on and off.

For someone that would need a manual update, it seems like Microsoft offers a few versions as well, based on your device.

Updating your Surface Pro 7 drivers:
You can also update the driver kit with a roughly 600 mb sized file with all the drivers. 
To download it go here.

Running a diagnostic toolkit to identify errors:
You might also want to grab the Surface Diagnostic Toolkit, it let's you test the functionality of your device, a great tool for singling out various issues that you might have with your computer.
To get the toolkit, go to this link.

Now you have been provided with some simple and easy to access tools to service your device.

Sunday, September 17, 2023

Hardware: Finding device info using PowerShell

The hunt for more information began with a new keyboard I have. A wireless keyboard called "Deltaco TB-632". As an avid Deltaco fan I also knew that they rarely make their own products, but they rebrand devices that they source from other companies.

One example is their smart home devices that in at least one case seems to come from China.

So how did I go about finding more information about this keyboard? Well, old trusty PowerShell of course. After first trying to find a way using the control panel and settings to see a MAC address or other identifying information I simply turned to the command Get-Pnpdevice.

If you run this command you will discover practically all devices that has been connected to the computer since the last OS installation. They will be listed as Unknown if they aren't connected and OK if they are working fine.

This is the main code I ran: get-pnpdevice -Class USB | Select-Object status, friendlyname, instanceid | Sort-Object -Property friendlyname

First I ran the command without the USB wireless receiver attached.

Then I attached the receiver and ran the command again. By doing this I could see which device that turned from Unknown to OK.

In this specific case I got a result looking like this:

OK USB Composite Device USB\VID_248A&PID_8367\5&194485C0&0&1

Now that you have the VID (vendor ID) and PID (device ID) for your device you can simply Google these identifiers.

My result indicated that the Deltaco TB-632 seems to be provided by the company Maxxter and the USB device is called Telink Wireless Receiver.

Using the same method I tried looking for the keyboard unit itself as well in the list of PnP devices. I tested this theory by running the following command without and with the device plugged in.

(get-pnpdevice -Status OK).Count



The result was that 8 devices appeared when the receiver was plugged in.

To find out which devices that make up the difference you can combine Get-Pnpdevice with Compare-Object. Adapt the code after your individual situation.

First run this code with the device in:
 get-pnpdevice -Status OK | Sort-Object ClassGuid | Out-file -FilePath C:\temp\dev1.txt

Then run this code with the device out:
get-pnpdevice -Status OK | Sort-Object ClassGuid | Out-file -FilePath C:\temp\dev2.txt

To then compare the output run this comand:

Compare-Object -ReferenceObject (Get-content -path C:\temp\dev1.txt) -DifferenceObject (Get-Content -Path C:\temp\dev2.txt)

The output will look like this, the arrow shows that the result is present in the reference object, which in this case was to the left and missing in the difference object to the right, which means that they disappeared when we unplugged the device.


From here you can then investigate further from the VID and PID that you get.

Happy hunting :-)


Wednesday, August 30, 2023

Domain: Purchasing a new one

When I first started this blog I had to get a domain name in order to attach a more personal URL to my blog.

As time went by I realized I wanted a .se domain but it was already taken.

If you find yourself in the same situation you can go to who.is and search for the domain you want.

Here you will see how long it has existed for, when it is bound to expire and most importantly when you can buy it.

The release date is also the day when you can purchase it on, I contacted the current host just in case but they could not provide me with much more information than what is already public.

Next I went to the organisation that is responsible for the .se top domain. Here I received information about which hour it is released. In my case very early in the morning (even with the summer time).

Now it was just a matter of waiting until the right time, I tested two hosting providers but they were not synced. Finally I found a Swedish provider where I could buy the domain with no issues.

So my advice is: do your research, set your calendar and alarm, and make sure your credit card is working.

Saturday, July 1, 2023

CMD: Access files without logging in

If you are locked out of your computer and you still want to access the system you can follow these steps.

Most likely you will be locked out from C: drive where your personal data might be stored due to Bitlocker, but this is how you can browse around and find out.

Shift click on restart, go to troubleshooting and advanced tools. Choose the command prompt.

Now you have an administrative prompt starting in the X: drive, here are a few things you can explore.

  • Run wmic logicaldisk get name to find out what drives there are, you can even access a connected USB drive this way. Take note of the name if you want to use it.

  • You can explore other drives by running cd /d d: for example, where d: is the other drive, in this example the USB that I connected.

  • Use the command dir to list all the directories and files in your current folder. Use cd to get the name of your current location.

  • You can navigate by supplying the full path, or the next directory.
    Example: cd d:\folder\folder2

  • To go back up one level use the command cd .. 

  • In this administrative prompt you are actually running an instance of Windows PE, a light-weight OS, also known as Windows Preinstallation Environment. It has limited functionality.
    You can still use the command prompt to start basic programs such as taskmgr, notepad and regedit.

    You can use notepad to edit and save scripts on your USB. First navigate to the right directory, then pick the program and file as shown below.

    Example: notepad myscript.bat

    From task manager you can trigger "run" as well, but executables such as powershell.exe are not available. Nor can you bring a copy of Powershell with you on the USB.

  • You can run batch files, .bat, from your USB. Just navigate to the directory and write the name of the script.

    This is an example of how you can extract data from the registry and save it to your USB using a batch file. Put this code in a text file and save it as a .bat file.

    Make sure that you replace D:\ with whatever drive your USB is.
@echo off
    setlocal
        cd /d D:\
          echo %cd%

              :PROMPT
                SET /P RUSURE=Are you sure (Y/N)?
                  IF /I "%RUSURE%" EQU "N" GOTO END
                    IF /I "%RUSURE%" EQU "Y" GOTO PAYLOAD

                        :PAYLOAD
                          reg save hklm\sam ./sam.save /y
                            reg save hklm\system ./system.save /y

                                :END
                                  endlocal

                                  • Finally, to clear text use cls and to exit the prompt window use exit, which will return your to the recovery environment. From there you can return to the normal OS.

                                  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!

                                  Tuesday, June 6, 2023

                                  PowerShell: Creating Forms

                                  To create a simple GUI you can use Windows Forms, I've previously written a post on how I created a simple game using PowerShell and Windows Forms.

                                  In this post I will rather talk a bit about the different components available, in the form of a reference guide for building various GUI-oriented scripts.

                                  If you have worked with Tkinter in Python, you might be familiar with the concept of putting layer upon layer, or boxes within boxes, placed with a coordinate system. It's helpful to know but not at all a requirement. Let's dig in!

                                  For some forms it is helpful to enter this at the start:

                                  [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

                                  Main window

                                  For a basic app you will need a mothership that contains all the other elements such as buttons, boxes, text fields, images and the like. At the end you will also need activate the main window. The concept looks like this:

                                  $MainWindow = New-Object System.Windows.Forms.Form
                                  $MainWindow.text = "Stock Price Calculator"
                                  $MainWindow.size = New-Object system.drawing.size(700,440)
                                  $MainWindow.FormBorderStyle = "FixedDialog"

                                  <Other code goes here>

                                  $MainWindow.add_shown({$MainWindow.activate()})
                                  [void] $MainWindow.ShowDialog()

                                  In this example I've given the main window the variable name $MainWindow for the sake of simplicity. Add a dot to add additional attributes, such as .StartPosition = "CenterScreen".

                                  Labels

                                  Labels are pieces of text that describe something. Normally not something you want the user to interact with. It could for example describe what a textbox should contain. The location system is (x,y) where a lower x goes left and a lower y goes up. These numbers can be variables that you define outside the object. For example (($winwidth-100),($winheight-50)).

                                  As with the main window variable, we can give labels a variable name. 

                                  $Label_CurrentStock = New-Object System.Windows.Forms.label
                                  $Label_CurrentStock.Location = New-Object System.Drawing.Size(100,222)
                                  $Label_CurrentStock.Size = New-Object System.Drawing.Size(140,20)
                                  $Label_CurrentStock.BackColor = "Gray"
                                  $Label_CurrentStock.ForeColor = "Black"
                                  $Label_CurrentStock.text = "Current amount of stock"
                                  $Label_CurrentStock.textalign = "MiddleCenter"

                                  In order for the object you create to show up on the main window add the following code. With the variable names that you use for your main window and object you are adding.

                                  $MainWindow.Controls.Add($Label_CurrentStock)

                                  Textbox

                                  Textboxes are another object you might want to learn when creating Windows Forms. Just as with labels they are variables containing an object with attributes.

                                  $Textbox_Current_Stock = New-Object System.Windows.Forms.TextBox
                                  $Textbox_Current_Stock.Location = New-Object System.Drawing.Size(100,100)
                                  $Textbox_Current_Stock.Size = New-Object System.Drawing.Size(140,20)
                                  $MainWindow.Controls.Add($Textbox_Current_Stock)


                                  Button with function

                                  You also need intractability built into your script, so that the button for example triggers a calculation and presenting a result in a textbox. You can start off by defining the button, what size, location, color and text for example. Then you attach a function to it that is executed on being clicked.

                                  This example shows a button that takes text from a textbox, makes it uppercase and then replaces the content in the textbox with the modified text. Here the textbox variable is called $TextboxMain and the property .Text is the content.

                                  $ButtonUpper = New-Object System.Windows.Forms.Button
                                  $ButtonUpper.Location = New-Object System.Drawing.Size(150,40)
                                  $ButtonUpper.Size = New-Object System.Drawing.Size(100,200)
                                  $ButtonUpper.TextAlign = "MiddleCenter"
                                  $ButtonUpper.Text = "Upper Case"
                                  $ButtonUpper.Add_Click({$TextboxMain.Text = ($TextboxMain.Text).ToUpper();})
                                  $MainWindow.Controls.Add($ButtonUpper)

                                  You can for example create a status bar in the bottom of your app that you write to in the same function, for example by writing $TextboxStatus.Text = "Text set to upper case"; or perhaps by turning something in your GUI green as a confirmation.

                                  Sunday, June 4, 2023

                                  iPhone: How to downgrade iOS

                                  Prerequisites

                                  If you for some reason want to reinstall the OS manually on your iPhone it is possible. Perhaps you experienced issues with the copy of software that you upgraded to or perhaps you just need get an older version of the OS.

                                  For those that do jailbreaking of an iPhone it requires certain versions of the iOS installed for example.

                                  The important detail is that the software that you install manually has to be signed by Apple. The software is available to download on ipsw.me. There you will see if the software is signed or not. If the version you want is not signed it will not work, there are guides on how to bypass it out there, but I haven't tried them myself yet.

                                  While downloading a copy of the iOS you also need iTunes installed on your computer.

                                  Manually installing iOS

                                  To install the iOS manually you simply connect your phone, put it in recovery mode (each model has a combination of the buttons that you have to press in order to enter "DFU mode"). You will now have the option of "restore" your iPhone. 

                                  Make sure to shift click the restore button in order to manually choose the software that you want to write to the iPhone.

                                  It will then extract and install the software.

                                  Saturday, May 27, 2023

                                  Telnet: A quick overview

                                  Overview

                                  Telnet is a tool for administrating servers remotely. The name stands for Teletype Network and was invented pre-internet. As a consequence it is also an unencrypted way of communicating with a server. It should therefore not be used over the internet as the traffic may be intercepted, for example using Wireshark. 

                                  Apart from servers it can also talk to other equipment such as network switches and routers. If the equipment is old, it might only be able to use Telnet instead of the encrypted tool called SSH (Secure Shell).

                                  It is a command line tool that you can run on Windows, Mac and Linux which communicates bidirectionally. 

                                  From a technical point of view it is a client/server type of protocol. The terminal captures keystrokes, the client converts it to a universal language that then goes through the TCP/IP protocol and through a network virtual terminal which sets a mutual standard for both machines.

                                  It then goes through the TCP/IP stack on the receiving server side, the Telnet server converts/reverses the universal language to a language that the receiving system understands. The pseudoterminal then executes the commands and runs the applications.

                                  Activating and deactivating Telnet Client

                                  On a Windows machine you can activate it by going to the control panel, then select programs and features, then press "turn Windows features on or off".


                                  Another way of activating Telnet is by using an elevated PowerShell prompt.

                                  You can run the following commands to either activate or deactivate Telnet.

                                  Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient

                                  Disable-WindowsOptionalFeature -Online -FeatureName TelnetClient


                                  Using Telnet commands

                                  If you write telnet followed by a target address followed by a space and a port number, you will use a different Telnet version. It can look like this if you try to connect to your local gateway:

                                  telnet 192.168.0.1 23 

                                  If you get stuck on "Connecting to 192.168.0.1..." it means that the port is closed and that Telnet won't work. Use the escape key to cancel. On a US keyboard it is Ctrl + ], on a Swedish keyboard your Telnet escape key is Ctrl + ¨.

                                  Use telnet /? to open some the related help text.

                                  You might experience lag when sending the commands, this is because the keystrokes has to travel back and forth over the network once you are connected via Telnet.


                                  If only you write Telnet, you will instead open the Microsoft Telnet context.

                                  To open a connection:
                                  o google.com 443

                                  To close a connection:
                                  c google.com 443

                                  To quit the Telnet context that you opened, simply use the command quit.

                                  For more commands check the Microsoft page.

                                  Summary

                                  Telnet is an old and insecure way of communicating with servers, routers and switches. It is a text based tool run in the command prompt or PowerShell. Use SSH as a better alternative unless you work with legacy equipment that only can handle Telnet. Telnet is and should be disabled by default unless you have reasons to keep it active.


                                  Thursday, May 18, 2023

                                  ChatGPT: Making YouTube videos

                                  A while back ago I wrote a blogpost in which I laid out a structure for a five part series of YouTube videos that I choose to call PowerShell for Beginners. 

                                  These videos have now been published and looking back at the experience I wanted to write a few lines about it.

                                  First of all, the plan was to set a goal that I knew was possible to reach. One series containing five videos was reasonable and achievable. I also didn't want to let AI do all the creative work so to speak, I still wanted to record a voiceover, create slides and write the manuscript myself.

                                  Instead I let ChatGPT create the topics for each video, with only the content keywords that I then could build manuscripts around.

                                  The process of creating the first video was slow since I was unused to it and was figuring out the way. At the end when I had figured and polished my workflow it looked something like this:

                                  1. Read the chapter guidelines to find out what it needs to encapsulate.

                                  2. Divide the content into chapters while creating the manuscript, so that it is clear what slide contains what information. Make sure to include an intro and an outro text.

                                  3. Create slides using PowerPoint, boiling down the text from the manuscript. Also a chance to make final corrections in the manuscript text as you step through it. Export each slide as a .PNG. At this stage I had created a simple PowerPoint theme to easily reuse the colors and fonts that I like.

                                  4. Record voiceovers, one recording per slide, by reading from the manuscript and make sure it matches the slides. Make any final corrections if you notice any errors. By having one recording per slide you get the chance to rerecord any faulty files without having to redo everything.

                                  5. Using OpenShot video editor I added the images and the sound recordings. Then after some editing I exported it as a video .

                                  6. Upload to YouTube Studio and use the right settings for your content.

                                  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

                                  Sunday, April 30, 2023

                                  Windows 11: Change boot logo

                                  It all started with me wanting to change the boot logo of my Windows 11 computer.

                                  The EFI (extensible firmware interface) is a protected, FAT32-drive with a size of 100 mb that usually is invisible to you in the file explorer. You can however see the partition in Disk management which you access as administrator through the program called Computer Management. At the end of the blog post I will show you how you can access it through PowerShell if you are curious. Always treat this partition with great respect.




                                  My research led me to HackBGRT and here you are offered software that temporarily maps your EFI drive so that you can change the boot logo for one of your own.

                                  How to design the logo


                                  The requirement for the logo is that you have a 200 x 200 pixel image in the format of a 24-bit BMP image. It requires the name splash.bmp and that is has a black background if you want to achieve a "transparency effect", since the boot up background on most computers is black. 

                                  In my experience it was better to have an icon that was wide on top of the square background, rather than trying to have a square icon as the image still became stretched out.

                                  Use HackBGRT to change boot logo


                                  1. Download the .zip and extract it in a suitable folder.

                                  2. Perform a backup of your system through a system restore point, this is because changes in the EFI can destroy your boot up process.

                                  3. Make sure that you've created the image and placed it in a folder that you remember. You also need Paint installed on your computer.

                                  4. Run setup.exe in the HackBGRT folder, accept the UAC prompt and then press I to install the logo.

                                  5. Close the "readme.txt" that pops up, this will now open Paint. Using Paint now go to file and select open.
                                     
                                  6. Now you should have a file explorer window from Paint open. Navigate to your custom logo location, copy it, navigate to "This PC" and you should find a new A: drive. Navigate to the following: A:\EFI\HackBGRT and then paste the custom logo. You are prompted to replace existing file in destination, confirm to continue.

                                  7. Close Paint, exit the setup.exe window and then restart your computer to see if it work.

                                  To restore your logo back to the original you run setup.exe and use R instead. 

                                  Access the EFI through PowerShell

                                  First we need to turn the EFI partition into a visible drive so that it becomes easier to work with.
                                  1. Open an elevated PowerShell window (run as administrator)
                                  2. Write Diskpart to activate the Diskpart program within PowerShell
                                  3. With Diskpart now running use the command and write list disk. This displays your available disks. Take note of with number your main disk has, usually 0.
                                  4. In order to target the right disk, write select disk 0 and get confirmation.
                                  5. In order to target the EFI partition we need to identify it. Write list partition and take note of the number, it is labeled as system type and has the size of around 100 mb. In my case it is partition number 1.
                                  6. To target the EFI partition we now write select partition 1 and get confirmation.
                                  7. In order to actually turn it into a visible drive write assign letter=E or another letter that is not in use.
                                  8. Write exit in order to leave the Diskpart program in the command line.
                                  Continue in the elevated PowerShell window in order to navigate to the EFI drive, you can't access it through the file explorer as it is a FAT32 drive and regular access permissions doesn't seem to work there.
                                  1. Now that you know that the E: drive is the EFI you can use it for the following command.
                                  2. Write Set-Location "E:\EFI\" in order to step into that location.
                                  3. Write Get-ChildItem to list which subfolders exists within that location.
                                  4. Continue to explore subfolders using Set-Location and Get-ChildItem or their aliases sl and gci both which are easier to write but not recommended to use in scripts that are shared.
                                  5. Write exit to close the PowerShell window when you are done looking around. 




                                  Thursday, April 13, 2023

                                  ChatGPT: Generating business ideas

                                  As the rest of the internet citizens I've started looking into ChatGPT and the Bing AI more and more.

                                  Today I wanted to see how it can help me generating business ideas, in this case I used videos on YouTube as an example.

                                  The content


                                  In essence I sent three prompts to it that covered the basics. My first prompt was:

                                  I want to create a five part series (each episode around 15 minutes) on youtube.
                                  The course will be about Powershell and target towards beginners.

                                  Give me 5 topics that these 5 episodes could be about.

                                  My reasoning behind this was that it had to be a reasonable amount of work for me as a person, you might have a full time job or family to take care of for example. I also used something that interests me as a central topic for the video lessons and I made sure to be specific with my target audience.

                                  ChatGPT generated 5 different lesson ideas that I then can curate and improve upon, depending on what I would like to teach and my skillset.

                                  These are the lessons that was suggested to me:

                                  Episode 1: Introduction to PowerShell - In this episode, you could cover the basics of PowerShell, including what it is, why it's important, and how to use it. You could also introduce the PowerShell console and some basic commands.

                                  Episode 2: Variables and Data Types in PowerShell - This episode could cover how to use variables in PowerShell and the different data types that are available. You could also demonstrate how to manipulate variables in PowerShell, such as performing arithmetic operations and string concatenation.

                                  Episode 3: PowerShell Cmdlets - In this episode, you could introduce PowerShell cmdlets, which are pre-built commands that can be used to perform specific tasks in PowerShell. You could cover some common cmdlets and demonstrate how to use them.

                                  Episode 4: PowerShell Scripts - This episode could cover how to create and run PowerShell scripts, which are collections of PowerShell commands that can be executed as a single unit. You could demonstrate how to create a simple script and run it from the PowerShell console.

                                  Episode 5: PowerShell Modules - In this final episode, you could introduce PowerShell modules, which are collections of related cmdlets, scripts, and other assets that can be shared and reused. You could cover how to find and install modules, as well as demonstrate how to use some common modules for tasks such as managing Active Directory or working with Azure resources.

                                  The recording and editing software

                                  In order to do the recording I need software that is free and can add voice over later on in the editing phase. After specifying my requirements to ChatGPT it brought me a suggestion of a software I hadn't heard about before. It is called OpenShot and I downloaded it and I'm going to test it during the day. This is what ChatGPT had to say about it:

                                  One free video editing software that you can use to record your PowerShell lessons and add a separate voiceover track afterwards is OpenShot Video Editor.

                                  OpenShot is a free and open-source video editing software that offers a variety of features, including the ability to add multiple audio and video tracks, transitions, effects, and titles. It supports many popular audio and video formats, so you should be able to import your recordings without any issues.

                                  To add a separate voiceover track, you can simply record your audio separately using a microphone or audio recording software, then import the audio file into OpenShot and place it on a separate audio track. You can then adjust the volume levels and timing to sync the audio with your video footage.

                                  Overall, OpenShot is a good option for beginners who are just getting started with video editing and want a user-friendly interface that is easy to learn.

                                  Monetizing a YouTube channel

                                  It had been a while since I saw the requirements to monetizxe your channel on YouTube. ChatGPT summarized the requirements like this:

                                  - You need 1000 subscribers.
                                  - You need 4000 of watched time in the past year.
                                  - You need to meet the Terms of Service and other agreements of the community.

                                  And this is how you start monetizing the channel:

                                  - Go to the YouTube Studio dashboard.
                                  - Click on "monetization" in the left sidebar.
                                  - Follow the steps to accept the conditions of the YouTube Partner Program (YPP).
                                  - You need an AdSense account and like it to your channel, this will give you payment for ads that are viewed on your videos. You will receive payments when your application is approved.

                                  You can also earn money on YouTube through merchandise, affiliate marketing, sponsors and YouTube Premium revenue.

                                  Thursday, April 6, 2023

                                  Review: NOS K-600 Gaming Keyboard

                                  Overview

                                  Recently my second hand bought NOS K-200 Mini broke when I was vacuuming it and a key broke when I tried to remove it so I had to buy a new for my computer. 

                                  First I went and got a NOS C-650W Compact it had smooth key presses and an option for wireless connection. However, it was missing easily accessed keys that I usually use when I play World of Warcraft, so I returned the keyboard and finally got myself a NOS K-600 Keyboard Core RGB. Which is also the keyboard I will review.

                                  It uses a fixed cable to power itself which leads into a regular USB-connector, which I use connected to my Surface Dock 2. The response time is great and it's not excessively noisy when writing, but it is noisier than C-650W for sure and the key presses aren't as smooth. Compared to K-200 it is a bit smoother in both noise and key presses. Furthermore the keys are relatively elevated, compared to flatter keyboards.

                                  The keyboard is pretty much a full size keyboard, it has a numpad, a media control and some quick access buttons top left. I saw a similar model where these hotkeys were too closely located to the "esc" button. Which can cause issues in gaming if you accidentally start up other programs.

                                  A unique feature for this keyboard is the phone holder at the front, it can keep my Xiaomi Redmi 10C standing up right (but it seems to struggle a bit). I can unfortunately not have the phone sideways due to the case I use for the phone.

                                  RGB light and functions

                                  The keyboard also has a RGB backlight which both looks good and helps you to navigate when it's dark in the room. You can use the Fn combined with the following buttons to control the light.

                                  M1 = constant or pulse light.

                                  M2 = to choose either left or right moving waves of light.

                                  M3 = toggle between fixed lights, such as cyan, violet, pink, white, red, yellow, greenish yellow ("chartreuse") and green.

                                  M4 = change between different pulses of color.

                                  Combine Fn with the arrow keys to control intensity of the light and the speed of the pulses.

                                  The media center has the classic "stop", "previous track", "next track" and "play/pause" icons. It also has a scrolling wheel that allows you to increase and decrease the volume. I like that feature a lot, it's easier to use than repeatedly pressing a volume up/down button. 

                                  There is also a way to program your own light setup using the G1 button (PgUp).

                                  If you press Fn + Windows Key, you lock the key. Press the combination again to unlock it.

                                  You can switch WASD for arrow keys using Fn + W, and once more to turn the function off.

                                  Overall impression

                                  The keyboard measures 45 cm wide and close to 18 cm long, including buttons its almost 4 cm tall on the tallest place. There is a lot of extra unused space on the keyboard and it could in my opinion be flatter.

                                  It has a nice feel to it though, combining the classic "plastic" feel of office keyboards, with the functionality and looks of a gaming keyboard. From a writing point of view I transitioned to it easily, likewise with the gaming.

                                  It costed roughly 500 SEK and you get what you pay for so to speak, overall a decent keyboard that performs well and takes up a bit of space.


                                  Sunday, April 2, 2023

                                  Review: Microsoft Edge

                                  So it is time to take a look at  Microsoft Edge and give it a chance as my daily driver browser.

                                  I'm traditionally and since many years a avid Firefox user. It has been my primary web browser since many years now, it feels like I have used Firefox for the past 10 years at least.

                                  Design, speed, privacy has been a few of the keywords that made me choose Firefox above Chrome, until recently it has been my go to browser in my private life. For work I've used Microsoft Edge for the past three to four years. Let's be honest, a lot of the reason why I've stuck with Firefox is also habit.

                                  Some things I liked with Firefox, that is not necessarily exclusive to that specific browser is the sync between computer and phone. It also has a generally nice password manager that is easy to use. It also felt good standing up to the big corporations. As of late I also discovered the nightly version, which basically keeps the browser with the latest consumer available updates at the expense of a few bugs (but seeing as it is my private browser it doesn't impact my browsing experience).

                                  I'm not leaving Firefox, but I might be moving over to Microsoft Edge and here is why:

                                  With the recent rise of AI-based search engine improvements for Bing, it has created a really nice search experience. This in conjunction with the Microsoft Rewards has become a feedback loop. I use the search more and sometimes make use of the AI chat to get the right information. From the reward redeeming page I could calculate (based on one product) that 145 points equals 1 SEK. Remember that you also get points from searching in your phone, the easiest way to get points is to just make Bing your default so that the point keeps stacking up "passively".




                                  Since I am making it my main browser I also had to import favorites and passwords, something which you easily do these days. Remember to also start syncing your data so that it is accessible in your phone.

                                  Converting to a new browser religion also includes using the mobile app. Here I opted for the dev channel, simply out of curiosity. This is also where I have had the most issues with Microsoft Edge. The starting page is giving me the wrong temperature unit (showing Fahrenheit when I want Celsius) and there are also no extensions for the phone app. Which means that you can't use an adblocker like you can on Firefox mobile. So Firefox mobile is still my go to app when it comes to listening to long Youtube videos. On the computer there are a few addons and themes for the Edge browser, but you can also use the Chrome Web Store since the addons and themes are compatible with the chromium based browser Edge.

                                  It also feels better when the choice is mine, and it is not a preloaded default. Setting Edge as my default and go to browser was my decision. So far I'm giving it 8/10 compared to 10/10 for Firefox. It seems marginally lighter on the resources as well.

                                  Hope you found the review interesting, thank your for reading it.

                                  Sunday, March 5, 2023

                                  Review: Deltaco Smart Home

                                  Making your home smart is fun but not necessarily needed, at least yet. Bringing new functions and perhaps efficiency to your daily life is a welcome bonus.

                                  While we could spend an entire post discussing different automation ideas and the future of the smart home, this post is meant to simply review the products of the manufacturer Deltaco that I'm currently using.

                                  The camera SH-IPC09 is the latest addition. I bought it on the second hand market for close to half the price. I was happy with the image quality, it also offers unique mounting methods, for example with a magnet socket. The camera uses an internal battery that seems to have a fantastic battery life and it's easy to connect to when not at home.

                                  The door sensor SH-WS02 is a device consisting of two parts essentially (+ a part that keeps the sensor on the wall). The sensor reports whenever the magnet and the sensor is separated or close to each other. You can set this up for simple notifications or more advanced triggers such as turning the lights on.

                                  The smart plug SH-PS01 is a socket that you put in the electrical sockets in the wall for example. It allows you to remotely turn the electricity on or off. You can also use it with additional triggers.

                                  In my collection I also use regular smart bulbs, I found these to perform best with white light (both warm and cold). The colors are great but a bit weak in their output. You can schedule these lights and use triggers with them as well. 

                                  One thing that you have to keep in mind is that the devices across the board are reliant on wifi. I changed network SSID (the name displayed in the list of available networks) and then I had to reconfigure them. A simple task, but noteworthy nonetheless.

                                  It's also important to keep device compatibility in mind, the Deltaco products are in large compatible with Google Home and based off of Tuya protocol which means Tuya can control the devices, but not necessarily the other way around.

                                  I have yet to test all the functions when being away from home, but the camera has performed above expectations. Management is done through the phone app (in my case Android).

                                  Sunday, February 19, 2023

                                  Tech: A few thoughts on the current state of AI

                                  The essential caveat

                                  At this point in time, and at least in my filter bubble, there has been a lot of discussion about ChatGPT, GPT-3.5, the advancements in AI and of course the implications on humanity.

                                  It takes a while for a person to build their own opinion and I can't say that I have fully made up my mind either. It feels like it would not be wise to take a definite stand as I simply can't know everything there is to know about AI.

                                  The meta perspective

                                  AI technology is not something new and nor are chatbots. Back in the days of MSN messenger for example, there were rudimentary chatbots such as SmarterChild

                                  However, ChatGPT and the like offers a richer experience, the simplest of chatbots can be a "if then clause" while ChatGPT can create solid content. 

                                  Even if technology is new, useful and cool, such as AR glasses or VR headsets they don't necessarily get adopted by everyone. There is for example a price threshold keeping people out of the VR market. Sometimes the product is impressive but simply not useful.

                                  The mainstream use of horses was replaced with cars and trains one might say and we never went back to the older generation of technology so to speak. In the same manner I believe that these advanced chatbots will replace certain segments of the world and reinforce others.

                                  So from a meta perspective, we might see a wider adoption rate as long as the products are free, useful and easy to use. To at least some this will be a tool to have in the toolbox and a skill to become better at.

                                  In order to not fall behind in the rapid development of tech we need to at least use the tech as regular people, not necessarily do the programming ourselves. Ask yourself in what area of your life you can use this as a tool.

                                  AI generated text and images

                                  There has been AI generated images circulating the internet before and now it has reached the mainstream (again). People are rushing to explore the technology and some even try to cut out a business using this technology.

                                  It is impressive how good some results are but it also stands clear that we still can spot the difference between what is computer generated and not. 

                                  In regards to the role in academics we might see a conflict between the old ways and the new ways, yet new technology won't just disappear because the old ways wills it. Some might struggle a bit and focus more on detecting the use of AI while others will embrace it and make it a part of learning.

                                  There is great the debate about how the future will look like, will AI take over? We do not know, but we see more and more how we integrate the technology into our lives and society. Not learning the basics of complementary AI is to isolate yourself from what is to come and truly make yourself vulnerable.

                                  Those that take part and try things out will be more comfortable with the technology and will have an easier time telling the difference between the bad and the good tech.

                                  The future

                                  Let's say your are using this technology, perhaps just asking the chatbot to solve programming challenges or enhance your browsing experience. You are outsourcing a part of your mental activity, just like we've outsourced calculations, navigation, memories and other things that once were a natural part of our day to day lives. Don't forget that we've outsourced cleaning and washing with the helps of machines before the advanced chatbot era. Will we end up with more sparetime? What will be the next thing that we outsource? What will become of us?

                                  We can also ponder the technological development - what happens when computers become even more efficient - such as the quantum computer, or if we attach the AI to robotic bodies that can do more than just write words and create images? What role will these things have in our ambition to move into space on a greater scale?

                                  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, January 8, 2023

                                  Live OS: Running Kali Linux from USB

                                  When you run an operative system from a USB drive it can be referred to as running a live OS.

                                  The OS then uses the hardware from the computer and can also save settings on the USB. When your data is saved between reboots it is called persistence. 

                                  I used the Kali Linux Live ISO from this page. It is a 64-bit version.

                                  First time I attempted to flash the .iso I used the tool Balena Etcher, it worked just fine until I tried to download and update packages using sudo apt update && sudo apt upgrade as it was complaining about storage. I was a bit perplexed as I had at least 50 gb available.

                                  After a while I figured out that the flashed Kali Linux Live image only was partitioned to a small part of the USB drive.

                                  So I downloaded and ran Rufus instead, which allowed me to reserve even more "usable" space for my OS on the USB drive. This time I started running the updates and the upgrades in the terminal and it worked perfectly fine.

                                  With both Balena Etcher and Rufus my settings were saved as I changed the looks of the OS. Keep in mind that when you boot from the USB you will get the option to start a session which will not be saved, or a persistent session which will indeed save your changes.

                                  When you do live booting from a USB, you sometimes need to turn of the secure boot in your computers BIOS. You do that by entering the BIOS/UEFI as the computer starts up and asks you to press one of the f-keys.

                                  Apart from now being able to use almost any computer, only by carrying your USB with you, you can also access the files that you would typically access from Windows. Thus allowing you to rescue files for example if the Windows system breaks down.

                                  Currently I keep a USB with software that is good to have, such as a few browsers, PowerShell 7 and the like, along with a drive containing a Kali ISO that can be installed on a computer and a drive with Kali for live booting.