Tuesday, December 31, 2013

Promote the first domain controller in Server Core environment by PowerShell in Windows Server 2012 or later

In Windows Server 2012 or later, administrators can promote a domain controller by erforming some cmdlets in PowerShell console. Administrators might not perform cmdlets to deploy a domain controller in GUI environment. However, if a server is in server core environment, administrators have to perform PowerShell cmdlets to promote a server to a domain controller.

Goal
Promote a server which was installed Windows Server 2012 Server Core to the first domain controller in Active Directory forest. 

Prerequisites
  • A server named DC01
  • An IP address and preferred DNS server of DC01 is 192.168.4.11/24

Steps
1. On DC01, log in as local Administrator.
2. On "Command Prompt", perform "PowerShell" to enter PowerShell console.


3. Perform "Install-WindowsFeature AD-Domain-Services -IncludeAllSubFeature -IncludeManagementTools" to install features and management tools of Active Directory.


4. Perform "Test-ADDSForestInstallation -DomainName <Domain Name> -ForestMode Win2003 -DomainMode Win2003 -InstallDns" to run the prerequisite checks for installing a new Active Directory forest with Forest and Domain functional level at Windows Server 2003.


You have to enter a "SafeModeAdministratorPassword" for this test.

The "Status" of this test is "Success" so we can continue promoting a server to a domain controller.

Remark: Windows Server 2012 supports the following Forest and Domain functional level: Win2003, Win2008, Win2008R2 and Win2012 and Windows Server 2012 R2 supports: Win2008, Win2008R2, Win2012 and Win2012R2.


Remark: "Test-ADDSForestInstallation" and other related cmdlets are under "ADDSDeployment" module.


5. Perform "Install-ADDSForest -DomainName <Forest domain name> -DomainNetbiosNAme <NetBios Name> -ForestMode Win2003 -DomainMode Win2003 -InstallDNS" to promote the first domain controller in a new forest.


6. Enter a "SafeModeAdministratorPassword" for this domain controller.

Remark: "SafeModeAdministratorPassword" is applied to recover the domain controller when entering "Directory Services Restore Mode".

7. Press "Y" to continue promotion.


Then, the server started to promote a server to be a domain controller and then will restart automatically.



Remark: We can also add other parameters for "Install-ADDSForest" cmdlet to change the default log path and the default NTDS database path. For more information, please enter "Help Install-ADDSForest -Full".

8. After DC01 restarted, log in as Domain Administrator.
9. On "Command Prompt", perform "PowerShell" to enter PowerShell console.
10. Perform "Get-ADForest". 


As a result, DC01 has been promoted to the first domain controller.

This posting is provided “AS IS” with no warranties, and confers no rights!

Monday, December 30, 2013

Sam-Account-Name limitation

According to TechNet of Microsoft, sAMAccountName is domain-wide uniqueness and 20-character limit for user objects. This character limitation of sAMAccountName cannot be changed because it is controlled by SAM Rule.

When I perform "Help New-ADUser -Full" in PowerShell of Windows Server 2012 or Windows Server 2012 R2,   the help of New-ADUser provided the same information about SamAccountName parameter for me.


Remark: Make sure the help file has been updated. If not, you cannot see the above information.

Test the uniqueness
Create 2 user accounts with more than 20-character in Active Directory.

1. On a domain controller, log in as Domain Administrator.
2. Launch "Active Directory Users and Computers".
3. Start to create a new user in Users container.


4. Next to "Full name" and "User logon name", enter "DevelopmentMSSQLSVC01".


First, "DevelopmentMSSQLSVC01" is more than 20-character and then User logon name (pre-Windows 2000) which is SamAccountName is stop at "0" because "0" is the 20 character of this account name.

5. Click "Next".
6. Provide and enter a password for this account.


7. Click "Next".
8. Click "Finish".
9. Start to create the second user in Users container.
10. Next to "Full name" and "User logon name", enter "DevelopmentMSSQLSVC02".


User logon name (pre-Windows 2000) of "DevelopmentMSSQLSVC02" is same as "DevelopmentMSSQLSVC01". 

11. Click "Next".


The pop-up window noticed that the pre-Windows 2000 which is SamAccountName have chosen so we have to change it to another one. Because all characters of "DevelopmentMSSQLSVC02" in pre-Windows 2000 logon is same as "DevelopmentMSSQLSVC01", it's proved that the SamAccountName must be unique.

12. Click "OK".
13. Click "Cancel".

For more information:

This posting is provided “AS IS” with no warranties, and confers no rights!

Thursday, December 26, 2013

Disk2vhd v2.0

Microsoft released a new version of Disk2vhd on 19-Dec-2013. This version, v2.0, supports to capture the physical hard disk to vhdx or vhd file formats. If you are interested in this tool, please go the following web site download and try it.

Download link:

For more information:

This posting is provided “AS IS” with no warranties, and confers no rights!

Friday, December 13, 2013

