Remote Desktop Shadow Session with Saved Credentials

Remote Desktop Shadow Mode allows administrators to remotely view and/or interact with the user’s desktop.

To connect shadow session, /prompt option is needed because mstsc.exe tries to connect to client with the current user credential.

However, with /prompt option, mstsc.exe always requests a user credential to connect and it cannot be bypassed with saved one.

CredentialUIBroker

This credential window is not a standard WIN32 window but a XAML UI, thus it can be manipulated via UI Automation.

AutomationId and ClassName of Fields

Root NanoPi R5S Android

Android can be installed to recently launched Nanopi R5S model.
However it was not rooted initially and you can check it via termux or root checker.

termux
root checker

How to root.

1. Download USB image from FriendlyElec google drive.
2. Extract boot.img.
3. Patch boot.img with magisk.
4. Replace patched boot.img with original one.
5. Flash patched image with rkdevtool.

FriendlyElec google drive
extract boot.img
patch boot.img with magisk
flash patched image with rkdevtool
done

Change Registry Permission with PowerShell

# Save target key with takeownership right
$targetkey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells\AvailableShells", [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree, [System.Security.AccessControl.RegistryRights]::takeownership)

# Obtain access control, owner, and rule of target key
$targetac = $targetkey.GetAccessControl()
$targetowner = $targetac.GetOwner([System.Security.Principal.NTAccount])
$targetrule = $targetac.GetAccessRules($true, $true, [System.Security.Principal.NTAccount])

# Obtain access control, owner, and rule of normal key
$adminac = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\").GetAccessControl()
$adminowner = $adminac.GetOwner([System.Security.Principal.NTAccount])
$adminrule = $adminac.GetAccessRules($true, $true, [System.Security.Principal.NTAccount])

# Set owner and permission of target key
$targetac.SetOwner($adminowner)
$targetac.SetAccessRule($adminrule.Item(0))
$targetkey.SetAccessControl($targetac)

# Change key from 40000 to 20000
Rename-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells\AvailableShells" -Name 40000 -NewName 20000

# Restore owner and permission of target key
$targetac.SetAccessRule($targetrule.Item(2))
$targetac.SetOwner($targetowner)
$targetkey.SetAccessControl($targetac)

Bluetooth Audio of Windows Server 2022 on Deskmini A300

0. Uninstall Intel Bluetooth Driver.
Bluetooth Audio Device does not work properly under Intel Bluetooth Driver when Windows Server is installed.

1. Install latest Toshiba Bluetooth Stack.
https://dynabook.com/assistpc/download/modify/soft/btswt/index_j.htm

2. Set the driver manually.
During installation, Setup would fail to detect Bluetooth Device.
Then, right click on Unknown Device → Update Driver → Browse my computer for driver software → Let me pick from a list of device drivers on my computer → Choose USB Bluetooth Driver-2 (V2.1+EDR)

3. All done.
Audio output will come through the paired Bluetooth device.

Install Windows Server 2022 on Deskmini A300

INSTALLATION:
1. Boot with Windows Server 2022 DVD or USB.

2. OPTIONAL – Load RAID driver if RAID is configured. [Floppy(v0.0.0.000).zip]
: Load AMD-RAID Bottom Device driver (rcbottom.inf) first and then load AMD-RAID Controller driver (rcraid.inf).

3. OPTIONAL – Press shift-F10 and create vhdx for windows to be installed on virtual disk.

4. Start Install.

DEVICE MANAGER:
1. Install Windows 11 VGA driver. [AMD_VGA(v00.00.00.00).zip]
: Do not launch .exe directly.
: Instead, navigate to \AMD_VGA(v00.00.00.00)\Packages\Drivers\Display\WT6A_INF and click the right mouse button, then choose install.

2. Install Windows 11 Chipset driver as usual. [Chipset(v0.00.00.000).zip]

3. Enable Windows Audio and Windows Audio Endpoint Builder services.
: Next, Install Windows 11 Audio driver as usual. [Realtek_Audio(v0.0.00.0).zip]

