Tuesday, 13 December 2016

How To use PowerShell DSC To Install and configure Hyper-V

In this article I’ll show you how to use PowerShell Desired State Configuration (DSC) to install and configure windows Hyper-V on windows 2012 Server.

DSC had been released with Windows Server 2008 R2 under PS framework 4.0 and continue with major enhancement in windows 2012, also comes with Server 2016 which was released recently.

To Know more about PowerShell DSC please refer my old article DSC Desired State Configuration

Using DSC we can do many process automation in Windows and Linux, also make sure server configuration is always compliant as per your desired config.

To automate any process using dsc we need to follow three easy steps, first need to create configuration block using Pre configured Microsoft Module or custom module. second compile mof file using configuration block for target node and last step need to push/pull configuration using those mof files against target node.

In my case i am using custom DSC module to install and configure Hyper-V.

I have Windows 2012 R2 server , Host name is HV-01.test.lab

  • Create config bloc using custom module.

  • Compile configuration in mof file for target node.

  • push/pull compiled mof to target server to install Hyper-V. 

  • Once you done with deployment, it will give you progress output.

  • Now you can access the Hyper-V Manager console.

Congratulations!! You successfully installed hyper-v using PowerShell DSC .

In next article i will show you how to add new host in Hyper-V and create new guest servers using PowerShell DSC.

Saturday, 10 December 2016

Upgrading previous versions of Windows Server to Windows Server 2016

This article briefly summarizes previous windows server operating systems can be upgraded to which editions of Windows Server 2016 on same hardware/VM.

Below table give detailed view for up-gradation path from windows server 2012 to windows server 2016.

If you are running this edition:
You can upgrade to these editions:
Windows Server 2012 Standard
Windows Server 2016 Standard or Datacenter
Windows Server 2012 Datacenter
Windows Server 2016 Datacenter
Windows Server 2012 R2 Standard
Windows Server 2016 Standard or Datacenter
Windows Server 2012 R2 Datacenter
Windows Server 2016 Datacenter
Windows Server 2012 R2 Essentials
Windows Server 2016 Essentials
Windows Storage Server 2012 Standard
Windows Storage Server 2016 Standard
Windows Storage Server 2012 Workgroup
Windows Storage Server 2016 Workgroup
Windows Storage Server 2012 R2 Standard
Windows Storage Server 2016 Standard
Windows Storage Server 2012 R2 Workgroup
Windows Storage Server 2016 Workgroup

Important Note to consider before plan for OS upgrade on same hardware.
  • Upgrades from a previous Windows Server installation to an evaluation copy of Windows Server are not supported. Evaluation versions should be installed as a clean installation.Upgrades that 
  • switch from a Server Core installation to a Server with a Desktop installation (or vice versa) are not supported.
  • Upgrades from one language to another are not supported.
  • Upgrades from 32-bit to 64-bit architectures are not supported. All editions of Windows Server 2016 are 64-bit only.
  • Upgrades that switch from a Server Core installation to a Server with a Desktop installation (or vice versa) are not supported. If the older operating system you are upgrading or converting is a Server Core installation, the result will still be a Server Core installation of the newer operating system.

Sunday, 27 November 2016

How to Convert Windows Server 2012 Core to Full GUI OR Full GUI to Core-using Powershell

Windows Server 2012 introduced with many new features and one of that in Core OS. 
Core OS boasts many enhancements which include reducing the installation footprint, attack surface and management overhead. One of the good option is Features on Demand it allows the administrator to remove roles which are not needed to help reduce the disk size required for the installation.  By default, all features are stored in the %windir%\winsxs directory, but administrators can use the uninstall-windowsfeature <featurename> –remove command to delete the files associated with that feature from the winsxs directory. 

Windows 2012 Core OS come with windows feature called Server-Gui-Shell feature, which can be install and uninstall as required and this feature only provide the flexibility to jump from Windows Core to Windows Full GUI and Vice Versa.

