Category: Microsoft

Change to Opt-In in MyAnalytics

Since MyAnalytics is an “Opt-Out” feature in Office 365, some companies wants to change this behavour for their users, meaning that each users should enable this feature them self instead of the service being automatically enabled when users are created.

Changing settings in Office 365 to change this behavour:

Remove the three ticks on the MyAnalytics service window to change the default behavour for new users. removing these ticks will ensure that users need to “opt-in” their self by accessing “” and change settings there.

And in each user can ustomize their own MyAnalytics settings by opt-in or opt-out in the dashboard “”

Remove the service from each user forcing the users to enable the service themself

#Connect to Exchange Online with MFA
Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter CreateExoPSSession.ps1 -Recurse ).FullName | Select-Object -Last 1) #download module from Exchange Online Admin Center under "hybrid" and using IE.
#Connect to Exchange Online
Connect-EXOPSSession -UserPrincipalName
#This will make sure when you need to reauthenticate after 1 hour that it uses existing token and you don't have to write password and stuff

#check what state the users is in today
Get-UserAnalyticsConfig –Identity

#Opt-out from service - users can opt-in again at 
Set-UserAnalyticsConfig –Identity -PrivacyMode Opt-out

#multiple opt-out
$privacyMode = "Opt-Out"

$users = Get-Mailbox *
ForEach ($user in $users)

Set-UserAnalyticsConfig –Identity $upn -PrivacyMode $privacyMode
Get-UserAnalyticsConfig –Identity $upn

Reset folder language to match Outlook Web Access language

So in the recent time i have been working with a customer to integrate Exchange Online mailboxes into a customer support application witch are using POP. The application throwed a error message:

02:47:34.513 Trc 21628 [MsgIn-2] <pop-client1> Mailbox account ''[]: opening mail folder 'INBOX'
02:47:34.748 Std 21627 [MsgIn-2] <pop-client1> No INBOX Folder found on Corporate Email Server

This indicates that the software witch is polling emails need the inbox folder to be “Inbox” and not “innboks” (witch is Inbox in norwegian). So we need to change the default folders to match the language set in OWA.

  1. Logon to your account on
  2. Head into to the Gear icon next to your profile picture in the top-right corner and in the bottom select: Your app settings-> Mail

3. Select General in the left pane and then click on: Region and timezone.

4. In language, set your language for OWA and check the checkbox witch also renames the default folders to match the selected language and hit the save button.

OneDrive for Business – Known Folder Sync fails

When activating Known Folder Sync in OD4B the sync never starts due to folders that cannot be synced.
These folders are Junction folders on the drive and needs to be deleted.

First do a dir in the users document folder and look for hidden files like this:
C:\Users\USER\Documents>dir /ah
Volume in drive C is Windows
Volume Serial Number is 903B-D31E

Directory of C:\Users\USER\Documents

18.04.2018 10.10 2 230 Default.rdp
26.09.2018 11.59 402 desktop.ini
26.09.2018 11.59 Intern video [C:\Users\USER\Videos]
26.09.2018 11.59 Min musikk [C:\Users\USER\Music]
26.09.2018 11.59 Mine bilder [C:\Users\USER\Pictures]
2 File(s) 2 632 bytes
3 Dir(s) 55 879 593 984 bytes free

Then delete the junctions like this:

C:\Users\ÙSER\Documents>rmdir “Intern video”
C:\Users\ÙSER\Documents>rmdir “Min musikk”
C:\Users\ÙSER\Documents>rmdir “Mine bilder”

Other files in conflict with the sync needs to be removed from the local machine before the cloud sync can start. Backup and move the files in case of future needs.

Happy OneDriving.

Keep private Teams private in Microsoft Teams

As of 23. of march 2018 all private teams will be searchable for all users.
Users can then apply for group membership.
If you have groups in your organization that you still want to keep completly private then the Office 365 unified group should be hidden from the Global Address List (GAL).

Run this Powershell command to hide it from GAL:

“Set-UnifiedGroup -Id “Groupname”-HiddenFromAddressListsEnabled $True”

RDP Scaling on high resolution screens

I have been running on a Surface book for the last couple of weeks and is very satisfied with the screen resolution on this machine. that said the operatingsystem is running on 175% zoom 🙂 but when using for example “Remote Desktop Connection Manager” to gain access to my servers i`m realy strugling since the resolution is set to 3000 x 2000. therefor i found this small hack to fix it.

  • uncheck this checkbox in compatibilities settings on the shortcut or exe-file

(PS: sorry for the norwegian screenshot:))

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:

Detect and uninstall hotfixes

There seem to be a broken patch KB3159398 which was released this Tuesday, it breaks GPO processing which can cause a lot of headache!


I’ve made a script which lets you check if this hotfix is installed and also let’s you uninstall it. Replace the KBxxxxxxx with the KB number and run from elevated Powershell to see if it is installed. If you want the script to uninstall the hotfix silently, set $uninstall to $true.

$uninstall = $false # change to $true to uninstall hotfix
$hotfixID = ‘KBxxxxxxx’ #Hotfix KB-number to check, use ‘ quotation marks
Get-HotFix $hotfixID
if ($uninstall -eq $true)
Invoke-Command -ScriptBlock {wusa.exe /uninstall /KB:($hotfixID -replace ‘KB’,”) /quiet /norestart} #Uninstall quietly and does not prompt for reboot


Enable/disable Office 365 serviceplans

I was asked today how you can disable and enable individual features included in an Office 365 license (like Exchange Online, Yammer.. etc) from Powershell

Launch Powershell and log on to your tenant (connect-msolservice)

To see which features which is included in a license use the following code:

$lic = Get-MsolAccountSku | Out-GridView -OutputMode Single -Title “Select SKU to look up”

This will show a list of features and their status

Next, if you want to disable Exchange online for one specific user:

$skuid = Get-MsolAccountSku | Out-GridView -OutputMode Single -Title “Select SKU to edit”
$user = Get-MsolUser | ? {$_.isLicensed -EQ $true} | Out-GridView -title “Select user to modify” -OutputMode Single
$Disable_ExchangeOnine = New-MsolLicenseOptions -AccountSkuId $skuid.AccountSkuId -DisabledPlans “EXCHANGE_S_ENTERPRISE”
$Enable_ExchangeOnline = New-MsolLicenseOptions -AccountSkuId $skuid.AccountSkuId -DisabledPlans $null
Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -LicenseOptions $Disable_ExchangeOnine

The sku must match the sku assigned to the user you want to change.


Then run this line in the same script to re-enable Exchange Online

Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -LicenseOptions $Enable_ExchangeOnline

CMD line: add domain to local intranet zone

A quick way to add domains to a computers Local intranet zone is to run the following regs in cmd. No Admin rights needed.

REG ADD “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\ ” /v https /t REG_DWORD /d 1 /f
REG ADD “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\ ” /v https /t REG_DWORD /d 1 /f