Map network drives when VPN connects

An ethernal problem. Here is how to fix it:

First connect to a VPN connection and then go into the Program logs in Event viewer ( Windows key + R then eventvwr )

Go to the Program log and find the success post for the connection just made. EventID on mine here is 20225.

Then open Task Scheduler (Windows + R then taskschd.msc)

Create a new task and name it something. On the trigger select on a Event, then select the log Application, Source RasClient, and then type in the EventID you found when the connection was made successful. In my case 20225.

Then on Actions, add a bat file with the command net use commands for your share.

(net use x: \\\share /user:username password /persistent:yes)

Now press ok and test.


Change language – Office 365 Mailbox

To change the Language for a Office 365 mailbox (Exchange Online), run the following commands:

$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $O365Cred -Authentication Basic -AllowRedirection

Import-PSSession $O365Session

Set-MailboxRegionalConfiguration -Identity “USER” -Language nb-no -LocalizeDefaultFolderName

For full list of cultureinfo classes (Languages) see:

How to store emails sent from a shared mailbox in the correct sent folder

Problem: User sends email as a shared mailbox ( but the sent email gets stored in the users sent items in Outlook (

To have Outlook Place the sent item in the correct sent item folder, do the following registry change.

NOTE: Changing registry might cause unwanted Things to happen to Your computer. Always back up before changing the registry.

The fix:

1.Click Start, click Run, type regedit, and then click OK.
2.Locate and then click the following registry subkey:
Note The x.0 placeholder represents your version of Office (16.0 = Office 2016, 15.0 = Office 2013, 14.0 = Office 2010).
3.On the Edit menu, point to New, and then click DWORD Value.
4.Type DelegateSentItemsStyle, and then press Enter.
5.Right-click DelegateSentItemsStyle, and then click Modify.
6.In the Value data box, type 1, and then click OK.
7.Exit Registry Editor.

This fix Works for Outlook 2013 and newer. It does the fix on the Client, without having to change the Exchange server. For larger enterprices where it is more conveenient to have this as a server setting please read this blog article:


SPF 1-2-3

Here is a quick intro to SPF and how to configure it:

SPF (Sender Policy Framework) is a countermeassure for beeing an unwilling wictim of spam sending. Using SPF you can approve from what SMTP servers email from will be sent from. This will make it harder to spoof your e-mail adrress, as long as the receipient server checks the SPF record.

For Office365 you need to update your DNS zone with SPF records to fully validate the domain. Here is an example of how the SPF record shuld look like:

v=spf1 -all

If you are using some system to send out e-mails outside Office365 you need to add those servers to you SPF record.
If you just want to add a IP adresse this is how your record shuld look like:
v=spf1 ip4: -all

And if you want to use a hostname (and a IP address) it could be like this:
v=spf1 ip4: -all

Note that using include will require the domain (ie_ to have its own SPF record to be valid.

Windows: New files temporarly not visibel for 3rd party applications

When new files are created on a Windows server some third party apps will not se the new file for a few seconds. This may cause unwanted delays. The reason is that the 3rd party applications uses the Directory Cache to poll for new files. This cache are updated every 10 seconds. To resolve this problem change the Registry string HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation\Parameters\DirectoryCacheLifetime (DWORD) to a value of 0. This will disable the cache and resolve the file doesn’t exist issue.

PS: always back up the registry before doing updates. If you do not… well…

Powershell: Exchange – Check database size

Here is a one liner to check the database size for exchange databases.

Start Exchange management shell. Then run the following command:

Get-MailboxDatabase | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinGB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter (‘name=”’ + $_.edbfilepath.pathname.replace(“\”,”\\”) + ””)).filesize / 1GB),2)) -passthru} | Sort-Object mailboxdbsizeinGB -Descending | format-table identity,mailboxdbsizeinGB


Finding Exchange Control Pane in Office 365 with new layout

Lately Microsoft have changed its layout in Office365 and in that same change made it harder to find Exchange Control (ECP) Panel.

At the moment the easiest way to open ECP is to log in to your office 365 Outlook Web Access.
Then, change the url from something like this: to this:

As you can see you change OWA to ECP and youre in!

Backup Hyper-V with Windows Server Backup 2012

Backup VM
Backuptarget = drive letter to backup destination (not folder)
VM Host name = identical with VM name in hyperv console

wbadmin start backup -backuptarget:[drive letter] -hyperv:[VM name] -quiet

RESTORE VM to a new server
Backuptarget = UNC path to data location on old server
Recoverytarget = path on new server

C:\>wbadmin get versions -backuptarget:\\[ip]\[share]
C:\>wbadmin get items -backuptarget:\\[ip]\[share] -version:[versionID]
C:\>wbadmin start recovery -itemtype:hyperv -items:[VM identifier] -backuptarget:\\[ip]\[share] -recoverytarget:[path] -alternatelocation -version:[versionID]

List users and size of mailbox in Exchange 2007 and 2010 with Powershell

Get-Mailbox | Get-MailboxStatistics | select-object DisplayName, {$_.TotalItemSize.Value.ToMB()}

© 2021 IdefixWiki

Theme by Anders NorénUp ↑