Create custom URL for your local development machine

Say you’re working on several projects at your local machine. Accessing those pages with custom URLs could be useful for a variety of reasons.

  • Easier to remember the URL. http://abc is easier to remember than http://localhost/projects/2016/customer/abc
  • If the project has a login form, your browser will cache the credentials for the domain, i.e. localhost. Working with custom URLs the browser will interpret them as different domains so it will cache the correct login. This is especially useful for me, I have like 5 local projects involving a login and I never know which one is correct for this and that.

So in the example below I assume you have Apache webserver running at http://localhost and a subfolder called “projects/mysite” (ok technically that’s 2 subfolders, but you get the picture)

Configure your hosts file

$ sudo nano /etc/hosts

Open Command Prompt in elevated mode and run notepad %windir%\system32\drivers\etc\hosts

Add your custom URL at the end. For example: proj-mysite

Configure Apache to enable the virtual host module

Open httpd.conf which is somewhere in your apache folder, typically /apache/conf/httpd.conf.

Search for vhost_ and find the line that says LoadModule vhost_alias_module modules/
If this line is commented (has a # at the beginning), then remove the # to enable the module.

Set up a virtual host

Open httpd-vhosts.conf, typically found here: /apache/conf/extra/httpd-vhosts.conf.
You will probably see a list of commented entries here to illustrate how it works.

Now you must add a new virtual host. At the end of the file, paste in the following:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/projects/mysite"
    ServerName proj-mysite
    ServerAlias proj-mysite
    ErrorLog "logs/proj-mysite.log"
    CustomLog "logs/proj-mysite.log" common

I guess most of the lines are self-explonatory so edit wherever you need and save the file.

Restart Apache webserver

Then open http://proj-mysite

Create a daemon for Linux

# !/bin/sh
# /etc/init.d/daemond

# Provides:             daemond
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Skeleton daemon
# Description:          Skeleton daemon

case "$1" in
        echo 'hello world'
        killall daemond -q
      echo "Usage: /etc/init.d/checkconnectiond {start|stop}"
      exit 1

exit 0

Add custom scripts to Powershell user scope

Today I had to google how to find out my Powershell version. How fucked up is that. Luckily 1680 other people wondered the same and appreciated this answer:

Turns out the command is: (ignore PS C:\>, that’s just to indicate a Powershell)

PS C:\> $PSVersionTable.PSVersion

No way I’m going to remember that. Luckily, StackOverflow user @ADTC mentioned he made a function to output the version.
Open notepad and write the function to the file specified from the $profile path.

PS C:\> notepad $profile

Insert the function:

function psver { 

Reload Powershell by running

PS C:\> . $profile

Now you can enter psver to output the version. Beautiful!

If you got an error when running notepad $profile that the file can’t be found, then simply enter $profile in your Powershell window to output the path and create the file manually in Windows Explorer.

Still delivering Out-Of-Office warning even though it’s turned off

Vacation’s over, back to work. However, Outlook still tells people I’m out of office. I wish…
For no apparant reason this seem to randomly happen with our users sometimes.

In an attempt to fix it we’ve tried the usual:

  • Start Outlook in safe mode and check that it’s indeed turned off
  • Check that it’s also turned of in our Exchange server for the user

Luckily we found a work-around using MFCMAPI which seems to fix the issue.
Be careful though, MFCMAPI talks directly to Exchange and it can mess up your Exchange account if pressing random buttons recklessly.

Step 1
Download MFCMAPI from
Note that you must download the same architecture as your Outlook is running. 64-bit MFCMAPI won’t work with 32-bit Outlook.

Step 2
Close Outlook and open mfcmapi.exe
Click on Session -> Logon in the top menu and pick your Outlook profile.

Step 3
You should see a list of accounts connected to the Outlook profile you chose in the last step.
Click on your account, scroll down in the properties list until you see PR_OOF_STATE, PidTagOutOfOffice.... This will be set to True if OOF is activated. Double-click on this property and uncheck the Boolean checkbox in the dialog window. Click OK followed by Session -> Log off in the top menu. OOF should finally be disabled.

Can’t move file – Error 0x800401E5: No object for moniker

How we suddenly got 0x800401E5 errors

Some time ago we changed the desktop folder location for every user from C:\Users\<name>\Desktop to X:\Desktopwith a new group policy rule. This apparantly led to some complications for a few users because the local Windows registry didn’t update the paths somehow. Luckily it only affected a few users so we found a manual workaround.

Fix by using regedit or push out to users with GPO

Open regedit and navigate to the following two locations:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Change the Desktop value to correct folder. Remember to do it in both locations.

List members of AD group


Open the Powershell shell (pun intended) on your domain controller and run the following command:
Get-ADGroupMember 'groupname'

This will list all members of the ‘groupname’ group in your shell. List pipe it into a text file instead:
Get-ADGroupMember 'groupname' > list.txt

We don’t need those unecessary columns though, so let’s just list the NAME column and nothing else:
Get-ADGroupMember 'groupname' | select name > list.txt


Run the shell as admin…

Simple Robocopy backup script

Robocopy syntax to copy all NEW or EDITED files from source to destination dir:

robocopy "%src%" "%dest%" /E /W:1 /R:1 /XC /log+:"robocopy_log.txt"

Description of the parameters:

  • /E = Copies subdirectories. Note that this option includes empty directories. If you wish to exclude empty directories, use /S.
  • /W:1 = Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds).
  • /R:1 = Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).
  • /XC = Excludes changed files.
  • /log+: = Writes the status output to the log file (appends the output to the existing log file).

