Category Archives: File management

Remove deduplication from a volume with powershell


First check if there is enough diskspace to expand the files to there original size, plus the size of the current deduplication database.

remove the optimization from the volume

See the results of the running Job:

Next, clean up the database. For this, deduplication must be turned on.

To turn on deduplication you can explude folders so the deduplication is running but does not do any dedup work.

When all is done, disable dedup and remove the feature.



Counting the number of active backups in Veeam and write this number in an XML file


This script is used for counting the number of active backups in Veeam and write this number in an XML file for further reference. I use Netcrunch as a monitoring tool and it can proces the content of XML files.


Checking folder for new content




Working with VHD files and converting them


To get VHD file type information from hyper-v machines you can use this oneliner. It lists vhd and vhdx files within a folder structure and lists if the disk is Fixed or dynamic in size.

To convert the files from a fixed format to a dynamic format, use the information from the last command.

I use the same file and folder name as the original but add an text before.

I use this for servers that are decommissioned but I do not want to delete. This way, they use not a lot of storage space.

Get folder permissions recursive


To view which user or group has access to a folder structure you must check this per folder.

Fortunately powershell has (ofcourse) the option to recursive check a folder structure and display the result in a nice textfile. The oneliner for this is:

You can use the get-acl command to display the effective permissions on a folder. This commandlet does not have the option to recursive go trough the entire folderstructure. Get-Childitem has this option and when you pipe it trough get-acl you get the list you want.

The where-object {($_.PsIsContainer)} is used to only display folders and not files.

Create a share on a fileserver


In this post I’ll explain how to create a share on a fileserver, set permissions and other options for the share.

Prepare the server

To create a share on a fileserver, first make sure the the File Server role is installed on the server. This feature is installed by default.

Get the current shares

Create a new share

Fist make sure you have a folder on the server. Next create the share.

to remotely create the share add the -cimsession option to the command.

Change permissions on a share

You want to keep the share permissions as simple as possible. To grant more detailed permissions you can use NTFS permissions on the folder or files. Bare in mind that Deny rights overrule the Allow rights.

To view the current permissions on a share:

To add permissions to a share

To remove permissions from a share


Configure Access-based Enumeration

You can hide folders from users that have no access to them. This is called Access-based enumeration. To enable this on a share disables users to view the folders where they do not have at least read access:





Get the size of files in a folder structure recursively


To get the size of specific files in a folder structure, for example log files, use the measure-object command, based on a selection you make.

First set the servers you want to check

Next, set the location on those servers

Next, get the files, in this case older then 15 days, and only the logfiles. The recurse option lets you find files in the entire folder structure.

Next, measure the result by adding the measure-command commandlet.

The output can be something like this:

If you want, you can do several thing with the output, like deleting old logfiles. The complete code for this would be:


A quick way to display a computers free diskspace


A quick way to display a computers free diskspace.


Copy files with progress indicator with Powershell


Copy files with progress indicator with Powershell


Remove old logfiles from Exchange servers


You can use Powershell to remove old logfiles from exchange servers. Those logfiles are located on the Client Access Servers (CAS servers) in the inetpub folders.

To remove the files older then 60 days use this script.

Fill in your own CAS servers on the variable $servers line. You can use as many as you want to.


Move files older then x hours


Schedule a task if you need to move files older then x hours to an other folder.