Author Archives: Albert van Boerum

Check the status of VSS Writer on multiple servers


To check the status of VSS writer on multiple server first load the following script. This script converts the output of the non-powershell command to something powershell can use in, for example, out-gridview.

Next, run this function against multiple servers


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.

Remote manage a non-domain server in servermanager


By default you cannot remote manage a non-domain server in servermanager, to which you are not authenticated. This happens for example when your computer is a member of a domain and the server you wish to manage is not a member of that same domain. That server is in a workgroup or a member of an other domain with no trust relationship.

To manage that computer you can add it to the trusted hosts list with a powershell command.

The concatenate switch is used to add the server to the list of trusted hosts. If you do not add this switch the current list will be overwritten.

Move transport database and roles in Exchange 2013


When designing an Exchange 2013 environment I always recommend using an additional disk to store the Transport Database and accompanying transaction log files to a separate disk. When things with SMTP get out-of-control and the Queue database grows too much your boot- and system disk do not fill up.

The Exchange Transport Configuration is stored in a CONFIG file called EdgeTransport.exe.config which is stored in the C:\Program Files\Microsoft\Exchange Server\V15\Bin directory.

When you open this file with Notepad and scroll down you’ll find something like:

<add key=”QueueDatabasePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

<add key=”QueueDatabaseLoggingPath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

<add key=”IPFilterDatabasePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\IpFilter” />

<add key=”IPFilterDatabaseLoggingPath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\IpFilter” />

<add key=”TemporaryStoragePath” value=”C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Temp” />

These are the location where you will find the Transport Queue database and the IpFilter database files and their corresponding transaction log files.

You can changes these directories to for example D:\TransportRoles\data\… and after you restart the Transport service the new location is used. The problem is that the ‘old’ Queue database is not moved. When the Transport service is restarted a new Queue database is created in the new location. If you have any (SMTP) mail in the old queue this gets lost.

Microsoft has created a scripts called Move-TransportDatabase.ps1 (located in the $ExScripts directory) which changes the location, moves the Queue Database and restarts the Transport service automatically. The Move-TransportDatabase.ps1 script takes the following parameters:

  • queueDatabasePath
  • queueDatabaseLoggingPath
  • iPFilterDatabasePath
  • iPFilterDatabaseLoggingPath
  • temporaryStoragePath

Resulting in a command like this:


Note: take care about the ‘ character in the different values!

When you run this command you’ll see some requirement information, creation of the new directories, moving the databases and restarting the Transport service

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:





Enumerate Group Membership


With powershell you can get an insight about the nested group in the AD and enumerate group membership.

Which users are members of the Domain Admins group?

In which groups is an user a member?

Is a user a nested member of the Domains Admins group?


Reset or change the active directory services restore password


To reset or change the active directory services restore password you must use the ntdsutil command. This command lets you access and change settings in the ADS.


Make a server a Domain Controller


New domain and forest.

To make a windows server a DC (domain controller) you must first install the feature. I first use the get-WindowsFeature to see if the correct feature is targeted.

After the feature is installed, load the correct module and install the servers as a Domain controller for a new domain and forrest.

Existing domain and forest.

I you have already a domain and forest up and running you must add a server to this domain.


Demote a server.

To remove the domain controller function from a server use.

Use the get-help with this cmdlet to see the options you can use.

Access offline files (.wim, .vhd or .vhdx) using DISM


On the installation DVD of a Windows installation you find a file called install.wim. This file contains the complete installation of a new windows installation.

If you want to alter this installation you must use the DISM command. Deployment Image Servicing and Management (DISM.exe) is a command-line tool that can be used to service a Windows image or to prepare a Windows Preinstallation Environment (Windows PE) image. DISM can be used to service a Windows image (.wim) or a virtual hard disk (.vhd or .vhdx).

The steps for altering a file, in this case the install.wim file, follow these steps.

Read more »

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.


Workflow to create a new AD group and add a user to the group


Here are the commands for a workflow to create a new AD group and add a user to the group.

Nothing fancy but saves you the time to find the command next time.. 🙂


« Older Entries Recent Entries »