Microsoft RDP and Terminal Services info

Random session disconnects in Windows 11 22H2:

https://learn.microsoft.com/en-us/answers/questions/1021754/windows-11-remote-desktop-frequent-disconnects

Configure “Use only TCP” in Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections

Configure “Turn Off UDP On Client” in Computer Configuration > Administration Templates > Windows Components > Remote Desktop Services > Remote Desktop Connection Client

Query and reset RDP session on remote PC:

Query:
qwinsta /server:IP/servername
Reset:
rwinsta SESSIONID /server:IP/servername

Configure RDP shadowing in Windows 10/11:

https://winitpro.ru/index.php/2018/07/11/rdp-shadow-k-rabochemu-stolu-polzovatelya-windows-10/

Expired certificate warning while connecting to Windows machine using RDP:

Looks like latest Windows 2022 and 11 updates broke certificate reissuing mechanisms. It can be seen as expired certificate warning when connecting with RDP to windows machine.
According to this manual: https://docs.rackspace.com/docs/rdp-connection-failures-expired-self-signed-certificate the problem is with the “f686” file/ It shoud be replaced with the new one by Remode Desktop Services when needed, but somewhy it is not being replaced.
With help of this manual  https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc753525(v=ws.10)?redirectedfrom=MSDN I created Powershell script that can be placed in domain Group Policy and started at next reboot or this script can be manually run by admin on the machine that needs this fix:

Fix-Expired-RDP-Certificate.ps1:
net stop "TermService" /y
takeown /F "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\f686*"
icacls "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\f686*" /grant administrators:F /t
Get-ChildItem "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" | foreach{ Rename-Item $_.FullName -NewName ($_.FullName + "-old")}
net start "TermService" /y

I prefer to keep old files and not delete them, but here is a tested broken f686* remove command just in case:
Remove-Item -Path "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\f686*" -Force

USB over IP

Thanks to this man:
https://itproblog.ru/%D0%BF%D1%80%D0%BE%D0%B1%D1%80%D0%BE%D1%81-usb-%D1%83%D1%81%D1%82%D1%80%D0%BE%D0%B9%D1%81%D1%82%D0%B2-%D0%BF%D0%BE-%D1%81%D0%B5%D1%82%D0%B8-virtualhere/#Nastrojka_VirtualHere
I’ve found VirtualHere usb sharing software:
https://www.virtualhere.com/

There is a free of charge alternative so you can start free of charge server and use the client specified above also free:
https://habr.com/ru/companies/selectel/articles/668590/
or use alternative client (Windows only)
https://sourceforge.net/projects/usbip/

Lighttpd info

Rewrite rules:

https://stackoverflow.com/questions/5059860/lighttpd-url-rewrite

 

Add a rule specifically for paths with a trailing slash:

url.rewrite = (
  "^/framework([^?]*/)(\?.*)?$" => "/framework$1index.php$2",
  "^/framework/([^?]*)(\?.*)?$" => "/framework/$1.php$2"
)

And here’s a breakdown of how the regular expression works:

^          // Match the beginning of the string
/framework // Match any string starting with "/framework"
(          // Open the first group ($1 in the right hand side)
  [^?]*    // Match zero or more characters that are not '?'
  /        // Ending in '/'
)          // Close the first group
(          // Open the second group ($2)
  \?       // Match a '?'
  .*       // Match zero or more characters
)          // Close the second group
?          // Match the second group exactly once or not at all
$          // Match the end of the string

 

Firefox

Restore previous session after closing Firefox windows and leaving another window open:
– close Firefox and/or don’t open if you just find that you’re in trouble
– go to %AppData%\Mozilla\Firefox\Profiles\YOUR-PROFILE
– find sessionstore.jsonlz4 and rename if to sessionstore.jsonlz4-old
– go to %AppData%\Mozilla\Firefox\Profiles\YOUR-PROFILE\
– copy all files from there to some temporary directoy
– copy one of those files to %AppData%\Mozilla\Firefox\Profiles\YOUR-PROFILE
– rename that copied file to sessionstore.jsonlz4
– try to open Firefox and see if your tabs are restored
– if not or not all, try another file

There is a good tool to recover information from the .jsonlz4:
https://github.com/avih/dejsonlz4

Docker Info

Install Docker Engine on Ubuntu

https://docs.docker.com/engine/install/ubuntu/

How To Install and Use Docker on Ubuntu 18.04 & Ubuntu 22.04

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04

Полное практическое руководство по Docker: с нуля до кластера на AWS

https://habr.com/ru/post/310460/

Learn to build and deploy your distributed applications easily to the cloud with Docker

https://docker-curriculum.com/