4. OPTIONAL – Install Windows 11 Bluetooth driver as usual. [Intel_Bluetooth(v00.00.0.0).zip]
: Next, set Microsoft Personal Area Network Service driver manually.

5. OPTIONAL – Add WLAN feature via Server Manager.

: Next, reboot once -> enable WLAN service.

: Install Windows 11 WLAN driver as usual. [Intel_WLAN(v00.00.0.00).zip]

6. Set GPIO Driver.
: AMD GPIO Driver can be installed manually by updating Unknown Device (Microsoft ACPI Complaint System).
: Driver files are under ASROCK support page. [AMD All-in-1 with VGA driver, AllIn1(v00.00.00.00).zip]

ALL DONE:

How to set up Apache on Armbian

1. Install apache and php
sudo apt install apache2
sudo apt install php

2. Enable user directory
sudo a2enmod userdir
in /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/userdir.conf userdir.conf
(for CentOS, edit /etc/httpd/conf.d/userdir.conf)

3. Remove Indexes for securiety in /etc/apache2/apache2.conf
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

4. Enable php engine for user directory in /etc/apache2/mods-enable/php7.3.conf
<FilesMatch “^\.ph(ar|p|ps|tml)$”>
# Require all denied
</FilesMatch>
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
# php_admin_flag engine Off
</Directory>
</IfModule>

Slow Down Host Network with Hyper-V External Network Switch

Problem:
If external virtual switch is created on Virtual Switch Manager, network performance of host network is significantly decreased. Internal virtual switch is not affected.

Solutions:
1. Using ICS of host network
https://www.technig.com/connect-hyper-v-machines-to-internet/

2. Using RRAS for NAT configuration
https://www.dell.com/support/kbdoc/en-us/000118763/configuring-windows-server-2012-r2-as-a-router

3. Disabling VMQ and/or RSC
https://www.dell.com/support/kbdoc/en-us/000145221/windows-server-slow-network-performance-on-hyper-v-virtual-machines-with-virtual-machine-queue-vmq-enabled
https://docs.microsoft.com/en-us/windows-server/networking/technologies/hpn/rsc-in-the-vswitch

For VMQ:> Set-VMNetworkAdapter –ManagementOS -Name -VmqWeight 0
For RSC:> Set-VMSwitch -Name vSwitchName -EnableSoftwareRsc $false

4. Using NAT via Powershell
https://petri.com/using-nat-virtual-switch-hyper-v
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network

New-VMSwitch -SwitchName “NATSwitch” -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceAlias “vEthernet (NATSwitch)”
New-NetNAT -Name “NATNetwork” -InternalIPInterfaceAddressPrefix 192.168.0.0/24

Install Windows Server 2019 on Deskmini A300

0. Create VHDX for Windows Server (optional)

D:\vhd>diskpart

Microsoft DiskPart 버전 10.0.19041.610

Copyright (C) Microsoft Corporation.
컴퓨터: WORK

DISKPART> create vdisk file=d:\vhd\windows2019.vhdx maximum=262144 type=expandable

  100 퍼센트 완료

DiskPart가 가상 디스크 파일을 만들었습니다.

DISKPART> select vdisk file=d:\vhd\windows2019.vhdx

DiskPart가 가상 디스크 파일을 선택했습니다.

DISKPART> attach vdisk

  100 퍼센트 완료

DiskPart가 가상 디스크 파일을 연결했습니다.

DISKPART> create partition primary

DiskPart에서 지정한 파티션을 만들었습니다.

DISKPART> format fs=ntfs quick

  100 퍼센트 완료

DiskPart가 볼륨을 성공적으로 포맷했습니다.

DISKPART> assign

DiskPart에서 드라이브 문자 또는 탑재 지점을 할당했습니다.

DISKPART> exit

DiskPart 마치는 중...

D:\vhd>dism /get-wiminfo /wimfile:g:\sources\install.wim

배포 이미지 서비스 및 관리 도구
버전: 10.0.19041.746

이미지 정보 : g:\sources\install.wim