How to convert from Full Gui To Core
Please follow below steps to convert Windows server 2012 Full GUI to Core 
  • Run PowerShell as administration.
  • Execute the command uninstall-windowsfeature server-gui-mgmt-infra,server-gui-shell –restart as showed in below snap, it will start removing Gui shell from windows feature.
  • Once feature uninstall complete server will reboot and you will able to login in to Windows server Core OS.
     How to convert from Core to Full Gui
      If you have removed the Server-Gui-Shell feature from Windows Server 2012 or you install Server Core edition and want to convert to full GUI, you must perform few extra steps tasks that prior to execute the actual PowerShell command to convert Core to Full Gui.
  • Mount the Windows Server 2012 ISO/Media to the server.
  • Run the command prompt as administrator.
  • Make Directory called source on C: using “mkdir c:\soruce” command.
  • To check your image wim file index using command “dism /get-imageinfo /ImageFile:d:\sources\install.wim”.

  • Mount wim file using command “dism /mount-wim /wimfile:d:\sources\install.wim /index:4 /mountdir:c:\soruce /readonly”
  • Once image mounting is completed 100%, run PowerShell command on came command prompt.
  • Execute PS command “install-windowsfeature server-gui-mgmt-infra,server-gui-shell –restart –source c:\source\windows\winsxs” to convert Core OS to Full GUI.

  • It will start installing windows Shell gui windows feature on server using required dll files from mounted imange wim file.

  • Once all installation completed 100% server will reboot automatically and you will be able to login in to Full Gui mode once server is online.

Wednesday, 23 November 2016

Error While enabling the Update Manager plug-in VCenter, fails with the Error : database unavailable or has network problems

Problem |

Unable to enable Update Manager
While trying to enable Update Manager found below error:

Error: ”There was an error connecting to VMware vCenter Update Manager <server name>:443. Database temporarily unavailable or has network problems.

Check \Update Manager\vmware-vum-server-log4cpp.log log file for below error.

'Activation' 3296 ERROR] [activationValidator, 237] vim.fault.DatabaseError
 'Activation' 3296 ERROR] [activationValidator, 244] No started
