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:
- 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)
- 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
-
Then Download the ADK 1709.
-
In our case we have stored it in in F:\Temp3
-
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 -
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.
-
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.
-
On the Please Select the SCVMM_1801.EXE window browse to f:\temp3\SCVMM_1801.Exe
-
On the Please Select the ADK1709.exe window browse to f:\temp3\adksetup.exe
-
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.
-
At this point it is time to sit back and relax as the next steps will happen automatically:
- Adding a New VHDx file from the Host
- Formatting the New VHDx file and giving it a volume label of Veeam
- Mounting the VHDx to the Host
- Copying the SCVMM1801.exe specified earlier
- Copying the ADK1709.exe specified earlier
- Extracts the SCVMM1801.exe to .\SCVMM
- Installs ADK1709 with Features for SCVMM
-
Installs SCVMM 1801 Server and Console
- 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
- 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 Disclaimer: 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 .Synopsis Deploys SCVMM 1801 Server to a Hyper-V Lab VM .DESCRIPTION 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 .EXAMPLE TODO: Dave, add something more meaningful in here .PARAMETER WorkingDir Transactional directory for files to be staged and written .PARAMETER VMname The name of the Virtual Machine .PARAMETER VMPath 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{ param ( [string]$VMName, [string]$GuestOSName, [string]$VMPath, [string]$WorkingDir ) #Ask for SCVMM EXE [reflection.assembly]::loadwithpartialname("System.Windows.Forms") $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 [reflection.assembly]::loadwithpartialname("System.Windows.Forms") $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' #$SQL = 'VMM01\MSSQLSERVER' #$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" Stop-Transcript 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 = @" [OPTIONS] CompanyName=MVPDays CreateNewSqlDatabase=1 SqlInstanceName=MSSQLSERVER SqlDatabaseName=VirtualManagerDB SqlMachineName=VMM01 LibrarySharePath=$($VMMDrive)\MSCVMMLibrary ProgramFiles=$($VMMDrive)\Program Files\Microsoft System Center\Virtual Machine Manager LibraryShareName=MSSCVMMLibrary 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" do{ Start-Sleep 1 }until ((Get-Process | Where-Object {$_.Description -eq "SetupVM"} -ErrorAction SilentlyContinue) -eq $null) Write-Output -InputObject "[$($VMName)]:: VMM has been Installed" Stop-Transcript } }
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
@DaveKawula