Managed Service Accounts (For Single Machine)

PowerShell is required to create a service account. Once created it can be managed  in the GUI.


#Create the MSA

New-ADServiceAccount -Name MyAppSrv -RestrictToSingleComputer

#Add the Machine to be used with the account

Add-ADComputerServiceAccount -Identity SRV-01 -ServiceAccount MyAppSrv

#You can test to see if it is working (it won't... yet)

Test-ADServiceAccount -Identity MyAppSrv

#Finally, install the account and test again

Install-ADServiceAccount MyAppSrv

Test-ADServiceAccount -Identity MyAppSrv

#Next, Configure the service to use the account.

Go to your service you wish to run on a service account, on the logon tab, set the credentials for the service as a network account. Use the browse button to find your MSA. Remove the pre-populated password from the fields and save.



Data Deduplication

PowerShell Commands for handing Data Deduplication:

# install data deduplication
Install-WindowsFeature -Name FS-Data-Deduplication

# dedup evaluation tool
ddpeval U:
ddpeval I:
ddpeval V:

# enable data deduplication
Enable-DedupVolume -Volume V: -UsageType HyperV

# view and set volume-wide settings
Get-DedupVolume -Volume V: | Format-List *
Set-DedupVolume -Volume V: -MinimumFileAge 0

# manually run optimization job
Start-DedupJob -Type Optimization -Volume V: -Priority High -Memory 100 -Cores 100

# monitor running jobs

# view overall status
Get-DedupStatus | Format-List *

# view and set schedule
Set-DedupSchedule -Name ThroughputOptimization -Enabled $false

# disable deduplication
Start-DedupJob -Type Unoptimization -Volume V:


Create Storage Pools, Virtual Disks and Volumes with Server Manager in Server 2012 / 2016

Here are the PowerShell Commands to complete:

# create a new storage pool
New-StoragePool -FriendlyName AllTheDisks -StorageSubSystemUniqueId (Get-StorageSubSystem).UniqueId -PhysicalDisks (Get-PhysicalDisk -CanPool $true)

# create virtual disk
New-VirtualDisk -FriendlyName CompanyData -StoragePoolFriendlyName AllTheDisks -Size 2TB -ProvisioningType Thin -ResiliencySettingName Mirror

# initialize underlying physical disks
Initialize-Disk -VirtualDisk (Get-VirtualDisk -FriendlyName CompanyData)

# partition and format volumes from virtual disk
$vd = Get-VirtualDisk -FriendlyName CompanyData | Get-Disk

$vd | 
    New-Partition -Size 100GB -Driveletter U |
            Format-Volume -FileSystem NTFS -AllocationUnitSize 4096 -NewFileSystemLabel "User Data"

$vd |     
    New-Partition -Size 500GB -Driveletter I |
        Format-Volume -FileSystem ReFS -AllocationUnitSize 4096 -NewFileSystemLabel "IT Data"

$vd | 
    New-Partition -Size 1TB -Driveletter V |
        Format-Volume -FileSystem ReFS -AllocationUnitSize 65536 -NewFileSystemLabel "VM Data"


DNS Service using high lots of RAM


A Windows server hangs, reboots, becomes unresponsive or network clients disconnect due to Dns.exe consuming a large amount of nonpaged pool memory and file handles.


Log on to the server using the local or domain Administrator account, open an elevated command prompt and perform the following steps. 

1. Press the Windows Logo+R, type runas /user:[email protected] cmd where domain.local is replaced by the name of the Active Directory domain or local server name and press Enter. The same task can be accomplished using the Command Prompt and Run as Administrator.

2. Type the Administrator account password when prompted and press Enter

3. Type dnscmd.exe /config /socketpoolsize 1000 and press Enter

4. Type net stop dns && net start dns and press Enter.


How to free up space used by Data De-Duplication in Server 2012

If Data De-Duplication is disabled, the system files will remain and actually occupy a lot of space. Here is how to clear it:

The unoptimise command:

start-dedupjob -Volume <VolumeLetter> -Type Unoptimization


Check the status:



Clean up the Garbage:

start-dedupjob -Volume <VolumeLetter> -Type GarbageCollection