Configure Hyper-V dynamic memory in Windows Server 2012, Windows Server 2012 R2

Hyper-V Dynamic Memory is not new in Hyper-V environment. This feature started at Windows Server 2008 R2 SP1. In Windows Server 2012 and Windows Server 2012 R2, this feature is enhanced. Microsoft added "Minimum RAM" and worked with "Smart Paging".

Before configuring Hyper-V dynamic memory, make sure operating systems are installed latest integration services and support this feature.

Now, I will configure the VM, DC01.contoso.com, with dynamic memory for testing.

Lab environment
  • 1 standalone Hyper-V server installed Windows Server 2012
  • 1 VM installed Windows Server 2012 R2 named DC01.contoso.com

Assuming that DC01.contoso.com was installed successfully. If you would like the installation steps, please read "Install Windows Server 2012 with GUI".

1. On the Hyper-V server, log in as "Administrator".
2. Launch "Hyper-V Manager".
3. Right-click "DC01.contoso.com", select "Settings".


4. On left pane, select "Memory".


Startup RAM: Basically, this value of "Startup RAM" should be set to right amount. The right amount should be enough to boot up the Windows and related services in it.

Minimum RAM: The minimum value of the RAM should be assigned for the VM. You can measure the ram when the VM is idle and then insert the suitable value in it.

Maximum RAMThe maximum value of the RAM should be assigned for the VM. According to Microsoft, you should not insert the value greater than the guest operating system support value.

Memory bufferSpecifies how much memory Hyper-V will attempt to assign to the virtual machine compared to the amount of memory actually needed by the applications and services running inside the virtual machine. Memory buffer is specified as a percentage because the actual amount of memory that represents the buffer changes in response to changes in memory usage while the virtual machine is running. Hyper-V uses performance counters in the virtual machine that identify committed memory to determine the current memory requirements of the virtual machine and then calculates the amount of memory to add as a buffer. The buffer is determined using the following formula:

Amount of memory buffer = how much memory the virtual machine actually needs / (memory buffer value / 100).

For example, if the memory committed to the guest operating system is 1000 MB and the memory buffer is 20%, Hyper-V will attempt to allocate an additional 20% (200 MB) for a total of 1200 MB of physical memory allocated to the virtual machine. 

The minimum value is 5%.

Memory weight: Provides Hyper-V with a way to determine how to distribute memory among virtual machines if there is not enough physical memory available in the computer to give virtual machine its requested amount of memory.

5. Now, I set the following settings for the memory of "DC01.contoso.com".

  • Startup RAM: 1024
  • Minimum RAM: 512
  • Maximum RAM: 2048
  • Memory buffer: 10%
  • Memory weight: Lowest

6. Click "OK".
7. Power on "DC01.contoso.com".
8. Back to Hyper-V Manager, next to the bottom, click "Memory".


Now, DC01.contoso.com was assigned 1024 MB RAM.

After a few minutes, Hyper-V server automatically adjusted the memory value to minimum value for DC01.contoso.com because the memory demand of DC01.contoso.com is 296MB.


9. Right-click "DC01.contoso.com", select "Settings".
10. Next to "Memory".


When the VM is running, the value of "Startup RAM" cannot be adjusted. Plus, the value of "Minimum RAM" cannot be configure to be higher than original value when the VM is running and the value of "Maximum RAMcannot be configure to be lower than original value when the VM is running .



11. Click "Cancel".
12. Shut down "DC01.contoso.com".
13. Launch "PowerShell" as administrator.
14. Perform "Set-VMMemory -VMName DC01.contoso.com -DynamicMemoryEnabled $True -MinimumBytes 128MB - StartupBytes 128MB -MaximumBytes 1GB -Priority 0 -Buffer 10 -Passthru".


15. Perform "Start-VM DC01.contoso.com" to start the VM.
16. Back to Hyper-V Manager, next to the bottom, click "Memory".


The memory of DC01.contoso.com has been automatically adjusted because the startup RAM is not enough.

17. Log in DC01.contoso.com as administrator and then launch "System".


The "Installed memory (RAM)has been automatically adjusted in the VM.

Remark: The "Installed memory (RAM)" only updated the value which is higher than current.

Remark: If a VM is assigned static RAM setting, you cannot modify it to dynamic memory when the VM is running.


Should I configure the MemoryReserve registry setting?
Hyper-V running on Windows Server 2012 and Windows Server 2012 R2 automatically calculates an amount of memory to reserve for exclusive use by the management host operating system. This memory is used to run virtualization services. If the computer is part of a failover cluster, Hyper-V also reserves enough memory to run failover cluster services. In previous versions of Hyper-V, you might have needed to modify the MemoryReserve registry setting to ensure adequate memory for these functions. This is no longer necessary for Hyper-V running on Windows Server 2012 and Windows Server 2012 R2.

Quote from Hyper-V Dynamic Memory Ovreview

Reference:

This posting is provided “AS IS” with no warranties, and confers no rights!