Author Archives: mvalk

Exporting AD users with email

To export all active directory users and their email addresses  from a certain OU (ie. finance) to a comma seperated file, use the following PowerShell command

Get-ADUser -filter * -SearchBase 'OU=Finance,DC=contoso,DC=com' -properties Emailaddress | select-object Name, emailaddress | Export-Csv c:\users.csv

Slow “Quick Format iSCSI” performance

Today I installed a new Windows 2012 server to be used as a Hyper-V host. I attached a Synology LUN and followed the procedure of getting the disk recognized within Windows (iSCSI initiator). As I final step i brought the disk online and performed a quick format (NTFS).

But… this quick format took a very long time and in the disk management console I could not see the progress of the format.
I then tried to use diskpart and when executed “format fs=NTFS QUICK” the progress indicator stayed at 0 procent for at least an half hour.

After trying all kinds of solutions I found one

  • issue the command “fsutil behavior set DisableDeleteNotify 1” before quick formatting the drive.

After that the quick format finished in less than 1 minute

VPN Connection BUG in Windows 10

So a few days ago I installed Windows 10, installed my software and went on setting up a VPN connection to our remote workplace.
Whenever I install this VPN connection, I create two of them. One of them is with ‘use default gateway at remote network’ and one has this option disabled.
In that way I can choose to have my local traffic run through our company network or not (split-tunnelling).

But to my astonishment the properties button of the IPv4 or IPv6 settings doesn’t do anything!
Apperently this is a bug.



However there is still an option to change this by using Powershell.
Just assume your VPN connection is named “VPN 1”, with the Powershell command:

set-vpnconnection -name 'VPN 1' -SplitTunneling $true

you can set the VPN Connection to use Split-Tunneling (use gateway at remote network option).
Happy as I was, that Powershell came once again to the rescue I started the VPN and got to work.

But I noticed I couldn’t connect to my company’s servers.
I tried pinging one of the servers, but the IP resolved back to our ISP’s IP address, so I knew our internal DNS wasn’t queried.
An “nslookup” test confirmed this.

It appears that Windows 10 is using a function called “smart multi-homed name resolution”.  This function sends DNS requests to all interfaces, and uses the fastest response it receives (thus being my ISP’s DNS servers).
In Windows 8 this could be turned off by adding a new registry entry named “DisableSmartNameResolution” to the key HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\DNSClient. In Windows 10 it appears this doesn’t work anymore.

Even adding the DNS Servers of my company through use of the command NETSH did not work (and you have to do it every time after you connect to your VPN).

But.. there is one solution.
It appears this BUG is only there when using a WIRED network and not if you use a WiFi connection.
So it appear for the moment I am stuck with my WiFi Network to set up a VPN with SplitTunneling to my company :-(

PowerShell: Copying Latest Files to multiple servers

Problem: I have a source folders which consisted of multiple directory’s (builds from TFS). I wanted to copy the latest folder (Based on LastWriteTime) to several servers.

Answer: use-powershell (what else 😉  )

$serverlist = @("\\server1\d$\install\software","\\server2\d$\install\software", "\\server3\d$\install\software")
$LatestBuild = (get-childitem D:\sourcedirectory | Sort-Object LastWriteTime -Descending | select-object -first 1).FullName
$serverlist | Foreach {Copy-Item $LatestBuild -Recurse -Destination $_}

AD: user password change: access is denied

A user tries to change his password from his workstation and get’s a ‘access denied’ message.

  • open active directory users and computers
  • find the user and open it’s properties
  • select the ‘account’ tab
  • check if the option ‘user cannot change password’ is selected (if so, de-select it)

Powershell: copy files based on date

To copy files from a certain date to a different folder you can use the following PowerShell command:

Cannot communicate via lync to Skype users

If you want to communicate with skype users through your Lync software. For example you get the error message
This message wasn’t sent because doesn’t have permissions on your organization’s network, or because the address is incorrect. Please contact your support team.
There are a few things that you should check (or change).

  1. First of all you should check if ‘external communication’ is allowed in your company portal
    [lync administration – organisation – external communication]
    Please note that if this was not enabled and you are enabling it now it can take up to 72 hours to be in effect.
  2. If the skype person you want to communicate with doesn’t have skype registered with a microsoft account (i.e. one that does not end in,,, or, you should add the person’s IM Address as follows:
    So, for a person with the following email address: you should enter it as john.doe(
    Let the skype user login and send some chats.

Youtube movies not playing full screen in Chrome

I’ve had an annoying problem with chrome (version 33.0.1750.146) which was that I could not play Youtube Video’s in full screen mode. The video would not be full screen (only a part of the screen) and it would stop playing (but the audio kept on going). This problem was actually caused by Flash.
If you have this problem try this:

  • browse to chrome://plugins/ in chrome
  • Open details (there is a button for it at the right part of your screen)
  • find the plugin Adobe Flash Player
  • disable pepflashplayer.dll
  • restart chrome and it should be ok now


(I just have to see now, what I broke and what doesn’t work anymore due to this fix).

SQL: backup / restore DB status

A nice script I found to use when you are backing up /  restoring a SQL database and you want to see the progress.


PowerShell: compare 2 directory’s

Comparing two directory’s and listing the differences


Original source: Jeff’s Blog