How to make Docker work with PyCharm:

V1:
nano /etc/systemd/system/multi-user.target.wants/docker.service
#ExecStart=/usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H fd:// -H XXX.XXX.XXX.XXX:2375
systemctl daemon-reload
systemctl restart docker.service
https://programmersought.com/article/76572985717/

V2
# These commands get run inside of your VM.
# Create the directory to store the configuration file.
mkdir -p /etc/systemd/system/docker.service.d
# Create a new file to store the daemon options.
nano /etc/systemd/system/docker.service.d/options.conf
# Now make it look like this and save the file when you’re done:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375
# Reload the systemd daemon.
systemctl daemon-reload
# Restart Docker.
systemctl restart docker
https://nickjanetakis.com/blog/docker-tip-73-connecting-to-a-remote-docker-daemon

Connecting the Docker container to the external network via VLAN Tag:

https://en-designetwork.daichi703n.com/entry/2018/05/02/docker-network-vlan-tag

How to get a Docker container’s IP address from the host:

https://stackoverflow.com/a/20686101
docker inspect -f ‘{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ container_name_or_id

Interesting IT blogs and sites

“This Bridge is the Root” – Cisco, networks, troubleshooting, IT life
https://thisbridgeistheroot.com/blog/

“Дневники сетевого инженера” – Cisco, networks, troubleshooting, IT life
https://arny.ru

“записки SAP Basis консультанта” – SAP, VMWare, IT life
https://sidadm.blogspot.com/

“Maksim E.Moshkow’s Journal” – VMWare, HP, IT life
https://moshkow.livejournal.com

“internet-lab.ru” – VMWate, 1C, Server Hardware
https://internet-lab.ru/

“My CCIE Wireless Journey & More” – Cisco Wireless and LANs
https://mrncciew.com/

“Gkhan Tips” – Cisco, VMWare, other IT stuff
https://www.gkhan.in/

Elcomsoft Blog – «…Everything you wanted to know about password recovery, data decryption, mobile & cloud forensics…»
https://blog.elcomsoft.com/

XSREVIEWS – computer hardware reviews site with original design
https://xsreviews.co.uk/

Firewall.cx – Routing Information & Expertise To Network Professionals. Cisco, Palo Alto
https://www.firewall.cx/

Adventures in a Virtual World
https://paulgrevink.wordpress.com/

IT-React – HPE, Dell, Vmware
https://www.it-react.com/

Блог IT-KB – I Like Alexey Maksimov narrative style:
https://blog.it-kb.ru/

«WatchMySys» Blog – modern and legacy hardware teardown and detailed description, hardware hacks and workarounds:
https://watchmysys.com/blog/

HP Hardware & Software Info

HP ssacli commands in ESXi:

https://itbru.ru/index.php/2019/09/04/hp-ssacli-commands/
https://be-virtual.net/hpe-storage-controller-management-ssacli/
https://support.hpe.com/hpesc/public/docDisplay?docId=emr_na-a00018717en_us
https://kb.gtkc.net/hp-smart-array-cli-commands/
https://wiki.froberg.org/en/hpe-storage-controller-management-ssacli

Invoke SSACLI command from remote server: esxcli –server=”servername or IP” –user=”username” –password=”root password” ssacli cmd -q “controller all show status”

Continue reading “HP Hardware & Software Info”

MS SQL info

Remove maintenance plan and its jobs:

https://social.msdn.microsoft.com/Forums/en-US/d836371a-4dc9-40d1-b6b7-df25c6b51211/cannot-delete-a-maintenance-plan?forum=sqltools
https://dba.stackexchange.com/questions/121877/sql-server-cannot-drop-idle-job

#Show all maintenance plans IDs:
select s.name,s.id as [plan_id] from msdb.dbo.sysmaintplan_plans as s
SELECT name, id FROM msdb.dbo.sysmaintplan_plans

#Remove plan, its logs and subplans, selected by ID:
exec msdb.dbo.sp_maintplan_delete_plan @plan_id=N'{PLAN_ID_OF_MAINT_PLAN}’

DELETE FROM msdb.dbo.sysmaintplan_log WHERE plan_id = ”
DELETE FROM msdb.dbo.sysmaintplan_subplans WHERE plan_id = ”
DELETE FROM msdb.dbo.sysmaintplan_plans WHERE id = ”

#Now you can delete the jobs from Management Studio.

SQL SERVER – Unable to Start SQL Server Service or Connect After Incorrectly Setting Max Server Memory to a Low Value:

https://blog.sqlauthority.com/2019/09/26/sql-server-unable-to-start-sql-server-service-or-connect-after-incorrectly-setting-max-server-memory-to-a-low-value/