Hey Checkyourlogs Fans,

In this blog post I will show you how you can deploy SCVMM 1801 to a Hyper-V Virtual Machine. This is a really handy little script because it can help you get System Center Virtual Machine Manager going in your lab in a snap. The basic steps to accomplish this are as follows:

  1. Create a Hyper-V Virtual Machine running Windows Server 2016. In my case I have created a VM called VMM01. (I built these using my BIGDemo Script)
  2. Next you will need to download a copy of System Center 1801 Virtual Machine Manager from https://www.microsoft.com/en-us/evalcenter/evaluate-system-center-release
  3. Then Download the ADK 1709.
  4. In our case we have stored it in in F:\Temp3

  5. Next grab a copy of the PowerShell script from my GITHub Repository. https://raw.githubusercontent.com/dkawula/Operations/master/System%20Center/Install-SCVMM-Hyper-V.ps1
    and save it to f:\Temp3
  6. Open an Administrative PowerShell Prompt and change the path to f:\temp1. Then type .\Import-Module .\Install-SCVMM-HyperV.PS1 -Force -Verbose and press Enter. This will load the Install-Veeam Module which we will use to deploy Veeam to our lab.

  7. Next type Install-SCVMM -VMName SCOM01 -GuestOSName SCOM01 -VMPath f:\dcbuild_test\vms and press enter.

    For this lab we assume that you had previously deployed SQL Server in the next blog post we will show you how to Deploy SQL Server from the Install-SQL script.

  8. On the Please Select the SCVMM_1801.EXE window browse to f:\temp3\SCVMM_1801.Exe


  9. On the Please Select the ADK1709.exe window browse to f:\temp3\adksetup.exe

  10. Next input the credentials for your lab. In my case I will install using my Domain Administrator Account MVPDays\Administrator. We will pipe this into the VM using PowerShell direct with the $DomainCred variable.

  11. At this point it is time to sit back and relax as the next steps will happen automatically:
    1. Adding a New VHDx file from the Host
    2. Formatting the New VHDx file and giving it a volume label of Veeam
    3. Mounting the VHDx to the Host
    4. Copying the SCVMM1801.exe specified earlier
    5. Copying the ADK1709.exe specified earlier
    6. Extracts the SCVMM1801.exe to .\SCVMM
    7. Installs ADK1709 with Features for SCVMM
    8. Installs SCVMM 1801 Server and Console
      1. Logs can be located at %ProgramData\SCVMM\Logs

      [DPM01]:: Installing VMM

      [VMM01]:: Adding Drive for VMM Install

      [VMM01]:: Copying VMM 1801 EXE to the new VHDx

      [VMM01]:: Copying ADK to the new VHDx

      []:: Adding the new VHDx for the VMM Install

      []:: Downloading ADK

      Transcript started, output file is F:\ADK_Install.log

      []:: Script started at 02/15/2018 15:32:57

      []:: Installing ADK…

      []:: ADK Is being installed…

      []:: ADK install finished at 02/15/2018 15:41:51 and took 8.904322665 Minutes

      Transcript stopped, output file is F:\ADK_Install.log

      Transcript started, output file is F:\SCVMM_Install.log

      []:: Waiting for VMM Install to Extract

      []:: Installing VMM

      []:: VMM Is Being Installed

      []:: VMM has been Installed

  12. Your finished product will look just like this:

For your reference here is a copy of the script:

Created:	 2018-02-01
Version:	 1.0
Author       Dave Kawula MVP
Homepage:    http://www.checkyourlogs.net

This script is provided "AS IS" with no warranties, confers no rights and 
is not supported by the authors or CheckyourLogs or MVPDays Publishing

