Sign in
Follow

Using the NetWatcher VM with Hyper-V

1) Convert the vmdk to a vhx.

There is a Microsoft tool that will convert the vmdk to a vhdx for you which can be downloaded here: https://www.microsoft.com/en-us/download/details.aspx?id=42497.

 

2) Create the batch file below and drag and drop the vmdk on to the convert.bat script.

Note: Pay attention to the location it lists when done because, even though the script specifies the same destination path as source path, it may put the vhdx in "c:\windows\system32\"

 

"convert.bat" should contain the following batch code (you might need to update the file path):

@echo off

REM --add the following to the top of your bat file--

set file=%1
FOR %%i IN ("%file%") DO (
set filedrive=%%~di
set filepath=%%~pi
set filename=%%~ni
)

set dst="%filedrive%%filepath%%filename%.vhdx"

:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "cmd.exe", "/c %~s0 "%1" "%dst%"", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------


echo "%1 => %2"

PowerShell.exe -Command "& Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1' ; ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath '%1' -DestinationLiteralPath '%dst%' -VhdType DynamicHardDisk -VhdFormat Vhdx"

pause

 

3) Create a new Hyper-V machine (generation 2 is fine). ***You must disable Secure Boot***

 

4) To capture traffic from a Hyper-V VM you also need to follow these steps:  http://www.arubanetworks.com/techdocs/ClearPass/6.6/InstallingOnVM_6.6_TechNote/Content/InstallOnHyperV/SPANconfig_HyperV.htm

 

 

Comments

Powered by Zendesk