Remains of Soviet tank in Bamiyan

I was staying in a yurt in Bamiyan which overlooked the valley where the famous Buddha statues were destroyed by the Taliban. Having done much in the valley already, I went for walk near some fields where I had earlier spotted the remains of Soviet military vehicles.

Camera in hand, I managed to get some closeups of those vehicles including this tank. Moments later, a uniformed man starts shouting at me from across the field and began approaching. I watched as he got to my position. Not sure what he was saying but he was pointing at my camera and he wasn’t letting me leave. Luckily, a farm worker saw what was happening and came over to help, and he spoke English. He translated saying that the uniformed man was police, and that he wanted to know if I had a permit to take photos. I said that I wasn’t aware of the need for permits. And then he wanted my passport. I showed him my passport, but I didn’t hand it over. He then wanted me to accompany him to the police station. I said no. A standoff.

He radioed his colleagues and there were now several police surrounding me. And then appeared one chap shouting angrily as he walked across the field. It was the boss. Same arguments…he wasn’t going to get hold of my passport, and I wasn’t going to the police station. I said I was British, and that my friends were waiting for me nearby. Anyway, it turns out that they were worried about terrorists from Pakistan especially with the elections only a few days away. After much talking, they let me go, and I shook hands with the police chief. I was questioned several times by the security forces throughout my travels in Afghanistan, but I guess they had legitimate concerns; literally life and death.

Man and Shirt, Omo Valley, Ethiopia

In the Omo Valley, Ethiopia. I was exploring a Hamar village trying to take photos of village life. As I prepared to take photos, this young man automatically tried to remove his Mercedes Benz top as he assumed that I might think that the shirt wasn’t “authentic”. But I indicated to him that the shirt OK; if that is what he normally wore then it was plenty authentic to me and plenty interesting enough!

Reconnect mapped network drives using Command Prompt batch script

When booting into Windows, the OS sometimes does not reconnect mapped network drives even though the mapping is configured with the “Reconnect at sign-in” option. This is due to various timing constraints of resources during boot.

Although there are free Third Party software available that can automatically reconnect your mapped network drives, I would rather be able to do this using built-in tools than add more unnecessary software to my system. I’ve therefore written a Command Prompt batch script using the “NET USE” command which runs in Windows 10 Pro 64-bit (ver 1909).

The script is saved as a .CMD batch file which is executed twice by the Task Scheduler at user log on; one in non-admin and the other in admin mode (run in highest privilages). This allows a mapped drive to be visible to those applications running in non-admin and also to those applications running in admin modes. I also used the CMDKEY at the Command Prompt (not in a batch script) to add my network share credentials so that I didn’t have to add the credentials to the NET USE command. The CMDKEY format was:

cmdkey /add:192.168.49.69 /user:username /pass:password

The batch script is below. Note that this post is an update of a previous post which had some flaws.

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET me=%~n0
SET parent=%~dp0

TITLE Mapping network drive
@ECHO Please wait whilst we connect your drive
TIMEOUT /t 1 /NOBREAK >NUL

:Start
ECHO _____________________________________

IF EXIST D:\NUL (
    ECHO:
    ECHO D: drive is already mapped
    GOTO Endofscript
) ELSE (
    ECHO:
    ECHO D: drive does not exist
)

IF EXIST \\192.168.49.69\Data\ (
    ECHO:
    ECHO Network folder exists so run NET USE command
    NET USE D: \\192.168.49.69\Data /PERSISTENT:YES
) ELSE (
    ECHO:
    ECHO Network folder does not exist
    GoTo ErrorPrompt
)

IF "%ERRORLEVEL%" NEQ "0" (
    IF "%ERRORLEVEL%" NEQ "2" (
        ECHO:
        ECHO NET USE returncode has error and is %ERRORLEVEL%
        GOTO ErrorPrompt
    )
) ELSE (
    ECHO:
    ECHO NET USE returncode should be 0 and is %ERRORLEVEL%
)

REM catchall
GOTO Endofscript

:ErrorPrompt
ECHO _____________________________________
ECHO:
SET /P userinput="Errors were found. Do you wish to try again [Y/n] "
IF /I "%userinput%" EQU "y" GOTO Start
IF /I "%userinput%" EQU "" GOTO Start
IF /I "%userinput%" EQU "n" GOTO Endofscript
GOTO ErrorPrompt

:Endofscript
ECHO _____________________________________
ECHO:
@ECHO Please wait, script is closing.
TIMEOUT /t 5 /NOBREAK >NUL
ENDLOCAL
@ECHO OFF
@EXIT /B 0