Author - Dave Kawula
    Twitter: @DaveKawula
    Blog   : http://www.checkyourlogs.net

    Deploys SCVMM 1801 Server to a Hyper-V Lab VM
    This Script was part of my BIGDemo series and I have broken it out into a standalone function

    You will need to have a SCVMM Service Accounts Pre-Created and SCOM1801 Trial Media for this lab to work
    The Script will prompt for the path of the Files Required
    The Script will prompt for an Admin Account which will be used in $DomainCred
    If your File names are different than mine adjust accordingly.

    We will use PowerShell Direct to setup the Veeam Server in Hyper-V

    The Source Hyper-V Virtual Machine needs to be Windows Server 2016

    TODO: Dave, add something more meaningful in here
    .PARAMETER WorkingDir
    Transactional directory for files to be staged and written
    The name of the Virtual Machine
    The Path to the VM Working Folder - We create a new VHDx for the Veeam Install
    .PARAMETER GuestOSName
    Name of the Guest Operating System Name

    Usage: Install-SCVMM -Vmname YOURVM -GuestOS VEEAMSERVER -VMpath f:\VMs\SCVMM -WorkingDir f:\Temp 
  #Installs SCVMM 1801 for your lab

 Function Install-SCVMM{


     #Ask for SCVMM EXE

        $openFile = New-Object System.Windows.Forms.OpenFileDialog -Property @{
            Title="Please Select the SCVMM 1801 .EXE"
        $openFile.Filter = "exe files (*.exe)|*.exe|All files (*.*)|*.*" 
        If($openFile.ShowDialog() -eq "OK")
              Write-Host "File $($openfile.FileName) selected"
        if (!$openFile.FileName){
                WriteErrorAndExit  "Iso was not selected... Exitting"
            $SCVMMEXE = $openfile.FileName
     #Ask for ADK1709 EXE

        $openFile = New-Object System.Windows.Forms.OpenFileDialog -Property @{
            Title="Please Select the ADK1709 .EXE"
        $openFile.Filter = "exe files (*.exe)|*.exe|All files (*.*)|*.*" 
        If($openFile.ShowDialog() -eq "OK")
              Write-Host "File $($openfile.FileName) selected"
        if (!$openFile.FileName){
                WriteErrorAndExit  "Iso was not selected... Exitting"
            $SCVMMEXE = $openfile.FileName

     $DomainCred = Get-Credential
     #$VMName = 'SCOM01'
     #$GuestOSname = 'SCOM01'
     #$VMPath = 'f:\dcbuild_Test\VMs'
     #$SCOMDrive = 'd:'

    Write-Output -InputObject "[$($VMName)]:: Adding Drive for VMM Install"

    New-VHD -Path "$($VMPath)\$($GuestOSName) - VMM Data 2.vhdx" -Dynamic -SizeBytes 50GB 
    Mount-VHD -Path "$($VMPath)\$($GuestOSName) - VMM Data 2.vhdx" 
    $DiskNumber = (Get-Diskimage -ImagePath "$($VMPath)\$($GuestOSName) - VMM Data 2.vhdx").Number
    Initialize-Disk -Number $DiskNumber -PartitionStyle GPT 
    Get-Disk -Number $DiskNumber | New-Partition -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS -NewFileSystemLabel "VMM" -Confirm:$False
    $Driveletter = get-wmiobject -class "Win32_Volume" -namespace "root\cimv2" | where-object {$_.Label -like "VMM*"}
    $VMMDriveLetter = $DriveLetter.DriveLetter
    Write-Output -InputObject "[$($VMName)]:: Copying VMM 1801 EXE to the new VHDx"
    Copy-Item -Path "$SCVMMEXE\SCVMM_1801.exe" -Destination "$($VMMDriveLetter)\SCVMM_1801.exe" -Force
    Write-Output -InputObject "[$($VMName)]:: Copying ADK 1709 to the new VHDx"
    Copy-Item -Path "$ADKEXE\adksetup.exe" -Destination "$($VMMDriveLetter)\adksetup.exe" -Force
    Dismount-VHD -Path "$($VMPath)\$($GuestOSName) - VMM Data 2.vhdx"
    Add-VMHardDiskDrive -VMName $VMName -Path "$($VMPath)\$($GuestOSName) - VMM Data 2.vhdx" -ControllerType SCSI

      icm -VMName $VMName -Credential $domainCred {

    Write-Output -InputObject "[$($VMName)]:: Adding the new VHDx for the VMM Install"
    Get-Disk | Where OperationalStatus -EQ "Offline" | Set-Disk -IsOffline $False 
    Get-Disk | Where Number -NE "0" |  Set-Disk -IsReadOnly $False
    $Driveletter = get-wmiobject -class "Win32_Volume" -namespace "root\cimv2" | where-object {$_.Label -like "VMM*"}
    $VMMDrive = $Driveletter.DriveLetter

     Write-Output -InputObject "[$($VMName)]:: Downloading ADK"
     #Invoke-webrequest -uri https://go.microsoft.com/fwlink/p/?linkid=859206 -OutFile "$($VMMDrive)\adksetup.exe"
    # (New-Object System.Net.WebClient).DownloadFile("https://go.microsoft.com/fwlink/p/?linkid=859206","f:\iso\adksetup.exe")

     #Sample ADK install

        # You can grab ADK here:     https://msdn.microsoft.com/en-us/windows/hardware/dn913721.aspx

        Start-Transcript -Path "$($VMMDrive)\ADK_Install.log"

        $StartDateTime = get-date

        Write-Output -InputObject "[$($VMName)]:: Script started at $StartDateTime"

        $setupfile = "$($VMMDrive)\ADKsetup.exe"
        Write-Output -InputObject "[$($VMName)]:: Installing ADK..."

        Write-Output -InputObject "[$($VMName)]:: ADK Is being installed..."
        Start-Process -Wait -FilePath $setupfile -ArgumentList "/features OptionID.DeploymentTools OptionID.WindowsPreinstallationEnvironment /quiet"

        Write-Output -InputObject "[$($VMName)]:: ADK install finished at $(Get-date) and took $(((get-date) - $StartDateTime).TotalMinutes) Minutes"



        Start-Transcript -Path "$($VMmDrive)\SCVMM_Install.log"

        $StartDateTime = get-date

       $null = Get-Service MSSQLServer | Start-Service

       $Null = cmd.exe /c "$($VMMDrive)\SCVMM_1801.exe /dir=$($vmmdrive)\SCVMM /silent"

       Write-Output -InputObject "[$($VMName)]:: Waiting for VMM Install to Extract"
       Start-Sleep 120

       $setupfile = "$($VMMDrive)\SCVMM\setup.exe"
       Write-Output -InputObject "[$($VMName)]:: Installing VMM"


        ###Get workdirectory###

        #Install VMM
        $unattendFile = New-Item "$($VMMDrive)\VMServer.ini" -type File

     $FileContent = @"







        ProgramFiles=$($VMMDrive)\Program Files\Microsoft System Center\Virtual Machine Manager


        SQMOptIn = 1

        MUOptIn = 1
        Set-Content $unattendFile $fileContent

        Write-Output -InputObject "[$($VMName)]:: VMM Is Being Installed"

        Get-Service MSSQLServer | Start-Service -WarningAction SilentlyContinue

        #02/13/2018 - DK $VMMDomain isn't quite working yet so I hard coded to MVPDays for now to get it working.

        cmd.exe /c "$vmmdrive\scvmm\setup.exe /server /i /f $VMMDrive\VMServer.ini /IACCEPTSCEULA /VmmServiceDomain MVPDays /VmmServiceUserName SVC_VMM /VmmServiceUserPassword P@ssw0rd"


        Start-Sleep 1

        }until ((Get-Process | Where-Object {$_.Description -eq "SetupVM"} -ErrorAction SilentlyContinue) -eq $null)

        Write-Output -InputObject "[$($VMName)]:: VMM has been Installed"




I hope you enjoyed this post and please feel free to update my code, use it in your lab, and as always happy learning.

Dave Kawula – Microsoft MVP