'Activation' 3296 INFO] [activationValidator, 249] Leave Validate. Failed
862 'VcIntegrity' 3416 ERROR] [vcIntegrity, 807] ODBC error: (VMU-01) - [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Root Cause |
Update Manager is installed with a remote SQL 2005, 2008 or 2012 database using Windows Authentication and the Update Manager Service is set to log in as a Local System Account.

Follow below steps to fix this issue |

To resolve this issue, change the Update Manager Service to log on to the remote database as a Windows account with Administrator privileges:

  • Click Start > Run, type services.msc, and click OK.
  • Right-click VMware Update Manager and click Properties.
  • Click the Log on tab.
  • Select This account, specify the Windows account along with the appropriate password, which is used during Database configuration, then click OK.
  • Right-click VMware Update Manager and click Restart.

Tuesday, 18 October 2016

What is new in Windows Server-2016

Windows Server 2016 is now available for use, Windows administrators should be excited for a ton of new features coming from Microsoft in the server space, Its release mirrors contemporary information technology trends of containerization and hybrid connectivity with cloud services. Docker-driven containers and Nano Server to software-defined storage and networking improvements, Windows Server 2016 is packed with great new features.

  •          Nano Server
  •          Container support
  •          Hyper-V
  •          Storage
  •          Failover Cluster

Nano Server
Nano Server boasts a 90 percent smaller installation footprint than the Windows Server graphical user interface (GUI) installation option. Beyond just that, these compelling reasons may make you start running Nano for at least some of your Windows Server workloads:Bare-metal OS means far fewer updates and reboots are necessary. Because you have to administratively inject any server roles from outside Nano, the server has a much-reduced attack surface when compared to GUI Windows Server. Nano is so small that it can be ported easily across servers, data centers and physical sites.Nano hosts the most common Windows Server workloads, including Hyper-V host.

Nano is intended to be managed completely remotely. However, Nano does include a minimal local management UI called "Nano Server Recovery Console," shown in the previous screenshot, that allows you to perform initial configuration tasks.

Container support

Containers are the next evolution in virtualization; a container is an isolated place where an application can run without affecting the rest of the system and without the system affecting the application.
Microsoft is working closely with the Docker development team to bring Docker-based containers to Windows Server. Until now, containers have existed almost entirely in the Linux/UNIX open-source world. They allow you to isolate applications and services in an agile, easy-to-administer way. Windows Server 2016 offers two different types of "containerized" Windows Server instances:

Windows Server Container. This container type is intended for low-trust workloads where you don't mind that container instances running on the same server may share some common resources.  Provide application isolation through process and namespace isolation technology. A Windows Server container shares a kernel with the container host and all containers running on the host.

Hyper-V Container. This isn't a Hyper-V host or VM. Instead, its a "super isolated" containerized Windows Server instance that is completely isolated from other containers and potentially from the host server. Hyper-V containers are appropriate for high-trust workloads. Expand on the isolation provided by Windows Server Containers by running each container in a highly optimized virtual machine. In this configuration the kernel of the container host is not shared with the Hyper-V Containers.

Description: Credit: Microsoft


The recent release of Microsoft Windows Server 2016 new capabilities and features coming to the final release of the server OS,  among many new features, includes an improved version of its Hyper-V virtualization technology. the many new features in Windows Server 2016, many IT pros are looking to see new capabilities in Hyper-V

Linux Secure Boot Secure Boot is part of the Unified Extensible Firmware Interface (UEFI) specification that protects a server's startup environment against the injection of rootkits or other assorted boot-time malware.The problem with Windows Server-based Secure Boot is that your server would blow up (figuratively speaking) if you tried to create a Linux-based Generation 2 Hyper-V VM because the Linux kernel drivers weren't part of the trusted device store. Technically, the VM's UEFI firmware presents a "Failed Secure Boot Verification" error and stops startup. Windows Server and Azure engineering teams seemingly love Linux. Therefore, we can now deploy Linux VMs under Windows Server 2016 Hyper-V with no trouble without having to disable the otherwise stellar Secure Boot feature. Ubuntu 14.04 and later, SUSE Linux Enterprise Server 12 and later, Red Hat Enterprise Linux 7.0 and later, and Cent OS 7.0 and later are enabled for Secure Boot on hosts that run Windows Server 2016.

Compatible with Connected Standby Hyper-V role is installed on a computer that uses the Always On/Always Connected (AOAC) power model, the Connected Standby power state is now available

Discrete device assignment This feature lets you give a virtual machine direct and exclusive access to some PCIe hardware devices. Using a device in this way bypasses the Hyper-V virtualization stack, which results in faster access

Hot add and remove for network adapters and memory You can now add or remove a network adapter while the virtual machine is running, without incurring downtime. This works for generation 2 virtual machines that run either Windows or Linux operating systems Hyper-V Server has allowed us to add virtual hardware or adjust the allocated RAM to a virtual machine. However, those changes historically required that we first power down the VM. In Windows Server 2016, we can now "hot add" virtual hardware while VMs are online and running. I was able to add an additional virtual network interface card (NIC) to my running Hyper-V virtual machine.

Nested Virtualization This feature lets you use a virtual machine as a Hyper-V host and create virtual machines within that virtualized host. This can be especially useful for development and test environments. This has historically been a "no go" in Windows Server Hyper-V, but we finally have that ability in Windows Server 2016. Nested virtualization makes sense when a business wants to deploy additional Hyper-V hosts and needs to minimize hardware costs.


Storage Spaces Direct

Storage Spaces is a cool Windows Server feature that makes it more affordable for administrators to create redundant and flexible disk storage. Storage Spaces Direct in Windows Server 2016 extends Storage Spaces to allow failover cluster nodes to use their local storage inside this cluster, avoiding the previous necessity of a shared storage fabric.

Storage Spaces Direct uses industry-standard servers with local-attached drives to create highly available, highly scalable software-defined storage at a fraction of the cost of traditional SAN or NAS arrays. Its converged or hyper-converged architecture radically simplifies procurement and deployment, while features like caching, storage tiers, and erasure coding, together with the latest hardware innovation like RDMA networking and NVMe drives, deliver unrivaled efficiency and performance.

Storage Quality of Service (QoS)
You can now use storage quality of service (QoS) to centrally monitor end-to-end storage performance and create management policies using Hyper-V and CSV clusters in Windows Server 2016.

Failover Clustering
Windows Server 2016 includes a number of new features and enhancements for multiple servers that are grouped together into a single fault-tolerant cluster using the Failover Clustering feature.

Cloud Witness
Cloud Witness is a new type of Failover Cluster quorum witness in Windows Server 2016 that leverages Microsoft Azure as the arbitration point. The Cloud Witness, like any other quorum witness, gets a vote and can participate in the quorum calculations. You can configure cloud witness as a quorum witness using the Configure a Cluster Quorum Wizard.

Fault Domains
Enables you to define what fault domain to use with a Storage Spaces Direct cluster. A fault domain is a set of hardware that share a single point of failure, such as a server node, server chassis, or rack.

Workgroup and Multi-domain clusters
In Windows Server 2012 R2 and previous versions, a cluster can only be created between member nodes joined to the same domain. Windows Server 2016 breaks down these barriers and introduces the ability to create a Failover Cluster without Active Directory dependencies. You can now create failover clusters in the following configurations:

Single-domain Clusters. Clusters with all nodes joined to the same domain.
Multi-domain Clusters. Clusters with nodes which are members of different domains.
Workgroup Clusters. Clusters with nodes which are member servers / workgroup (not domain joined).

There are many more features has been introduced with new windows 2016 server other than I explained above.

Friday, 5 August 2016

Create Datacenter and add ESXi host to VMware Vcenter 6.0 using PowerCLI

VMware vSphere PowerCLI is a command-line interface (CLI) tool for automating vSphere and vCloud management. VMware vSphere PowerCLI debuted as the VMware Infrastructure Toolkit, also called the VI Toolkit.
PowerCLI commands are executed in Windows PowerShell by using PowerShell cmdlets. PowerCLI cmdlets are available for VMware High Availability and Distributed Resource Scheduler setup, infrastructure activity reporting, VM ownership alerts and other tasks. 
PowerCLI 6.3 Release1 requires Windows  PowerShell 3.0 and a supported version of .NET Framework. This latest tool version includes the vCloud Director PowerCLI snapin. 
In this chapter we are going connect VI servers using PowerCLI and create new DataCenter in VCenter, also we how to add new host in VCenter server using PowerCLI.
Connect to VCenter Server.

To Connect VCenter server using powercli cmdlet "Connect-VIServer"

Creating a new DataCenter

To Create New DataCenter Name Called "LAB" use PowerCLI cmdlet "New-Datacenter"

Once DataCenter is crated you can cross verify using "Get-DataCenter" Command.

Add Esxi Host to Newly created DataCenter "LAB"

To add new Esxi host to newly created Datacenter use "Add-VMHost" command.

monitor the progress on screen

Once host get added successfully you can seen connection status and all other host related details like CPU, Memory usages, total CPU and Memory capacity.

To check all host in Data Center you can use "Get-VMhost", it will show list of host under VCenter DataCenter.

I will be adding more article for VMware administration with PowerCLI  

Tuesday, 19 July 2016

How to Install a New Windows Server 2012 Active Directory Forest using PowerShell

There are many ways/methods are available to install the Active Directory, here I am going to explain you one of the PowerShell command line method to install Active Directory.
This step by step process explain you to install AD using PS command.
In Windows Server 2012, AD DS replaces the Dcpromo tool with a Server Manager and Windows PowerShell-based deployment system.
To install activity directory on windows Server 2012, we need to first install AD-DS Service
Install AD-DS Service using windows feature PS command as shown in below.
PS C:\> Add-WindowsFeature ad-domin-services
Once installation started you will see progress bar to give you status on it.
Once installation completed you will get successful installation exit code as shown below.
PS C:\> Add-WindowsFeature ad-domain-services

Success Restart Needed Exit Code      Feature Result                          
------- -------------- ---------      --------------                          
True    No             Success        {Active Directory Domain Services, Rem...

PS C:\> 
Now next step to start the actual installation of your Activity directory installation new DC in new Forest, go to PowerShell command control use the “Install-ADDSForest” command with -DomainName switch like showed in below.
PS C:\> Install-ADDSForest -DomainName sysadminworld.lab

Once you enter it will ask you to provide the “Safemodeadministratorpassword” you should remember this pass word since this password will useful when you restore the Active Directory please refer below snap.
PS C:\> Install-ADDSForest -DomainName sysadminworld.lab
SafeModeAdministratorPassword: ********
Confirm SafeModeAdministratorPassword: ********
Once you confirm the password it will as you reboot confirmation after successfully installation completed press Y to yes
PS C:\> Install-ADDSForest -DomainName sysadminworld.lab
SafeModeAdministratorPassword: ********
Confirm SafeModeAdministratorPassword: ********

The target server will be configured as a domain controller and restarted when this operation is
Do you want to continue with this operation?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Once you confirm it will start installing AD on your server, it will show each background installation task progress.
After installation is completed you will get successful status message .
PS C:\> Install-ADDSForest -DomainName sysadminworld.lab
SafeModeAdministratorPassword: ********


   Validating environment and user input
      All tests completed successfully
   Installing new forest
      Configuring the DNS Server service on this computer...

Congratulation you have successfully installed AD