My use case for a customer was to configure WSUS for a couple of DMZ servers. The DMZ servers are not domain-joined. So I create a PowerShell script to configure the registry so I can easily deploy the settings to the servers.
You can use this script also for non domain-joined servers
With Powershell ISE you can use CTRL + SPACE for auto completion.
But when you work in a native Powershell window you don’t have this option. And many often you cycle with tab completion trough the powershell and because you press the TAB button too soon you have to remove characters and cycle again trough all the commands.
Unit now 😉
There is an easy fix you can implement so the Powershell have the same auto completion like bash.
Type notepad $profile for Windows or gedit $profile for Linux
Add the line Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Save the file and restart Powershell
And now you have a much better working tab completion
A friend of mine came back from vacation where he had taken a lot of pictures. When he got back home a large part of his Micro SD card (exFAT partition) was no longer accessible so he missed a couple of weeks of his photos and videos. His Windows Operating System froze completely when it hit a rotten cluster during a file copy action. So we had to find another solution to get his files back.
The first step I tried was to get the data from the SD card via Linux with ddrescue. With ddrecue, you create and complete dump of the SD card (or the sdb1 partition only). So you can do the data recovery on the image file (backup1.img) and not on the already corrupted SD Card.
But Linux also had also trouble reading when I hit a bad cluster. The only thing I could do during the read issues was a physical disconnect of the USB adapter, reconnect the adapter and restart the ddrescue process. The reason of was that a dual SD card adapter was used:
Micro SD > SD > SD > USB
(spoiler ALERT!: Never use multiple adapters for data recovery!!!)
Because ddrescue has a mapfile it goes further where he was stopped the last time.
While debugging I wrote a simple loop that forced a “physical” disconnection of the USB adapter wait one sec and reconnect the devices without touching anything.
This works but is a very very slow process. This will takes months to recover so I had to find another way.
## Steps to Prepare:
# lsusb check card reader and change the /dev/bus
# Start script in usbreset folder
# Run as sudo
# mount disk (media / thomas)
echo "Let's try Again!"
ddrescue -d /dev/sdb1 /media/thomas/4905eb31-1df4-49bb-bb75-ec4889641d20/backup1.img /media/thomas/4905eb31-1df4-49bb-bb75-ec4889641d20/backup1.mapfile
The funny thing is that it was Sinterklaas time and that my daughter had just received a vtech kiddy photo camera with a Micro SD to USB adapter included 😀
So I try new new adapter: Micro SD > USB and with success.
And after almost 15 hours the result 99.98% rescued rate 🙂
During my search for a solution I found some interesting articles:
And the next time you make a change you only have to do
git ftp push
When you get an errors like these:
zo 19 dec 2021 23:11:50 CET: Retrieving last commit from sftp://******:***@s*******/public/sites/*********/.
* Trying *********:22...
* Connected to ******* (********) port 22 (#0)
* Found host ******** in /home/******/.ssh/known_hosts
* Set "ecdsa-sha2-nistp256" as SSH hostkey type
* Closing connection 0
curl: (79) Error in the SSH layer
zo 19 dec 2021 23:11:50 CET: fatal: Could not get last commit. Use 'git ftp init' for the initial push. Can't access remote 'sftp://******:***@********'. Network down? Wrong URL? exiting..