Category Archives: Server management

Migrate DHCP server role from 2008 to 2012r2 with Powershell

 

Step-by-step instructions to migrate the DHCP server role from a windows 2008 server to a 2012R2 server with Powerhsell.

First install the migration tools on the target and the source server.

 

Import the servermigration tools on the source server (2008r2 in this case). Make sure the Migration tools are not alredy installed on the computer.

Next, export the settings on the source server

Next, copy the svrmig.mig file to the target server.

On the target server execute the following commands

Reboot the target server

Autorise the DHCP server in the AD

Discard the source DHCP server.

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.

 

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

 

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.

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:

 

 

 

 

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 »

A quick way to display a computers free diskspace

 

A quick way to display a computers free diskspace.

 

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.