인덱스 : 1
이름 : Windows Server 2019 Standard
설명 : (권장) 이 옵션은 대부분의 Windows 그래픽 환경을 생략합니다. 명령 프롬프트와 PowerShell을 사용하거나 Windows 관리 센터 또는 기타 도구를 사용하여 원격으로 관리합니다.
크기 : 8,172,089,251바이트

인덱스 : 2
이름 : Windows Server 2019 Standard (데스크톱 경험)
설명 : 이 옵션은 별도의 드라이브 공간을 사용하는 완전한 Windows 그래픽 환경을 설치합니다. 이 옵션은 Windows 바탕화면을  사용하려고 하거나 이를 필요로 하는 앱이 있을 때 유용합니다.
크기 : 14,379,288,723바이트

인덱스 : 3
이름 : Windows Server 2019 Datacenter
설명 : (권장) 이 옵션은 대부분의 Windows 그래픽 환경을 생략합니다. 명령 프롬프트와 PowerShell을 사용하거나 Windows 관리 센터 또는 기타 도구를 사용하여 원격으로 관리합니다.
크기 : 8,170,791,267바이트

인덱스 : 4
이름 : Windows Server 2019 Datacenter (데스크톱 경험)
설명 : 이 옵션은 별도의 드라이브 공간을 사용하는 완전한 Windows 그래픽 환경을 설치합니다. 이 옵션은 Windows 바탕화면을  사용하려고 하거나 이를 필요로 하는 앱이 있을 때 유용합니다.
크기 : 14,362,818,387바이트

작업을 완료했습니다.

D:\vhd>dism /apply-image /imagefile:g:\sources\install.wim /index:4 /applydir:f:\

배포 이미지 서비스 및 관리 도구
버전: 10.0.19041.746

이미지 적용 중
[==========================100.0%==========================]
작업을 완료했습니다.

D:\vhd>bcdboot f:\Windows
부팅 파일을 만들었습니다.

D:\vhd>bcdedit

Windows 부팅 관리자
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
bootshutdowndisabled    Yes
default                 {default}
resumeobject            {########-####-####-####-############}
displayorder            {default}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows 부팅 로더
-------------------
identifier              {default}
device                  partition=F:
path                    \Windows\system32\winload.efi
description             Windows Server
locale                  en-us
inherit                 {bootloadersettings}
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=F:
systemroot              \Windows
resumeobject            {########-####-####-####-############}
nx                      OptOut

Windows 부팅 로더
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.efi
description             Windows 10
locale                  ko-KR
inherit                 {bootloadersettings}
recoverysequence        {########-####-####-####-############}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {########-####-####-####-############}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

D:\vhd>

1. First time boot and automatic initial configuration.
SATA Floppy Image is required if RAID is configured.

2. Install Graphic Driver.
AMD Radeon™ Software Adrenalin 2020 Edition fails to be installed on Windows Server.
In INF file, you can find “NTamd64.10.0.1…14310” which means OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION(0x0000001).
Whereas, wProductType of Windows Server is VER_NT_SERVER(0x00000003), and thus, INF should be patched before installation to work properly.
In addition, by adding ;(semi-colon) in front of HKR,,CoInstallers32,%REG_MULTI_SZ%, Open CL would also work fine.
Or use PowerShell script for automation of above steps.

3. Install AMD GPIO Driver.
AMD GPIO Driver can be installed manually by updating Unknown Device (Microsoft ACPI Complaint System).

Driver files can be obtained from Asrock support page. (AMD all in 1 with VGA driver)

4. Enable Audio Services.
Enable service, Windows Audio and Windows Audio Endpoint Builder

5. Enable Wireless Features (optional).
5-A. Add features, Wireless LAN Service

5-B. And then, reboot once

5-C. Enable service, WLAN Autoconfig

5-D. Install Intel® Wireless Bluetooth® for Windows® 10 Driver

5-E. Resolve unknown device driver manually
https://www.intel.com/content/www/us/en/support/articles/000056758/intel-nuc.html