Disk Conversion Hyper-V vhd to vhdx – Cannot attach new disk on Virtual machine

Hyper-V includes a tool that can convert vhd disks to vhdx which is the newer version and should be used on production environments.

Sometimes the below error can occur which prevents one from attaching the new disk (vhdx) to the virtual machine needed. It seems as the new disk after the conversion to be locked and only by rebooting host the disk can be attached.

The process cannot access the file because it is being used by another process

This issue happens because the original disk is attached on the virtual machine during the conversion. The disk device should be attached as stated from Microsoft (link below). After the conversion the new disk can be attached and will not be locked from the host.

https://docs.microsoft.com/en-us/powershell/module/hyper-v/convert-vhd?view=win10-ps

Map Network drive location on Windows Server

The easiest way to perform massive identical installations on web servers that are located on the same network (VLAN) is through a network map of the remote location. With only two steps you can perform remote installations.

Firstly select map a network drive and assign a drive letter to the remote location.

Select map network drive

Select your preferred drive letter.

Map your network location server to a Drive letter
Open a terminal and just go to the specified location. In my case it was Z:

change directory to your remote location through a cmd or GUI and perform your installations.

Extend Disk with diskpart.exe – Windows server 2003

Below is the procedure on how to extend a disk space on Windows server 2003 through diskpart.exe. Tool is located under C:\Windows\system32\diskpart.exe

The extra disk space is provided through VMware hypervisor.

after the extend from VMware disk space is available on Disk Management.
commands to extend disk space

Manage Windows machines with Ansible (winrm)

Ansible is a very powerful automation tool that is developed from RedHat. Many large organizations rely on Ansible to automate tasks and procedures. In this article I will explain how one can use ansible to manage windows clients and servers.

In order to manage windows hosts ansible winrm plugin should be used to communicate with the client/server machine.

The first step is to verify that ansible is installed.

Alongside with ansible, on the control node the pywinrm module should be also installed. By default this one is not installed and one should do it manually.

The managed Windows client/server machines should be configured to allow remote connections. A very useful power shell script is already developed from other users and it needs only to be executed on the managed host.

If your execution policy is prohibiting this script to be executed, you should set-execution policy to RemoteSigned as shown below and then execute the powershell.

Control node should have network connectivity with the managed hosts.

Some environmental variables should be used, so that ansible knows how the connection will be performed (winrm). I included those variables in my inventory file as I created this lab just for demonstration. My inventory file looks like below:

Lastly make sure that the user that is used for the connection has administrative rights on the managed windows hosts. Otherwise some error codes will be returned.

Lastly confirm ansible on managed host is working by using win_ping module.

Documentation:

https://www.ansible.com/blog/connecting-to-a-windows-host