Windows batch script to setup a scheduled task to run the robocopy command:

@echo off
title Robocopy Backup
echo Initial configuration for automatic backup with Robocopy + Task Scheduler

echo Step 1 - setup Robocopy:
set /p src=Backup FROM dir: 
set /p dest=Backup TO dir: 
echo cd %userprofile%\Desktop
echo robocopy "%src%" "%dest%" /E /W:1 /R:1 /XC /log+:"robocopy_log.txt"
)> %userprofile%\robocopy.bat

echo Step 2 - setup Task Scheduler:
schtasks /create /tn "Robocopy Backup" /tr "%userprofile%\robocopy.bat" /SC HOURLY
echo Done


Copy & paste the text into a text editor and save it as a .bat file to make it executable.

When running this script you will setup a scheduled task which runs the robocopy.bat file every hour. Really great and time-saving if you work in a local folder on your C drive and wish to periodically take incremental backups to a network storage for instance.

Map network share without being on domain


Please note you must have access to a user account with NTFS permissions to access the file share (unless it’s open to everyone).

  • Open command prompt
  • Type the following command:
    net use x: \\server\share /user:domain\username password

net use y: \\itdb1\home /user:itdb\kek 123456

If the share is open for everyone, you can dismiss the user arguments:
net use y: \\itdb1\home

Keep in mind that if you already are on the domain and try to map a network share with another user than you’re currently logged in with, you will see the error message:

System error 1219 has occured.

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.


Linux can also access NTFS mounts. Run the following commands in your terminal:

  • Create a folder which will be used for connecting to the share:
    $ sudo mkdir /mnt/ShareName
  • Mount the network share to your folder:
    • Without user authentication:
      $ sudo mount -t cifs //server/share /mnt/ShareName
    • With user authentication:
      $ sudo mount -t cifs -o username=itdb\kek,password=123456 //itdb1/home /mnt/ShareName

Backup MySQL data using mysqldump

Backup complete database:

mysqldump -u <username> -p<password> <dbname> > dbname.sql

Backup only specific tables:

mysqldump -u <username> -p<password> <dbname> <tablename> \ > tablename.sql

Restore a .sql file:

mysql -u <username> -p<password> <dbname> < file.sql

Note: There can’t be any empty spaces between -p and the password parameter.


mysqldump -u root -p123456 itdb > itdb_280912.sql
mysqldump -u root -p123456 itdb itdb_posts \ > itdb_posts_280912.sql
mysql -u root -p123456 itdb < itdb_backup.sql

Setup automated database backup with mysqldump and cron jobs for Linux

Start cron manager by running command $ crontab -e and type the following line at the bottom:

0 4 * * * sudo mysqldump -u root -p<password> <dbname> | gzip > /mnt/nas/<dbname>_bak_`data ' %Y-%m-%d'`.sql.gz

This will create a job entry in cron which starts every night at 0400 AM. What it does is running mysqldump to backup the specified <dbname> and also compresses it to a gzip file and saves it to /mnt/nas/ (replace with wherever you want to store the file).

Open Computer Management as administrator in W7

Method #1 – Executable binary file

  • Open Windows Explorer and navigate to:
  • Hold the [Shift] button and right-click on compmgmt.msc and press Run as administrator or Run as other userif you wish to use another user.


Method #2 – Command prompt

  • Open the Command Prompt and enter:
    runas /user:domain\username "mmc compmgmt.msc"
    Note: You must include mmc to inform the runas command that this is a Microsoft Management Console snap-in instead of an ordinary Win32 application


Method #3 – Context options menu

  • Simply right-click on Computer or This PC from the Startmenu or Windows Explorer and click on Manage. In most circumstances this will trigger the UAC prompt
    Computer context menu


In addition to compmgmt.msc, here are some other useful Windows snap-ins:

  • compmgmt.msc – Computer management
  • lusrmgr.msc – Local users and groups
  • perfmon.msc – Resource monitor
  • devmgmt.msc – Device manager
  • printmanagement.msc – Print management
  • taskschd.msc – Task scheduler
  • services.msc – Services

Find more snap-ins by going to %windir%\system32 and searching for *.msc files.