Building my Orion Server [Scripting Edition] – Step 2

In Step 1 of this series, I showed off the PowerShell scripts that I use to create a new Orion Server VM on Hyper-V.  Now we are on to configuring the disks.

As before, we have a boot drive and 4 additional drives which will contain various data files.  We first need to bring the disks online and initialize them.

If you installed from an ISO, you should either remove the device from your virtual machine before this point, or change the drive mounting to a letter other than D, E, F, or G. I’m generally a fan of changing it to Z:.

#region Online & Enable RAW disks
Get-Disk | Where-Object { $_.OperationalStatus -eq "Offline" } | Set-Disk -IsOffline:$false
Get-Disk | Where-Object { $_.PartitionStyle -eq "RAW" } | ForEach-Object { Initialize-Disk -Number $_.Number -PartitionStyle GPT }
#endregion

Now my disks are online.  I need to create the proper partitions and format them.  Here I’m using NTFS and 64K block sizes.  There are all manner of decisions about which block size and file system is best.  These are what I found perform the best given my circumstances.  I give more reasoning (but I don’t go into detail in Step 1)

Before I can configure the disks, I need to define the names.  I do this with a series of PowerShell objects.  In Windows Disks are numbered from “0” so disk 0 contains my EFI, OS, and Recovery Partitions.  Disks 1 – 4 are my other disks.

#region Build Disk List
$DiskInfo  = @()
$DiskInfo += New-Object -TypeName PSObject -Property ( [ordered]@{ DiskNumber = [int]1; DriveLetter = "D"; Label = "Page File" } )
$DiskInfo += New-Object -TypeName PSObject -Property ( [ordered]@{ DiskNumber = [int]2; DriveLetter = "E"; Label = "Programs" } )
$DiskInfo += New-Object -TypeName PSObject -Property ( [ordered]@{ DiskNumber = [int]3; DriveLetter = "F"; Label = "Web" } )
$DiskInfo += New-Object -TypeName PSObject -Property ( [ordered]@{ DiskNumber = [int]4; DriveLetter = "G"; Label = "Logs" } )
#endregion

Once I have this, I can cycle through each entry and create the partition and disk.  For my environment, I’m using Quick Formatting, but you should probably use Full formatting in a production environment.  First we create the partition, then we format the volume and label it.  Finally, we’ll go through and disable the indexing.

During this process I get a Windows Explorer popup that tells me that I need to format the drives (duh).  I’m already doing that, so I just cancel the drive dialog box.  I haven’t (yet) found a clever way to handle that nuisance.

#region Create Partitions & Format
$FullFormat = $false # indicates a "quick" format
ForEach ( $Disk in $DiskInfo )
{
    # Create Partition and then Format it
        New-Partition -DiskNumber $Disk.DiskNumber -UseMaximumSize -DriveLetter $Disk.DriveLetter | Format-Volume -FileSystem NTFS -AllocationUnitSize 64KB -Force -Confirm:$false -Full:$FullFormat -NewFileSystemLabel $Disk.Label
    
    # Disable Indexing via WMI
    $WmiVolume = Get-WmiObject -Query "SELECT * FROM Win32_Volume WHERE DriveLetter = '$( $Disk.DriveLetter ):'"
    $WmiVolume.IndexingEnabled = $false
    $WmiVolume.Put()
}
#endregion

Here’s what I get when done.

Lastly, I’ll configure the Page Files.

#region Set Page Files
$CompSys = Get-WmiObject -Class Win32_ComputerSystem -EnableAllPrivileges
# is the system set to use system managed page files
if ( $CompSys.AutomaticManagedPagefile )
{
    # if so, turn it off
    $CompSys.AutomaticManagedPagefile = $false
    $CompSys.Put()
}
# Set the size to 16GB + 257MB (per Microsoft Recommendations) and move it to the D:\ Drive
# as a safety-net I also keep 257MB for the mini-dump on the C:\ Drive.
$PageFileSettings = @()
$PageFileSettings += "c:\pagefile.sys 257 257"
$PageFileSettings += "d:\pagefile.sys 16641 16641"

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\" -Name "pagingfiles" -Type multistring -Value $PageFileSettings
#endregion#region

The Page File changes won’t take effect until I reboot… but before I reboot, I rename the system.  I can do this via PowerShell, but I prefer to do this particular step by hand so that I can confirm that the computer account was properly added to the domain.  I have a tendency to reuse computer names and forget to delete or reset the computer account in Active Directory.  This is just about the only thing that I do by hand.

This is also a great place to do Windows Updates. Run them, reboot, run them again, repeat until there’s nothing new.

Step 3 Step 3.1 will conclude this series where I configure the rest of the settings in prepping this server for installation of the Orion Suite.

Check back soon to get the last step and as always, please inject your comments – I’m always in search of feedback.

1 thought on “Building my Orion Server [Scripting Edition] – Step 2”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.