Is storage expensive – part 3 – Setting up the SCOM Infra
Post creation of the storage (virtual disk) from storage spaces, this post is about creation of the VMs, installation of software as and required configuration for bring up the SCOM part of the log infra. Unless supported, my preferred chose for windows server is server core or may be server core with management GUI. SCOM components, including the SQL supports that and hence I will be using the same here. I usually would have a OS VM template, patched fully and syspreped to start with VM provisioning. In case of no hard disk layout change required, use VHD copy method or else use the WIM file created from VHD using “DISM.exe /Capture-Image”.
VHD copy way of provision VMs
$VMOSTemplateFile='C:\ClusterStorage\P0-TV0-VHD\Virtual Machines\Loginfra-VM-template\Virtual Hard Disks\Loginfra-VM-template.vhdx' $VMLocalFolder="C:\ClusterStorage\P0-TV0-VHD\Virtual Machines" $VMProvisionOU = "OU=LogInfra,OU=Member Servers,DC=mydc,DC=com" $vmsrvlist="VM1","VM2","VM3","VM4” $Transcriptname="LogInfra-VMCreation-" + (Get-Date -Format s).Replace(":","-") +".txt" $TranscripFile=Join-Path "c:\dump" $Transcriptname $startIP=102 $IPconffile="Dump\IP.csv" Write-Host "All Actions would be recorded into file " $TranscripFile -ForegroundColor White start-transcript $TranscripFile foreach ( $LoginfVM in $vmsrvlist ) { Write-Host "Starting Installation for VM:" $LoginfVM -ForegroundColor Green $VMFolder = Join-Path $VMLocalFolder $LoginfVM $VMOSVHD = $LoginfVM+"-disk1.vhdx" $VMVHDDFolder = Join-Path $VMFolder "Virtual Hard Disks" $VMVHDDFile = Join-Path $VMVHDDFolder $VMOSVHD $VMDISMLogFile = Join-Path $VMFolder $LoginfVM"-dism.log" $VMOFLDOMFile = Join-Path $VMVHDDFolder "vmd.txt" mkdir $VMVHDDFolder Copy-Item -Path $VMOSTemplateFile -Destination $VMVHDDFile Mount-DiskImage -ImagePath $VMVHDDFile $VMSysDisk=Get-DiskImage -ImagePath $VMVHDDFile -StorageType VHDX -Verbose if ( $VMSysDisk.Attached -ne "True" ) { throw "Not able to mount the VM VHD file for OS installation" } (Get-Disk $VMSysDisk.Number|Get-Partition)[1]|Add-PartitionAccessPath -AssignDriveLetter -Verbose $driveSystem = $(Get-Disk $VMSysDisk.Number|Get-Partition).AccessPaths[1] $drive = $(Get-Disk $VMSysDisk.Number|Get-Partition).AccessPaths[2] Set-WindowsProductKey -ProductKey "DBGBW-NPF86-BJVTX-K3WKJ-MTB6V" -Path $drive -SystemDrive $driveSystem
WMI way of provisioning VM with the ability to specify the VHD size
$VMOSWIMFile="C:\ClusterStorage\Cluster_VHD\ISO\WS2012R2_cust_Mar15.WIM" $VMLocalFolder="C:\ClusterStorage\P0-TV0-VHD\Virtual Machines" $VMProvisionOU = "OU=LogInfra,OU=Member Servers,DC=mydc,DC=com" $vmsrvlist="VM1","VM2","VM3","VM4” $Transcriptname="LogInfra-VMCreation-" + (Get-Date -Format s).Replace(":","-") +".txt" $TranscripFile=Join-Path "c:\dump" $Transcriptname $startIP=102 $IPconffile="Dump\IP.csv" Write-Host "All Actions would be recorded into file " $TranscripFile -ForegroundColor White start-transcript $TranscripFile foreach ( $LoginfVM in $vmsrvlist ) { Write-Host "Starting Installation for VM:" $LoginfVM -ForegroundColor Green $VMFolder = Join-Path $VMLocalFolder $LoginfVM $VMOSVHD = $LoginfVM+"-disk1.vhdx" $VMVHDDFolder = Join-Path $VMFolder "Virtual Hard Disks" $VMVHDDFile = Join-Path $VMVHDDFolder $VMOSVHD $VMDISMLogFile = Join-Path $VMFolder $LoginfVM"-dism.log" $VMOFLDOMFile = Join-Path $VMVHDDFolder "vmd.txt" New-VHD -Path $VMVHDDFile -SizeBytes 100GB -Dynamic Mount-DiskImage -ImagePath $VMVHDDFile $VMSysDisk=Get-DiskImage -ImagePath $VMVHDDFile -StorageType VHDX -Verbose if ( $VMSysDisk.Attached -ne "True" ) { throw "Not able to mount the VM VHD file for OS installation" } Initialize-Disk -Number $VMSysDisk.Number -PartitionStyle GPT -Verbose $PartitionSystem = New-Partition -DiskNumber $VMSysDisk.Number -Size 100MB -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Verbose $partition = New-Partition -DiskNumber $VMSysDisk.Number -UseMaximumSize -GptType '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}' -Verbose @" select disk $($VMSysDisk.Number) select partition $($partitionSystem.PartitionNumber) format fs=fat32 label="System" "@ | & $env:SystemRoot\System32\DiskPart.exe | Out-Null $volume = Format-Volume -Partition $partition -FileSystem NTFS -Force -Confirm:$false -Verbose $partitionSystem | Add-PartitionAccessPath -AssignDriveLetter -Verbose $driveSystem = $(Get-Disk $VMSysDisk.Number|Get-Partition).AccessPaths[1] $partition | Add-PartitionAccessPath -AssignDriveLetter -Verbose $drive = $(Get-Disk $VMSysDisk.Number|Get-Partition).AccessPaths[2] Write-Host " Installing OS to" $drive "And boot code to" $driveSystem -ForegroundColor Green #OS Injection Expand-WindowsImage -ImagePath $VMOSWIMFile -ApplyPath $drive -Index 1 -LogPath $VMDISMLogFile Set-WindowsProductKey -ProductKey "DBGBW-NPF86-BJVTX-K3WKJ-MTB6V" -Path $drive -SystemDrive $driveSystem bcdboot.exe $drive"Windows" /s $driveSystem /v /f UEFI
Both these options would make the VHDX file ready the part here after is common to get the VM provisioned using the VHDX file
Write-Host " Trying to Offline Domain Join the VM" $LoginfVM -ForegroundColor Green djoin /provision /domain mydc.com /machine $LoginfVM /savefile $VMOFLDOMFile /machineou $VMProvisionOU djoin /requestodj /loadfile $VMOFLDOMFile /windowspath $drive"Windows" $IP_addr=""|Select IPAddress,PrefixLength,DefaultGateway $IP_addr.IPAddress="10.10.10."+$startIP $IP_addr.PrefixLength=24 $IP_addr.DefaultGateway="10.10.10.1" $startIP++ $IP_addr|epcsv -path (Join-Path $drive $IPconffile) All done on the VHD and now to dismount and proceed with configuration at hyper-v level $VMSysDisk|Dismount-DiskImage -Verbose $VM=New-VM -Name $LoginfVM -MemoryStartupBytes 16GB -Generation 2 -Path $VMFolder -SwitchName 10GBB-N5K-VSW1 -VHDPath $VMVHDDFile -Verbose $VM|Set-VM -ProcessorCount 6 -AutomaticStartAction Start -AutomaticStopAction ShutDown -Verbose $VM|Add-VMNetworkAdapter -SwitchName 10GBB-N5K-VSW2 -Verbose #$VM|Set-VMNetworkAdapter -AllowTeaming On -IovWeight 100 -Verbose $VM|Set-VMNetworkAdapter -AllowTeaming On -Verbose $VM | Start-VM } stop-transcript
With the required VMs and virtual disk in place, time to bring up the infra
1) SQL for SCOM DB
a. Virtual Disk of 25GB SSD + 200GB SAS NL for data base files, mounted as S drive
b. Virtual Disk of 16GB SSD for SQL TempDB, mounted as T drive
c. Get both .NET 3.5 and 4 installed
d. Mount the ISO with mount-diskimage or attached to VM
e. Install SQL with the command line option
Setup.exe /UIMODE=EnableUIONServerCore /ACTION=Install /FEATURES=SQL,CONN,IS /UpdateEnabled=1 /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS /INSTALLSQLDATADIR=S:\SQL /SQLTEMPDBDIR=T:\SQLTDB /SQLTEMPDBLOGDIR=T:\SQLTDB /SQLSVCACCOUNT="mydc\sqlsvc" /SQLSVCPASSWORD="passw0rd" /SQLSYSADMINACCOUNTS="mydc\scomadmin" "mydc\scomaction" "mydc\myself" "mydc\Domain Admins" /AGTSVCACCOUNT="mydc\sqlsvc" /AGTSVCPASSWORD="passw0rd" /TCPENABLED=1 /IACCEPTSQLSERVERLICENSETERMS
i. This would give the normal SQL installation GUI for the remaining part of the SQL installation
2) SQL for SCOM DW
a. Virtual Disk of 50GB SSD + 1TB SAS NL for data base files, mounted as S drive
b. Virtual Disk of 16GB SSD for SQL TempDB, mounted as T drive
c. Get both .NET 3.5 and 4 installed
d. Mount the ISO with mount-diskimage or attached to VM
e. Install SQL with the command line option
Setup.exe /UIMODE=EnableUIONServerCore /ACTION=Install /FEATURES=SQL,CONN,IS /UpdateEnabled=1 /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS /INSTALLSQLDATADIR=S:\SQL /SQLTEMPDBDIR=T:\SQLTDB /SQLTEMPDBLOGDIR=T:\SQLTDB /SQLSVCACCOUNT="mydc\sqlsvc" /SQLSVCPASSWORD="passw0rd" /SQLSYSADMINACCOUNTS="mydc\scomadmin" "mydc\scomaction" "mydc\myself" "mydc\Domain Admins" /AGTSVCACCOUNT="mydc\sqlsvc" /AGTSVCPASSWORD="passw0rd" /TCPENABLED=1 /IACCEPTSQLSERVERLICENSETERMS
3) SCOM Management Server installation
a. Virtual Disk of 50GB SSD + 150GB SAS NL, 50GB VHDX file for each SCOM management server, attached as S drive to install SCOM into it
b. Disable firewall on SQL servers and Start SQL agent service
c. Install first mgmt server with command line
“setup.exe /silent /install /InstallPath:S:\SCOM /components:OMServer /ManagementGroupName:My-OMG1 /SqlServerInstance:my-scomdb01\MSSQLSERVER /DatabaseName:OperationsManager /DWSqlServerInstance:my-scomdw01\MSSQLSERVER /DWDatabaseName:OperationsManagerDW /ActionAccountUser:mydc\scomaction /ActionAccountPassword:"passw0rd" /DASAccountUser:mydc\scomsdk /DASAccountPassword:"passw0rd" /DatareaderUser:mydc\scomdwread /DatareaderPassword:"passw0rd" /DataWriterUser:mydc\scomdwwrite /DataWriterPassword:"passw0rd" /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:1 /AcceptEndUserLicenseAgreement:1”
d. And subsequent management servers
setup.exe /silent /install /InstallPath:S:\SCOM /components:OMServer /ManagementGroupName:My-OMG1 /SqlServerInstance:my-scomdb01\MSSQLSERVER /DatabaseName:OperationsManager /ActionAccountUser:mydc\scomaction /ActionAccountPassword:"passw0rd" /DASAccountUser:mydc\scomsdk /DASAccountPassword:"passw0rd" /DatareaderUser:mydc\scomdwread /DatareaderPassword:"passw0rd" /DataWriterUser:mydc\scomdwwrite /DataWriterPassword:"passw0rd" /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:1 /AcceptEndUserLicenseAgreement:1
4) Reporting and webconsole
a. This needs to be a full OS server
b. .Net and SQL Server Reporting Services in native mode only
5) ACS server
a. Virtual Disk of 50GB SSD + 2TB SAS NL for data base files, mounted as S drive
b. Virtual Disk of 16GB SSD for SQL TempDB, mounted as T drive
c. Get both .NET 3.5 and 4 installed
d. Mount the ISO with mount-diskimage or attached to VM
e. Install SQL with the command line option
Setup.exe /UIMODE=EnableUIONServerCore /ACTION=Install /FEATURES=SQL,CONN,IS /UpdateEnabled=1 /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS /INSTALLSQLDATADIR=S:\SQL /SQLTEMPDBDIR=T:\SQLTDB /SQLTEMPDBLOGDIR=T:\SQLTDB /SQLSVCACCOUNT="mydc\sqlsvc" /SQLSVCPASSWORD="passw0rd" /SQLSYSADMINACCOUNTS="mydc\scomadmin" "mydc\scomaction" "mydc\myself" "mydc\Domain Admins" /AGTSVCACCOUNT="mydc\sqlsvc" /AGTSVCPASSWORD="passw0rd" /TCPENABLED=1 /IACCEPTSQLSERVERLICENSETERMS
f. SCOM mgmt server with command line option of
setup.exe /silent /install /InstallPath:S:\SCOM /components:OMServer /ManagementGroupName:My-OMG1 /SqlServerInstance:my-scomdb01\MSSQLSERVER /DatabaseName:OperationsManager /ActionAccountUser:mydc\scomaction /ActionAccountPassword:"passw0rd" /DASAccountUser:mydc\scomsdk /DASAccountPassword:"passw0rd" /DatareaderUser:mydc\scomdwread /DatareaderPassword:"passw0rd" /DataWriterUser:mydc\scomdwwrite /DataWriterPassword:"passw0rd" /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:1 /AcceptEndUserLicenseAgreement:1
g. ACS installation