Category Archives: Microsoft

Microsoft products

How to run karma in TeamCity on Windows server

This is one solution and it works for us, there is also a node and npm plugin for TeamCity that I did not try, it is found here

Setup nodejs, npm and karma for TeamCity on Windows server.

Install nodejs

Install nodejs for windows using the latest installer from

Configure npm global

To be able to call karma and npm from TeamCity command line build step you need to
update the global catalogs for npm (as described in this post

Create the global (admin) location(s) for npm modules
“C:\ProgramData\npm-cache” – npm modules will go here
“C:\ProgramData\npm” – binary scripts for globally installed modules will go here
“C:\ProgramData\npm\node_modules” – globally installed modules will go here
And set the permissions appropriately
administrators: modify
authenticated users: read/execute

Run the following npm commands in a command prompt
npm config –global set prefix “C:\ProgramData\npm”
npm config –global set cache “C:\ProgramData\npm-cache”

Add npm and nodejs to your System’s Path environment variable

From the GUI, in “Control panel” search for “advanced system setings” open it and select “Environment variables” or run “sysdm.cpl” from cmd to open the “System Properties”
Add the following to PATH: “;C:\Program Files\nodejs\;C:\ProgramData\npm”

Install karma-cli in “C:\ProgramData\npm”

Run the command “npm install karma-cli -g” and verify that i is installed in ¬†“C:\ProgramData\npm”

Install PhantomJs (Optional)

(phantomjs will be downloaded and installed in each build folder if it is not found locally)
Download the zip-file for Windows
and extract to “C:\PhantomJs\bin\phantomjs” (create the path)

For npm to find phantomjs in a TeamCity build step,
add the path “C:\PhantomJs\bin\phantomjs\bin\phantomjs.exe” to a new environment variable PHANTOMJS_BIN (created in “Environment variables” )

Restart the TeamCity service just to be sure.
To run the karma tests

Save the TeamCity reporter in your project (read this
by running the command “npm i –save-dev karma-teamcity-reporter”

Add two command line build steps to your build.
first one containing the command “npm install” – to update/install your “node_modules”
and the second containing the command “karma start –reporters teamcity –single-run –browsers PhantomJS –colors false”

And now you should have a great karma ūüėČ

Happy building!

Semesterkalkylatorn Рberäkna din semesterersättning och antal intjänade semesterdagar

Semesterkalkylatorn beräknar antal intjänade semesterdagar samt intjänad semesterersättning för en angiven tidsperiod

Du behöver endast ange startdatum, slutdatum, berättigat antal semesterdagar per år samt månadslön för att få fram hur många semesterdagar du tjänat in under perioden samt hur mycket din semesterersättning per dag och totalt blir.
För anställda som inte har kollektivavtal eller har en rörlig lönedel gäller andra beräkningsmodeller. Du hittar mer nyttig info på Unionen

Just nu blev det ett Excelblad f√∂r denna ber√§kning, men den kommer troligen snart som en webbsida n√§r jag tagit mig tid att g√∂ra den ūüôā

Nu finns där du kan beräkna semesterdagar och semesterlön.



OBS! Du måste ha en svensk version av Excel för att kalkylen ska fungera.

Ladda ner Semesterkalkylatorn



Powershell Script to add home folder path in Windows 2003 AD on users in list of email addresses

So you need to assign and create home folders to a bunch of users and don¬īt really feel like doing it all the GUI way one by one?

I had this problem and I also needed to specify what users to create folders for by a list, and since email addresses are a good primary key I based my script on that.

This script will create folders, set permissions and update this information in the user objects in AD

First do Read

In Microsofts “How to assign a home folder to a user” you will find out how assign home folders in GUI or by scripting. When assigning a home folder in AD Users and Computers the AD takes care of creating the folder on specified share, but when assigning a home folder using the scripts they provide all you get is the path mapped in the users computer and in the AD user object, the folder is not created.

Then do Read

This script needs the path to a text file with the users email addresses** (one address per line), domain name,path to root of user share and a drive letter to the home folder (use a “high” one so you don¬īt get problems with card readers etc.).

** Can easily be changed to display name or samaccountname

! The script will set the users home folder name to “samaccountname_givenName-sn” (f ex. “jifr_Jimi-Friis”)


Powershell Script to add home folder path in Windows 2003 AD on users in list of email addresses

Script to add path to home folder in Windows 2003 AD

Then do Copy modify and enjoy! as always on your on risk ūüôā

## ***** Script Header *****

## File Name:  AD_getUserLogonName_fromList_CreateAndSetHomFolder.ps1
# Author : Jimi Friis,
# Created: 2012-06-05
# Purpose:  Set up home folder for Active Directory users specified as email adresses in a text file
# Continue reading Powershell Script to add home folder path in Windows 2003 AD on users in list of email addresses

Sharepoint Server 2010 Backup Errors “Cannot open backup device” when using Admin GUI

So I tried to use the backup function in Sharepoint Server 2010 (Standard) and it looked pretty straight forward.

Just go to “Central Administration > Backup and Restore”
choose full Farm backup and add the path where to backup, \\SERVERNAME\BACKUPSHARE, and press the backup button.

Wait a minute or two for the preprocessing..

First error:

“This page contains one or more errors. Fix the following before continuing:
Directory\\SERVERNAME\BACKUPSHARE does not exist or the SQL Server service account and the Continue reading Sharepoint Server 2010 Backup Errors “Cannot open backup device” when using Admin GUI

Script to Uninstall Eset Nod32 and install Forefront Endpoint protection from GPO

How to uninstall Eset Nod32 Antivirus and install FEP (Forefront Endpoint Protection) also known as Microsoft Essentials Antivirus on Windows clients using a vbscript.

In my environment we have been using Eset Nod32 Business Edition antivirus version 4.

Nod32 is a light and stable antivirus with a decent footprint. The Eset Administration is good and powerful if you spend a couple of days learning it.


Wen we started to use a business web application, using the java editor PageFlex .EDIT, from our business partner our users complained on that editing tool system, and it was really slow, loading the page in about 40 to 50 seconds, and editing was really slow with 1 to 2 seconds per key stroke .

After some troubleshooting we found that Nod32 was the reason and for some reason there is no way to exclude a web site from the antivirus, there is a setting to exclude URLs from scanning but the URL will still be processed by Nod32 in some way. One possible option is to disable the scanning of web pages completely, but that was not an option I liked.

The quick fix on this problem is to change antivirus to FEP wich is free at least if you have a subscription from Microsoft, else there is the essentials version.

To manage and install FEP you have two options, one is to use System Center 2012 Endpoint Protection (or SCCM) and it requires SQL Server Standard or Enterprise editions. The other option is to install the client manually or by script and use GPO settings to mange the client settings.

This is how I install the FEP client using a GPO user logon script, making sure that Nod32 is uninstalled before installing. It is tested on Windows XP and Windows 7, x86 and x64.

Wen running the script on my Windows 7 the UAC popped up, I haven¬īt tested if that happens when the script is run by the GPO, so you might need to test it and tell the users if the prompt will¬† pop up.

Thanks to Jakob Gottlieb Svendsen,, for providing a nice start to this script.

I hope this will be of help, and don¬īt forget to turn off the password protection in Nod32 or the uninstall will fail.


Use this script at your own risk and test it before deploying to production environment.

Continue reading Script to Uninstall Eset Nod32 and install Forefront Endpoint protection from GPO

How to Enable Remote Connection / Remote Access on MSSQL / SQL Server 2008 Express

If you cannot login to a remote servers database but the login is working from the localhost, and the port is open in Windows firewall, then you probably have to enable the remote connection in SQL Server Configuration Manager.

Since I found a great article about this subject I wont write it myself. A great guide is in the other end of this link



How to recover and reset a MSSQL SA password – Forgotten SA password or disabled SA user

How to recover the SA password in MSSQL 2008

Have you forgotten the SA (system administrator) password of your MSSQL installation? Can you not login using the Windows administrator account? Relax and do not panic! Here are some of the solutions ūüôā

First you should try to login to the server as a domain admin or a local admin and connect to the database with SQL Server Management Studio (SSMA) using Windows Authentication. If this is not working then just continue reading.

If you (or someone else) have disabled the possibility of logging in as a local or domain admin (which is a part of best practice) you will have to enable an SA account, or reset the password of it.

You can enable accounts, reset passwords and add new sysadmin accounts in SQL Server 2005 and SQL Server 2008, the only catch is that you have to do it in the single user mode which means that if it is used in production you have to do it when the database can be down for about 10 minutes.

Note: If the database is used in a production environment I recommend that you do NOT change the password of the SA account unless you are totally sure that no applications are running the database using the SA account. It¬īs better to add a new account with sysadmin privileges if you don‚Äôt want to take the risk.

Follow these steps to add a new sysadmin account in SQL Server 2008 express.

1. Logon to the server with Windows domain or local administrator account.

2. Start the command prompt, using ‚ÄúRun as Administrator” if the server is also Windows 2008, or Windows 7

3. Stop the SQL Server either using the SQL Server Configuration Manager or by running the command:
NET STOP “SQL SERVER (SQLEXPRESS)”¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† And wait till the service is stopped

4. Start the SQL Server in single user mode by running the command*:

5. Start SSMA, using ‚ÄúRun as Administrator” if the server is also Windows 2008, or Windows 7

6. In SSMA click the “New Query” button and login to the instance localhostsqlexpress with “Windows Authentication”.


7. In the new query window you run the following command to check the privilege of logged on user:
SELECT user_name()
–the result should be “dbo” which means you are logged in as a sysadmin



8. Comment out the previous command or delete it, then run the following command if in a domain:

sp_addsrvrolemember ‘domainname\username’,’sysadmin’
— where domainname is the domain you are in.

Example of user jimi in the newsweb domain:
sp_addsrvrolemember ‘newsweb\jimi’,’sysadmin’

If the account is local then change the domainname to the servername  like in this example:



9. Stop the SQL Server, either using the SQL Server Configuration Manager or by running the command:
NET STOP “SQL SERVER (SQLEXPRESS)”¬†¬†¬†¬†¬†¬†¬†¬† And wait till the service is stopped

10. Start the SQL Server, either using the SQL Server Configuration Manager or by running the command:
NET START “SQL SERVER (SQLEXPRESS)”¬†¬†¬†¬† And wait till the service is started

11. Now you should be able to login with the newly added account in SSMS and from there you can add, remove and reset accounts when the database is online.


*NET commands used to start and stop the sql service depend on the installation.

To start a named instance you can run one of the following command lines (and this is how we do it on the sql express 2008):
NET START “SQL Server (instanceName)”¬†¬†¬†¬†
NET START MSSQL$instanceName

To start a default instance you can run: NET START MSSQLSERVER

Outlook Anywhere

Outlook 2007 outside the office (RPC over HTTP)

How to set up Outlook to work outside the office with no need for a VPN connection.

This will only work if your Mail administrator has configured the mailserver correctly.
If you are an administrator read my article Outlook Anywhere settings from GPO to learn how to enable these settings via GPO.

I usually send my own version of this HowTo to users I am administering (when the GPO settings is not an option), because then I can show them exactly how to do it with the correct values (it is easy to get confused when you don’t work with IT).

But for you I think these guides from Microsoft will be better.

If the link doesn‚Äôt work, google for “Use Outlook Anywhere to connect to your Exchange server without VPN”

Om l√§nken inte fungerar s√• googla efter “Anv√§nda funktionen Outlook √∂verallt f√∂r att ansluta till din Exchange-server utan ett VPN”

Make sure that Group Policies can be updated over VPN

To make sure* that GPO¬īs are updated even for users that are connected over VPN you can disable the “Group Policy slow link detection”

GPO settings

In “User Configuration / Administrative Templates / System / Group Policy” **

open up the “Group Policy slow link detection”,

enable it and set the “Connections speed” to 0 (null). This¬† disables the slow link detection.

* For some GPO settings to update on a computer or a user (depending on what type of settings are used) the connection to the domain controller must be established before the computer boots or before the user are logged on to the computer.

** If the settings are Computer based then edit the¬† “Computer Configuration / Administrative Templates / System / Group Policy”, “Group Policy slow link detection”.

Outlook Anywhere settings from GPO

If you want to make sure all of your employees (ok, maybe not yours but you get it) have the right settings in their Outlook profile so that they can always use the mail client even when they are outside of the office, you should push these settings from a GPO.

Download Template

Download this file

Save the file temporary to your desktop or directly to %WinDir%inf

Set up the GPO

Open the GPMC and create a new group policy with an easy to understand name like ‚ÄúOutlook 2007 Anywhere‚ÄĚ

Edit the GPO

Add the template to the ‚ÄúOutlook 2007 Anywhere‚ÄĚ GPO

  1. Right click on ‚ÄúAdministrative Templates‚ÄĚ under User Configuration and chose ‚ÄúAdd/remove Templates‚ÄĚ from the drop down menu.
  2. Click ‚ÄúAdd‚ÄĚ

    and select the file named ‚Äúarticle-961112.adm‚ÄĚ (if you saved the file to the desktop just drag it in to this window) and Click “Open”
  3. Now that the template is added click “Close”

Configure the Outlook Anywhere template

Now open the added template and change the configuration to meet your needs.

  1. RPC/HTTP Connection Flags
    Enable the setting and pick the flags you need
    Flag1: Enables the ‘Connect to Microsoft Exchange using HTTP checkbox’ on the Connection tab.
    Flag2: Enables the ‘Connect using SSL only’ checkbox
    Flag3: Enables the ‘Only connect to proxy servers that have this principal name in their certificate’ checkbox
    Flag4: Enables the ‘On fast networks, connect using HTTP first, then connect using TCP/IP’ checkbox
    Flag5: is not implemented as an option in Outlook 2007 so it is not included in any policy settings.
    Flag6: Enables the ‘On slow networks, connect using HTTP first, then connect using TCP/IP’ checkbox
  2. Proxy Server Name
    Enable the setting and specify the server name, this should be your DNS MX record.
  3. Only connect if Proxy Server certificate has principal name
    Enable the setting and enter your certificates common name, if you have a wildcard certificate it will look like on the image but if you have a single server certificate it is probably the same as the DNS MX record.
  4. Proxy authentication setting
    Enable the setting and choose authentication type. This should be set to “NTLM authentiction”.

Now all you have to do is to link the GPO to the domain and wait for the replication and policy update times.
If you have users that are connected to the domain via VPN make sure that the GPO “Slow link detection” is configured to your meet needs.