Archives for October 2013

Getting the MD5 or SHA1 of a file?

If you are running the latest version of windows you can use the new Cmdlet Get-FileHash. For all others Microsoft has a tool called Microsoft File Checksum Integrity Verifier or FCIV for short.

The cmdlet supports the following hashes.. SHA1,SHA256,SHA384,SHA512,MACTripleDES,MD5,RIPEMD160
The FCIV supports SHA1 and MD5.


[Read more…]

Getting rid of special characters

So you want to create the username based on the name of the person. Well if the person is of nordic decent he/she might have funny characters that might brake your scripts. So how do we guarantee that you only get a-z?

For fun we will be calling our new user Räksmörgås, why is that? Well it is a swedish word containing all of our special characters. And I do like shrimp sandwish.

First we start with the really lazy approach:

Well that doesn’t really make me happy. I can’t visualize the word using what I got so I need to pick it up a notch. [Read more…]

What to remove in DNS to to stop Client Access to Domain Controllers

So you want to get rid of a domain controller, but dont want incidents with systems configured directly to that controller?

First of start with disabling the dynamic registration of the Domain Controller in DNS. The easy way of doing that is by setting the registry value of UseDynamicDns to 0.

So now the Domain Controller wont register it self in the DNS again. So now lets start to remove entries from the DNS. There exist a list in the %WINDIR%\System32\config\netlogon.dns, Below is an example of that list. [Read more…]

Demoting a Domain controller without uninstalling the Role

Windows 2012 has integrated and forced the use of Server Manager more. You can no longer use dcpromo to promote and demote the domain controller.

So do I need to uninstal the Active Directory role to demote a domain controller?:
No, you can use the Powershell cmdlet Uninstall-ADDSDomainController instead.

Remove-ADUser -> Remove-ADObject

So I was spring cleaning a lot of disabled users from a customer Active Directory. After a while I noticed that I couldn’t remove all user account. Some just wouldn’t go away.

So what the.. [Read more…]

Excel and Delete / Create file rights

So the regular reasons I get involved with excel are due to the fact I have a customer that one of the following:

  • The users should be able to edit but not delete any excel file.
  • The users should be able to edit but not create new excel files.
  • A report of something.

The last seems like the hardest, but neither of the first are possible at all. Both of these seem quite simple, just deny create file or the delete rights. But it’s not that simple. It has been tried more than once and been asked 1000 times on forums around the world. So what does really happen and why?

Excel will create a temporary file to make sure that the contents is ALWAYS on disk even if your computer fails during the save. Below is a more complete version of what happens. [Read more…]

Refresh quotas

Sometimes after an administrator has done something he shouldnt have on the file server, or a server has problems resulting in the quota of a directory being wrong. Well just let rescan the directory and fix it.

Windows 2008R2 and earlier:

dirquota quota scan /Path:<pathtoDirectory>\…

Windows 2012 and later:


Shortcuts to microsoft management consoles & control panel snap-ins.

There are lots of ways to shortcut when working in windows. One easy way is to just run the mmc or control panel snapin directly.

These are some of the ones I use the most, and below a long list of them.



adsiedit.msc, ADSI Edit, Graphical Low level Active Directory Management
appwiz.cpl, Programs and Features, Add Remove programs and windows features.

dsa.msc, Active Directory Users and Computers,
eventvwr.msc, Event viewer

ncpa.cpl,Network Connections


[Read more…]

How to get a hold of the and quota.xml files

The FSRM stores it data in a file called quota.xml which is located at C:\System Volume Information\SRM. To get at it you need to be running as System account. So lets start.

Fire up a CMD windows as System

So now we have the XML and md files with the settings in them. In case you want to play around or move them to another server.

Migrating quotas between From Window 2012->2012R2

So my customer is migrating from Windows 2012 to Windows 2012R2 and needed to migrate  user quotas between Windows 2012 and the new Windows 2012R2 server.

So one way would be to copy the quota.xml and files but I’m not sure that Microsoft would condone or support a suggestion like that so I will go the cmdlets from Windows 2012R2.

Lets roll, Lets get all the old quotas:

Now we have all quotas of the old server. Lets just filter out the ones we want and apply them on the new location.

We still need to migrate the auto quotas. But that is simple too: