Dec 07

Create recurring Scheduled Task to delete Logfiles older than 15 days.

On Exchange and other servers where you have IIS logfiles, the C drive or your log file location often fill up.
To prevent this from happening, its a good idea to create a scheduled task that runs daily checking your logfile folders for old files and delete these (unless you need them obviously.)

This script will create the job to remove your logfiles and create a scheduled task for you.

Variables are:
$user = ” ” #Add user you wish to run script as
$password= ” ” #add users password
$ScriptFolder = new-item -ItemType Directory -Path c:\scriptss\exchange -Force

#This creates ps1 file that we run in the scheduled job, with parameters on how we wish to delete files
New-Item -Path $ScriptFolder -Name Old-Logfiles.ps1 -ItemType File -Force
Add-Content -Path $scriptfolder\Old-Logfiles.ps1 -Value ‘$old = Get-ChildItem -Path “C:\inetpub\logs\LogFiles\” -Recurse -File | Where CreationTime -lt (Get-Date).AddDays(-15)’ -Force

Add-Content -Path $scriptfolder\Old-Logfiles.ps1 -Value ‘$old | remove-item -force’ -Force
Write-Host “File has been created in: $ScriptFolder”

#Create Scheduled Task
$action = New-ScheduledTaskAction -Execute ‘C:\Windows\system32\windowspowershell\v1.0\powershell.exe’ -argument “-command $scriptfolder\Old-Logfiles.ps1”

$trigger = New-ScheduledTaskTrigger -Daily -At 9am

Register-ScheduledTask -Action $action -Trigger $trigger -TaskName “Delete-Old-Logfiles” -Description “Deletes old Inetpub logfiles” -user $user -Password $password



Nov 07

Connect to your Office 365 environments using Powershell – Script.

I have for my own use made a script that allowes me to connect to the tenants we have at work.
This script will provide  you with the information you need to connect to your Exchange Online, Microsoft Online services, Skype4Business, Sharepoint and Compliance Center environments hosted in the cloud.

The script gives you a selection of your tenants to connect to, or you can type one in manually (You would have to provide the tenant info yourself in the menu)
To get the script to remain persistent in your current powershell session, import it as a module.
If you run it in ISE,  you do not have to import it as a module.
(To avoid errors its also recommended that you run your PS sessions as administrator, and set-executionpolicy remotesigned)

And when I am logged in I have made a few selections of simple tasks that I would sometimes be required to run.
I connect default to the Exchange Online session, but you can also connect to MsOnline, Skype4B og SharePoint from this script.



Im mainly an Exchange Admin, so I have not made any functions for Skype and Sharepoint 😉

To connect to the different O365 solutions  you will have to install following software:
Connecting to Sharepoint online you will require to install: Sharepoint Online Management Shell
Connecting to Skype 4 Business you will require to install: Skype for Business Online
onnecting to Microsoft Online Services you will require to install: Microsoft Online Services Sign In Assistant and Azure Active Directory Module

Script can be downloaded here: o365-public

Edit 09.11.2015 : Added to Github as well:

If anyone has similar scripts, feel free to show me 😉 


Sep 27

New category, new hobby ;)

I have a new category on my page, “Freediving“.

Here I will post some videos from my trips under water, most of it will be performed in Norway, and the Stavanger region. But if I go abroad, I will bring my GoPro camera to film it 😉
I also do regular ScubaDiving but not so much the last years, less active buddies 😉

I also recommend to look up Stavanger Spearfishers on youtube, really awesome videos from our region.


Jan 12

New dog – Marley & Me ;)

I have a new dog, so his gallery can be found here: Marley

Very active and kind 🙂

Jan 12


Had a LOT of power outage because of a storm here, so when I went to check my webpage, I noticed the server was down….  The webserver is down…..

Went to check the machine and it was constantly booting,so I figure I’ll just run a boot in safemode and repair it, or use System recovery from the CD, but none of those options were working.

Turns out my registry is gone, so I had to use the tips following on this page: How to repair your registry in 2012 server

Copy your registry backup from c:\windows\system32\config\regback to c:\windows\system32\config and then reboot your machine.


Jul 28

A site with a lot of great Admin tools for AD / Citrix etc.

Have used this page in a lot of special requests I have had during the years supporting Citrix and Windows, so I advice anyone working in the IT industry to check it out 🙂  No affiliation at all, just think this is a good resource site to know about:

Jul 23

Awesome Gallery now up and running

Just bought the Awesome Gallery plugin for my WordPress blog, so now I have the gallery up and running. Still got some fine tuning and will do a lot of tests before my galleries are final, but it looks good so far. Felix

Jul 06

Galleries now has some content :)

Added some private photo albums under “Gallery”.

Might try out some other plugins for WordPress after a while, but have to read some more about them before making a decision on what to go for.
Awesome Gallery” looks very nice, but since you have to buy it to try it, I have not tested it yet.





Feb 05

Microsoft gets a new CEO – Satya Nadella

Microsoft anounced their new CEO Satya Nadella, and here are some interesting videos worth watching.

Jan 28

How to change a Universal Distribution Group to a Universal Security Group in Exchange 2010.

I came across this great blog when searching for a solution on how to give a distribution group access to users calendars in Exchange. My problem was that when I changed the type to USG in AD, and gave it enough time, and tried to set my permissions on the folders, I still received an error.
If I created a new USG and did the same operation, everything worked fine, so what was the problem with my allready existing USG?

Turns out that you have to set this parameter on the distribution group: Set-Distributiongroup –identity NameOfGroup –MemberDepartRestriction Closed

And for more info I would recommend that you check out this great blog about this issue:

Older posts «