AD Change Roaming profile Path Terminal server

I created this script because of moving the profiles to a server in the data center were also the terminal server is located.

Powershell needs to be runned as Administrator


Raspberry PI as a VPN Client to FRITZBOX with IPSEC

Setup of VPN at the Fritzbox

First, a new user is created under System-> FRITZ! Box user.

Here, the access from the Internet must be granted and VPN (of course, be unlocked, everything else is deselected.

we remember the information from the iphone settings:

  • Description:
  • Server:
  • Account: vpn_user
  • Password: Password of the FRITZ! Box user “vpn_user”
  • Use certificate is disabled
  • Group name: vpn_user
  • Shared Secret: TANrpS1y34hHHJGIS4
 Now it goes on the Raspi ….


sudo apt-get install vpnc

Create and customize config:

sudo nano /etc/vpnc/fritzbox.conf

IPSec gateway
IPSec ID vpn_user
IPSec secret TANrpS1y34hHHJGIS4
IKE Authmode psk
Xauth username vpn_user
Xauth password <passwort>
local port 0
DPD idle timeout (our side) 0

first test of the tunnel:

sudo vpnc fritzbox.conf

Ending the VPn connection:

sudo vpnc-disconnect

I have the start of the script in /etc/rc.local registered so that the VPN connection is established during boot.

vpnc fritzbox.conf

– Update –

Since the VPN connection breaks partially uncontrolled Abdelkader Wahb has made a script that monitors the connection and reboots when needed. I do not want to deprive you of this:

#! / Bin / bash

# here the log file is defined

LOGFILE = / data / log_vpnc / fritzbox.log

# here is the IP address of Fritzbox defined. if the VPN connection stands, then ping should work.

myHost = “”

# Value -> how often should be pinged

value = 4

# Output value for “count” should be at successful ping 4, at unsuccessful ping 0.

count = $ (ping -c-value $ myHost | grep, received ‘| awk, {print $ 4}’)

if [$ count == 4]


# The upcoming echos are the info-issues in logfile

echo “$ (date +% Y-% m-% d:% T): Fritzbox with IP $ myHost is reachable and VPN connection is” | tee -a $ LOGFILE


echo “” | tee -a $ LOGFILE

echo “$ (date +% Y-% m-% d:% T): Fritzbox with the IP $ myHost is not reachable” | tee -a $ LOGFILE

echo “$ (date +% Y-% m-% d:% T): Disconnect VPN” | tee -a $ LOGFILE

# Here the VPNC-Demon is stopped, so it does not run more in the background


# Often the wireless connections are broken. Here all network connections are restarted.

echo “$ (date +% Y-% m-% d:% T): Restart network connections” | tee -a $ LOGFILE

/etc/init.d/networking restart

Wait for 10 seconds

sleep 10

# read out from the Wlan IP address

ipwlan = $ (ifconfig wlan0 | grep “inet address” | cut -b 24-38)

echo “$ (date +% Y-% m-% d:% T): Network connections have been restarted. WLAN IP address: $ ipwlan “| tee -a $ LOGFILE

echo “$ (date +% Y-% m-% d:% T): Rebuild VPN connection, start script vpnc_fritzbox” | tee -a $ LOGFILE

# start from VPNC-Demon. Read out PID and VPN-IP address

vpnc fritzbox.conf

pid = $ (pidof vpnc)

ipvpn = $ (ifconfig tun0 | grep “inet address” | cut -b 24-38)

echo “$ (date +% Y-% m-% d:% T): The VPN connection was successfully established. the VPN IP address is: $ ipvpn. VPNC-Demon is active under id: $ (pidof vpnc) “| tee -a $ LOGFILE

echo “” | tee -a $ LOGFILE



Entry in / etc / crontab so that every 3 minutes is automatically executed on boot:

* / 3 * * * * root /etc/init.d/autovpncscript


Outlook displays “Disconnected” in the status bar if the last character in the legacyExchangeDN attribute is a space

Applies to: Outlook 2016Outlook 2013


In Microsoft Outlook 2016 or Outlook 2013, you experience one or several of the following symptoms:

  • You receive the following error message:
    The Microsoft Exchange Administrator has made a change that requires you quit and restart Outlook.

  • You receive the following error message when you start Outlook:
    Cannot start Microsoft Outlook. Cannot open the Outlook window. The set of folders cannot be opened. The file C:\Users\<username>\AppData\Local\Microsoft\Outlook\ is not an Outlook data file (ost).
  • Outlook displays one of the following message in the status bar:
    Trying to connect…


This issue occurs if there is a trailing space (that is, if a space is the last character) in the legacyExchangeDN attribute.


To resolve this issue, remove the trailing space from the legacyExchangeDN attribute by using ADSIEdit.msc. To do this, follow these steps.

Important After you make this change in the legacyExchangeDN attribute, recipients who previously received an email message from this user will receive a non-delivery report (NDR) message if they try to reply to an email message that they received from this user before the change was made. This problem will not occur for replies to new email messages that the user sends after the change was made.

  1. Open the Run dialog box. To do this, use one of the following methods, as appropriate for your situation:
    • Windows 10, Windows 8.1 or Windows 8: Press the Windows key + R.
    • Windows 7 or Windows Vista: Click Start, and then click Run.
  2. Type ADSIEdit.msc, and then press Enter.
  3. Expand the Default naming context to CN=Users.
  4. Select the user account whose mailbox is prompting the error.
  5. Right-click this account, and then click Properties.
  6. Locate the legacyExchangeDN attribute, and then click Edit.
  7. Remove the trailing space at the end of the username.
  8. Click OK, click Apply, and then exit ADSIEdit.msc.
  9. Have the user exit and then restart Outlook.

Source: Microsoft

Raspberry pi cleanup script

Create with the following command in your raspberry pi the script.

Paste below the text and with CTRL + X close nano

To run the script. First:

Start the cleanup:


Assign ip to VPN connecton on synology nas

Uitgaande van een standaard installatie van het VPN Server package:

Navigeer naar

/usr/syno/etc/packages/VPNCenter/Maak daarin een map aan met de naam

ccdRechten ccd: 0755
Maak in die map een bestand aan met de naam van de gebruiker die het vaste tunnel IP moet krijgen, b.v.

adminSchrijf in dat bestand

ifconfig-push admin: 0644

Navigeer naar


openvpn.confen voeg de regel

client-config-dir /usr/syno/etc/packages/VPNCenter/ccdtoe.

Navigeer naar


radiusplugin.cnfen wijzig


Start/Herstart OpenVPN.