Obs/bin/ObsDep/content/Powershell/Roles/Common/DeployDirectCommon.psm1
<###################################################
# # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> $HostFile = "$Env:SystemRoot\System32\Drivers\Etc\Hosts" # Set manually if needed $ENABLE_DEBUGGING = $false $DEBUG_CONNECTION_TYPE = '[DebugConnectionType]' $DEBUG_SERIAL_PORT = '[DebugSerialPort]' $DEBUG_SERIAL_BAUD_RATE = '[DebugSerialBaudRate]' $DEBUG_NET_PORT_MAP_STRING = '[DebugNetPortMapString]' $DEBUG_NET_HOST_IP = '[DebugNetHostIP]' $DEBUG_NET_KEY = '[DebugNetKey]' $DEBUG_NET_BUS_PARAMS = '[DebugNetBusParams]' $ENABLE_SERIAL_CONSOLE = $false $CONSOLE_SERIAL_PORT = '[ConsoleSerialPort]' $CONSOLE_SERIAL_BAUD_RATE = '[ConsoleSerialBaudRate]' # Starts all the services needed to intialize deployment on win PE function Set-WinPEDeploymentPrerequisites { $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop if (-not (Get-Command wpeutil*)) { Write-Warning "This script is intended to be execute in WinPE only." return } $null = wpeutil InitializeNetwork $null = wpeutil EnableFirewall $null = wpeutil WaitForNetwork $null = Start-Service -Name LanmanWorkstation } function New-NetworkDrive { param ( [Parameter(Mandatory=$true)] [string] $IPv4Address, [Parameter(Mandatory=$true)] [string] $HostName, [Parameter(Mandatory=$true)] [string] $ShareRoot, [Parameter(Mandatory=$true)] [PSCredential] $Credential, [Parameter(Mandatory=$true)] [string] $DriveLetter ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop # Add Host Entry $hostEntry = "$IPv4Address $HostName" if (-not (Get-Content $HostFile).Contains($hostEntry)) { Write-Verbose "Add host entry: '$hostEntry'." -Verbose $hostEntry | Out-File -FilePath $HostFile -Append -Encoding ascii } if (Get-PSDrive | Where-Object Name -eq $DriveLetter) { throw [System.InvalidOperationException]::new("The letter $DriveLetter is already assigned to an existing PSDrive.") } $maxRetries = 5 $retries = 1 $successful = $false while ($retries -le $maxRetries) { try { # Set PS Drive if (-not (Get-PSDrive | Where-Object Name -eq $DriveLetter)) { Write-Verbose "Create PSDrive '$DriveLetter' to '$ShareRoot'." -Verbose $null = New-PSDrive -Name $DriveLetter -PSProvider FileSystem -Root $ShareRoot -Credential $Credential -Persist -Scope Global $successful = $true break } } catch { Write-Warning $_ Write-Verbose "Failed to create PSDrive '$DriveLetter' to '$ShareRoot'. Sleep 60 seconds and retry $retries/$maxRetries." -Verbose Start-Sleep -Seconds 60 } $retries ++ } if ($successful) { Write-Verbose "Create PSDrive '$DriveLetter' to '$ShareRoot' successfully." -Verbose } else { throw "Failed to create PSDrive '$DriveLetter' to '$ShareRoot' after $maxRetries retries." } } # Returns back the SystemDrive function Set-DiskConfiguration { [CmdletBinding()] [OutputType([String])] param ( [Parameter(Mandatory=$true)] [string] $LogPath, [Parameter(Mandatory=$false)] [string] $BootDiskConfigPath, [Parameter(Mandatory=$false)] [bool] $ClearExisting=$true, [Parameter(Mandatory=$false)] [bool] $BootFromPhysicalDisk=$false ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop (Get-Date).ToString('yyyy/MM/dd HH:mm:ss') | Add-Content $LogPath "Reset the disks and clean them of all data." | Add-Content $LogPath if ($ClearExisting) { Get-Partition | Remove-Partition -Confirm:$false -ErrorAction SilentlyContinue # account for change in Reset-PhysicalDisk parameters in WinPE with Windows cumulative update $PDParam = @{} if ((Get-Command -Name 'Reset-PhysicalDisk').Parameters['Confirm']) { $PDParam.Add('Confirm',$false) } Get-PhysicalDisk | Reset-PhysicalDisk @PDParam Get-Disk | Where-Object PartitionStyle -ne RAW | ForEach-Object { $_ | Set-Disk -IsOffline:$false -ErrorAction SilentlyContinue $_ | Set-Disk -IsReadOnly:$false -ErrorAction SilentlyContinue $_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false -ErrorAction SilentlyContinue } } Get-Disk | ForEach-Object { $_ | Set-Disk -IsReadOnly:$true -ErrorAction SilentlyContinue $_ | Set-Disk -IsOffline:$true -ErrorAction SilentlyContinue } Update-StorageProviderCache -DiscoveryLevel Full (Get-Date).ToString('yyyy/MM/dd HH:mm:ss') | Add-Content $LogPath "Select the disk to boot from." | Add-Content $LogPath Get-PhysicalDisk | Sort-Object DeviceId | Format-Table DeviceId, Model, BusType, MediaType, Size | Out-String | Add-Content $LogPath Get-Disk | Out-String | Add-Content $LogPath $allbootCandidateDisks = Get-PhysicalDisk if (-not $allbootCandidateDisks) { throw 'No suitable boot candidate disks found.' } # log the data about physical disks that filtering uses "All disks." | Add-Content $LogPath $allbootCandidateDisks | Sort-Object DeviceId | Select-Object FriendlyName,SerialNumber,BusType,DeviceId,Manufacturer,Model,MediaType,Size | Format-Table | Out-String | Add-Content $LogPath if ($bootDiskConfigPath -and (Test-Path $bootDiskConfigPath)) { "Boot disk configuration file '$bootDiskConfigPath' exists." | Add-Content $LogPath [xml] $config = Get-Content $bootDiskConfigPath $bootDiskConfigs = $config.disks.disk $filteredBootCandidateDisks = $null foreach ($bootDiskConfig in $bootDiskConfigs) { # only apply each filter if the previous filter did not return any disks if (-not $filteredBootCandidateDisks) { # log what if being used as a filter "Filter - BusType: $($bootDiskConfig.BusType), DeviceId: $($bootDiskConfig.DeviceId), Manufacturer: $($bootDiskConfig.Manufacturer), Model: $($bootDiskConfig.Model), MediaType: $($bootDiskConfig.MediaType), Size: $($bootDiskConfig.Size)" | Add-Content $LogPath $filteredBootCandidateDisks = $allbootCandidateDisks | Where-Object { ($_.BusType -like $bootDiskConfig.BusType) -and ($_.DeviceId -like $bootDiskConfig.DeviceId) -and ($_.Manufacturer -like $bootDiskConfig.Manufacturer) -and ($_.Model -like $bootDiskConfig.Model) -and ($_.MediaType -like $bootDiskConfig.MediaType) -and ($_.Size -like $bootDiskConfig.Size) } # if this filter returns disks, set the busTypeFilter so we can filter further for * below if ($filteredBootCandidateDisks) { $busTypeFilter = $bootDiskConfig.BusType } } else { break } } # if no filtered disks after attempting all filters, we must fail if (-not $filteredBootCandidateDisks) { throw 'After filtering, no suitable boot candidate disks found.' } "Filtered disks." | Add-Content $LogPath $filteredBootCandidateDisks | Sort-Object DeviceId | Select-Object FriendlyName,SerialNumber,BusType,DeviceId,Manufacturer,Model,MediaType,Size | Format-Table | Out-String | Add-Content $LogPath ############################################################################################### # Temporary; after OEM extention is workin E2E, it will be removed $allTypeString = "*" if ($busTypeFilter -eq $allTypeString) { $filteredBootCandidateDisks = $filteredBootCandidateDisks | Where-Object BusType -in 'SATA', 'SAS', 'RAID' } "Filtered disks after the bus type filter 'SATA', 'SAS', 'RAID'." | Add-Content $LogPath $filteredBootCandidateDisks | Out-String | Add-Content $LogPath ############################################################################################### $bootCandidateDisks = $filteredBootCandidateDisks } else { $bootCandidateDisks = $allbootCandidateDisks | Where-Object BusType -in 'SATA', 'SAS', 'RAID' } if (-not $bootCandidateDisks) { throw 'No suitable boot candidate disk found.' } $bootCandidateDisks = $bootCandidateDisks | Where-Object DeviceId -in (Get-Disk).Number $bootCandidateDisks = $bootCandidateDisks | Sort-Object Size, DeviceId foreach ($currentDisk in $bootCandidateDisks) { $found = $(Get-Disk -Number $currentDisk.DeviceId | Get-Partition | Where-Object {$_.Type -eq "System"}) if ($found) { "Found boot disk with system partition type" | Add-Content $LogPath $found | Out-String | Add-Content $LogPath $bootCandidateDisk = $currentDisk break } } if ($null -eq $bootCandidateDisk) { "Select the first candidate disk as boot disk" | Add-Content $LogPath $bootCandidateDisk = $bootCandidateDisks | Select-Object -First 1 } $bootDiskNumber = $bootCandidateDisk.DeviceId if (-not $bootDiskNumber) { throw 'Not able to get the boot disk number.' } "Disk $bootDiskNumber will be used for boot partition." | Add-Content $LogPath if (-not($ClearExisting)) { # Remove the disk partition Get-Partition -DiskNumber $bootDiskNumber | Remove-Partition -Confirm:$false -ErrorAction SilentlyContinue # Reset only the boot disk $PDParam = @{} if ((Get-Command -Name 'Reset-PhysicalDisk').Parameters['Confirm']) { $PDParam.Add('Confirm',$false) } $bootCandidateDisk | Reset-PhysicalDisk @PDParam $disk = Get-Disk | Where-Object Number -eq $bootDiskNumber | Where-Object PartitionStyle -ne RAW "Disk about to be cleared:" | Add-Content $LogPath $disk | Out-String | Add-Content $LogPath $disk | ForEach-Object { $_ | Set-Disk -IsOffline:$false -ErrorAction SilentlyContinue $_ | Set-Disk -IsReadOnly:$false -ErrorAction SilentlyContinue $_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false -ErrorAction SilentlyContinue $_ | Set-Disk -IsReadOnly:$true -ErrorAction SilentlyContinue $_ | Set-Disk -IsOffline:$true -ErrorAction SilentlyContinue } } ############################################################################################### # Temporary for R730; after OEM extention is working E2E, this will be removed [9282124] $firstDisk = $bootCandidateDisk $secondDisk = $bootCandidateDisks | Where-Object { $($_.DeviceId -ne $bootCandidateDisk.DeviceId) -and $($_.Size -ge $bootCandidateDisk.Size) } | Sort-Object Size, DeviceId | Select-Object -First 1 if ($firstDisk.Size -eq $secondDisk.Size) { $secondDiskNumber = $secondDisk.DeviceId $ssdDisks = Get-PhysicalDisk | Where-Object BusType -in 'SATA', 'SAS', 'RAID', 'NVMe' | Where-Object MediaType -eq SSD $nonOnboardSsdDisks = $ssdDisks | Where-Object DeviceId -notin $firstDisk.DeviceId, $secondDisk.DeviceId | Sort-Object Size if ($nonOnboardSsdDisks -and ($secondDisk.Size -lt $nonOnboardSsdDisks[0].Size / 1.01)) { throw "Disk $secondDiskNumber appears to be a secondary on-board drive; it needs to be removed." } } ############################################################################################## wpeutil UpdateBootInfo | Add-Content $LogPath $remove = @(Get-Volume | Where-Object DriveType -ne Fixed) foreach ($item in $remove) { $vol = Get-CimInstance -ClassName Win32_Volume -Filter "DriveLetter = '$($item.DriveLetter):'" if ($null -ne $vol) { try { "Remove drive letter assignment '$($item.DriveLetter):' from '$($item.DriveType)'." | Add-Content $LogPath $vol | Set-CimInstance -Property @{DriveLetter=$null} } catch { "WARNING: Failed to remove drive letter assignment '$($item.DriveLetter):' from '$($item.DriveType)'." | Add-Content $LogPath } } } $peFirmwareType = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control).PEFirmwareType # Returns 0x1 if the PC is booted into BIOS mode, or 0x2 if the PC is booted in UEFI mode. $isLegacyBoot = $peFirmwareType -eq 1 if ($isLegacyBoot) { "Create new partitions for Legacy Boot." | Add-Content $LogPath $null = Initialize-Disk -Number $bootDiskNumber -PartitionStyle MBR -ErrorAction SilentlyContinue if ($true -eq $BootFromPhysicalDisk) { $winPartition = New-Partition -DiskNumber $bootDiskNumber -Size 60GB -DriveLetter C -IsActive if (-not $winPartition) { throw 'Unable to create partition for physical drive OS Installation.' } $partition = New-Partition -DiskNumber $bootDiskNumber -UseMaximumSize -DriveLetter D } else { $partition = New-Partition -DiskNumber $bootDiskNumber -UseMaximumSize -AssignDriveLetter -IsActive } if (-not $partition) { throw 'Unable to create partition for OS Installation.' } $systemDrive = $partition.DriveLetter + ':' if ($true -eq $BootFromPhysicalDisk) { $null = Format-Volume -Partition $winPartition -FileSystem NTFS -Confirm:$false } $osVolume = Format-Volume -Partition $partition -FileSystem NTFS -Confirm:$false } else { "Create new partitions for UEFI." | Add-Content $LogPath $null = Initialize-Disk -Number $bootDiskNumber -ErrorAction SilentlyContinue $msrPartition = New-Partition -DiskNumber $bootDiskNumber -Size 128MB -GptType "{e3c9e316-0b5c-4db8-817d-f92df00215ae}" # MSR if ($true -eq $BootFromPhysicalDisk) { "Create partitions for Boot From Physical Disk scenario." | Add-Content $LogPath $winPartition = New-Partition -DiskNumber $bootDiskNumber -Size 60GB -DriveLetter C -GptType "{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}" # WIN if (-not $winPartition) { throw 'Unable to create partition for physical drive OS Installation.' } $sysPartition = New-Partition -DiskNumber $bootDiskNumber -Size 350MB -DriveLetter E -GptType "{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}" # ESP } else { "Create partitions for Boot From Virtual Disk scenario." | Add-Content $LogPath $espPartition = New-Partition -DiskNumber $bootDiskNumber -Size 200MB -GptType "{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}" # ESP $espPartition | Add-PartitionAccessPath -AccessPath Q: $null = format Q: /fs:FAT32 /v:EFS /Y } $osPartition = New-Partition -DiskNumber $bootDiskNumber -UseMaximumSize -DriveLetter D -GptType "{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}" # OS if (-not $osPartition) { throw 'Unable to create the required partitions for OS Installation.' } $osVolume = Format-Volume -Partition $osPartition -FileSystem NTFS -Confirm:$false $systemDrive = $osPartition.DriveLetter + ':' "System drive letter is set to '$($systemDrive)'" | Add-Content $LogPath if ($null -ne $winPartition) { $null = Format-Volume -Partition $sysPartition -FileSystem FAT32 -Confirm:$false $null = Format-Volume -Partition $winPartition -FileSystem NTFS -Confirm:$false $env:WINDOWS_DRIVE = $winPartition.DriveLetter + ':' "Windows OS drive letter is set to '$($env:WINDOWS_DRIVE)'" | Add-Content $LogPath } } return [string]$systemDrive } function Set-HostVHDBoot { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $BootVHDFilePath, [Parameter(Mandatory=$true)] [string] $UnattendPath, [Parameter(Mandatory=$true)] [string] $DeploymentId, [Parameter(Mandatory=$true)] [string] $SystemDrive, [Parameter(Mandatory=$false)] [string] $MacAddress=$null, [Parameter(Mandatory=$true)] [string] $LogPath, [Parameter(Mandatory=$false)] [switch] $AddDeploymentIdToken, [Parameter(Mandatory=$false)] [string] $HypervisorSchedulerType='Core' ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop try { "Mounting VHD '$BootVHDFilePath'." | Add-Content $LogPath $null = Mount-DiskImage -ImagePath $BootVHDFilePath $virtualDiskDriveLetter = Get-Disk | Where-Object BusType -like 'File Backed Virtual' | Get-Partition | Where-Object Size -gt 2Gb | ForEach-Object DriveLetter $bootDrive = $virtualDiskDriveLetter + ':\' # Workaround for issue where script cannot find drive $null = New-PSDrive -Name $virtualDiskDriveLetter -Root $bootDrive -PSProvider FileSystem if ($AddDeploymentIdToken) { # Add a token file at a predefined location to detect host has booted up. # This will be relevant only in case of one-node stamp when it goes through baremetal deployment using WinPE $tempPath = "$($bootDrive)CloudBuilderTemp" "Inject deploymentId file '$tempPath\$($DeploymentId).txt'." | Add-Content $LogPath $null = New-Item -Path $tempPath -ItemType Directory -Force $null = Set-Content -Path "$tempPath\$($DeploymentId).txt" -Value '' } "Use-WindowsUnattend file '$UnattendPath' for offline values." | Add-Content $LogPath $null = Use-WindowsUnattend -Path $bootDrive -UnattendPath $UnattendPath $unattendDirectory = "$($bootDrive)Windows\Panther\Unattend" "Inject Unattend file '$UnattendPath' to '$unattendDirectory'." | Add-Content $LogPath $null = New-Item -Path $unattendDirectory -ItemType Directory -Force if ($MacAddress) { $unattendContent = Get-Content $unattendPath "Writing MAC Address '$MacAddress' to Unattend file" | Add-Content $LogPath $unattendContent = $unattendContent.Replace('[MacAddress]', $MacAddress.Replace(':','-')) $null = Set-Content -Path "$unattendDirectory\unattend.xml" -Value $unattendContent } else { $null = Copy-Item -Path $unattendPath -Destination "$unattendDirectory\unattend.xml" } $computerName = Get-ComputerNameFromUnattend -UnattendPath "$unattendDirectory\unattend.xml" Set-Debugging -LogPath $LogPath -ComputerName $computerName $peFirmwareType = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control).PEFirmwareType # Returns 0x1 if the PC is booted into BIOS mode, or 0x2 if the PC is booted in UEFI mode. $isLegacyBoot = $peFirmwareType -eq 1 if ($isLegacyBoot) { "Set BCD Boot Legacy." | Add-Content $LogPath bcdboot "$($bootDrive)Windows" /s $SystemDrive | Add-Content $LogPath } else { "Set BCD Boot UEFI." | Add-Content $LogPath bcdboot "$($bootDrive)Windows" /s Q: /f UEFI /d /addlast /v | Add-Content $LogPath # Remove invalid Windows Boot Manager entries, left from the previous deployment. $bcdFirmware = bcdedit /enum firmware $bcdFirmware | Add-Content $LogPath $bcdFirmware = $bcdFirmware -join "`n" if ($bcdFirmware -match 'identifier\s*({\w*-[0-9a-z-]*})[^-]*?description\s*Windows Boot Manager') { for ($i = 0; $i -lt $matches.Count; $i++) { if ($matches[$i] -like '{*') { bcdedit /delete $matches[$i] } } } bcdedit /enum firmware | Add-Content $LogPath } # https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/manage-hyper-v-scheduler-types "Setting hypervisor scheduler type to $HypervisorSchedulerType" | Add-Content $LogPath $bcdOutput = & bcdedit /set `{default`} hypervisorschedulertype $HypervisorSchedulerType | Out-String if (-not ($bcdOutput -ilike "*successfully*")) { throw "BCDEdit failed to update the hypervisor scheduler type. Output: $bcdOutput" } # Output boot store entries to validate settings $bcdEditEnum = & bcdedit /enum | Out-String $bcdEdit | Add-Content $LogPath } finally { $mountedImages = Get-DiskImage -ImagePath $BootVHDFilePath if ($mountedImages) { $null = Dismount-DiskImage -ImagePath $BootVHDFilePath } } } function Set-HostPhysicalDiskBoot { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $SystemDrive, [Parameter(Mandatory=$true)] [string] $UnattendPath, [Parameter(Mandatory=$true)] [string] $DeploymentId, [Parameter(Mandatory=$false)] [string] $MacAddress=$null, [Parameter(Mandatory=$true)] [string] $LogPath, [Parameter(Mandatory=$false)] [switch] $AddDeploymentIdToken, [Parameter(Mandatory=$false)] [string] $HypervisorSchedulerType='Core' ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop try { $bootDrive = $SystemDrive if ($AddDeploymentIdToken) { # Add a token file at a predefined location to detect host has booted up. # This will be relevant only in case of one-node stamp when it goes through baremetal deployment using WinPE $tempPath = "$($bootDrive)CloudBuilderTemp" "Inject deploymentId file '$tempPath\$($DeploymentId).txt'." | Add-Content $LogPath $null = New-Item -Path $tempPath -ItemType Directory -Force $null = Set-Content -Path "$tempPath\$($DeploymentId).txt" -Value '' } "Use-WindowsUnattend file '$UnattendPath' for offline values." | Add-Content $LogPath $null = Use-WindowsUnattend -Path $bootDrive -UnattendPath $UnattendPath $unattendDirectory = "$($bootDrive)Windows\Panther\Unattend" "Inject Unattend file '$UnattendPath' to '$unattendDirectory'." | Add-Content $LogPath $null = New-Item -Path $unattendDirectory -ItemType Directory -Force if ($MacAddress) { $unattendContent = Get-Content $unattendPath "Writing MAC Address '$MacAddress' to Unattend file" | Add-Content $LogPath $unattendContent = $unattendContent.Replace('[MacAddress]', $MacAddress.Replace(':','-')) $null = Set-Content -Path "$unattendDirectory\unattend.xml" -Value $unattendContent } else { $null = Copy-Item -Path $unattendPath -Destination "$unattendDirectory\unattend.xml" } $computerName = Get-ComputerNameFromUnattend -UnattendPath "$unattendDirectory\unattend.xml" Set-Debugging -LogPath $LogPath -ComputerName $computerName $peFirmwareType = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control).PEFirmwareType # Returns 0x1 if the PC is booted into BIOS mode, or 0x2 if the PC is booted in UEFI mode. $isLegacyBoot = $peFirmwareType -eq 1 if ($isLegacyBoot) { "Set BCD Boot Legacy." | Add-Content $LogPath bcdboot "$($bootDrive)\Windows" /s $bootDrive | Add-Content $LogPath } else { "Set BCD Boot UEFI." | Add-Content $LogPath bcdboot "$($bootDrive)\Windows" /s E: /f UEFI /v | Add-Content $LogPath bcdedit /enum firmware | Add-Content $LogPath } # https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/manage-hyper-v-scheduler-types "Setting hypervisor scheduler type to $HypervisorSchedulerType" | Add-Content $LogPath $bcdOutput = & bcdedit /set `{default`} hypervisorschedulertype $HypervisorSchedulerType | Out-String if (-not ($bcdOutput -ilike "*successfully*")) { throw "BCDEdit failed to update the hypervisor scheduler type. Output: $bcdOutput" } # Output boot store entries to validate settings $bcdEditEnum = & bcdedit /enum | Out-String $bcdEdit | Add-Content $LogPath } catch { throw $PSItem } } function Get-ComputerNameFromUnattend { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $UnattendPath ) # Get host name from unattend.xml $computerNameSearch = Get-ChildItem -Path $unattendPath | Select-String '\<ComputerName\>([^<]*)\<' $computerName = $computernameSearch.Matches.Groups[1].Value return $computerName } <# .Synopsis Function to test if an IP address is between two other IP addresses, inclusive .Parameter IPAddress The address to test. .Parameter BeginAddress The IP address at the begining of the range to test. .Parameter EndAddress The IP address at the begining of the range to test. .Example Test-IpAddressBetween -IPAddress 10.0.0.5 -BeginAddress 10.0.0.1 -EndAddress 10.0.0.10 Returns True #> function Test-IpAddressBetween { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [String] $IPAddress, [Parameter(Mandatory=$true)] [String] $BeginAddress, [Parameter(Mandatory=$true)] [String] $EndAddress ) # Convert all the addresses to Int32 $originalAddressBytes = ([IPAddress]$IPAddress).GetAddressBytes() [array]::Reverse($originalAddressBytes) $ipAddressInt = [System.BitConverter]::ToInt32($originalAddressBytes, 0) $originalAddressBytes = ([IPAddress]$BeginAddress).GetAddressBytes() [array]::Reverse($originalAddressBytes) $beginAddressInt = [System.BitConverter]::ToInt32($originalAddressBytes, 0) $originalAddressBytes = ([IPAddress]$EndAddress).GetAddressBytes() [array]::Reverse($originalAddressBytes) $endAddressInt = [System.BitConverter]::ToInt32($originalAddressBytes, 0) $ipAddressInt -le $endAddressInt -and $ipAddressInt -ge $beginAddressInt } function Get-LogFilePath { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $UnattendPath ) $computerName = Get-ComputerNameFromUnattend -UnattendPath $UnattendPath $logPath = [System.IO.Path]::GetDirectoryName($UnattendPath) $logFilePath = "$($logPath)\$($computerName).Log" return $logFilePath } function Set-Debugging { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $LogPath, [Parameter(Mandatory=$true)] [string] $ComputerName ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop if ($ENABLE_DEBUGGING) { Add-Content $LogPath "Current BCD settings:" bcdedit /enum | Add-Content $LogPath Add-Content $LogPath "Enabling debugging and setting dbgsettings..." bcdedit /debug '{default}' on | Add-Content $LogPath bcdedit /bootdebug '{default}' on | Add-Content $LogPath if ($DEBUG_CONNECTION_TYPE -eq 'serial') { bcdedit /dbgsettings serial debugport:$DEBUG_SERIAL_PORT baudrate:$DEBUG_SERIAL_BAUD_RATE | Add-Content $LogPath } elseif ($DEBUG_CONNECTION_TYPE -eq 'net') { $portMap = @{} $DEBUG_NET_PORT_MAP_STRING -split ';' | Where-Object { $_ } | ForEach-Object { $portRecord = $_ -split ',' $portMap.($portRecord[0]) = $portRecord[1] } $port = $portMap.$ComputerName Add-Content $LogPath "Port: $port" bcdedit /dbgsettings net hostip:$DEBUG_NET_HOST_IP port:$port key:$DEBUG_NET_KEY | Add-Content $LogPath bcdedit /set '{dbgsettings}' busparams "$DEBUG_NET_BUS_PARAMS" | Add-Content $LogPath } else { Add-Content $LogPath "Debugging connection type '$DEBUG_CONNECTION_TYPE' is not expected." } Add-Content $LogPath "Debug settings are now set:" bcdedit /enum | Add-Content $LogPath bcdedit /dbgsettings | Add-Content $LogPath } if ($ENABLE_SERIAL_CONSOLE) { Add-Content $LogPath "Current BCD settings:" bcdedit /enum | Add-Content $LogPath Add-Content $LogPath "Enabling Emergency Management Services..." bcdedit /ems '{default}' on | Add-Content $LogPath bcdedit /emssettings emsport:$CONSOLE_SERIAL_PORT emsbaudrate:$CONSOLE_SERIAL_BAUD_RATE | Add-Content $LogPath Add-Content $LogPath "EMS settings are now set:" bcdedit /enum | Add-Content $LogPath } } <# .Synopsis Function to get the local machine System Management BIOS Guid without dashes or brackets .Example Get-LocalSMBIOSGuid Returns 1742B000CD3611E10000AC162D024F2F #> function Get-LocalSMBIOSGuid { $smBiosGuid = Get-WmiObject Win32_ComputerSystemProduct UUID $smBiosGuid.UUID.Replace('-', '') } <# .Synopsis Function to get a path to the file that will contain the MAC address on a deploying machine .Example Get-MACAddressOutputPath -RemoteUnattendPath \\foo\bar Returns \\foo\bar\1742B000CD3611E10000AC162D024F2F.MACAddress.txt #> function Get-MACAddressOutputPath { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $RemoteUnattendPath ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop # Always use the smbios guid, since this is an externally discoverable identifier $smBiosGuid = Get-LocalSMBIOSGuid $macAddressOutputFilePath = $smBiosGuid | ForEach-Object { "$RemoteUnattendPath\$_.MACAddress.txt" } return $macAddressOutputFilePath } function Get-UnattendFilePath { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $RemoteUnattendPath ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop $macAddress = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object MACAddress | ForEach-Object MACAddress | ForEach-Object { $_ -replace ':', '-' } | Where-Object { "$remoteUnattendPath\$_.xml" | Where-Object {Test-Path $_} } if ($macAddress) { $unattendPath = $macAddress | ForEach-Object { "$RemoteUnattendPath\$_.xml" } } else { # No unattend file matching the MAC address was found, attempt to find an unattend file with the smbios guid instead $smBiosGuid = Get-LocalSMBIOSGuid $unattendPath = $smBiosGuid | ForEach-Object { "$RemoteUnattendPath\$_.xml" } } return $unattendPath } <# .Synopsis This function returns the node specific RemoteUnattend path e.g. when passed RemoteUnattend, we will get back RemoteUnattend\<NodeName>. If node's unattend files are in RemoteUnattend *and* RemoteUnattend\NodeName, we will return the path containing the latest files. This scenario can happen during the following sequence Old build + FRU X (writes to RemoteUnattend) + PnU (new build that writes to NodeName) + FRU X during PnU #> function Get-NodeSpecificRemoteUnattendPath { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $UnattendPathToResolve ) $macAddresses = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object MACAddress | ForEach-Object MACAddress | ForEach-Object { $_ -replace ':', '-' } foreach ($macAddress in $macAddresses) { $unattendFile = Get-ChildItem -Path $UnattendPathToResolve -Include "$macAddress.xml" -Recurse -Force -File | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if ($unattendFile) { return $unattendFile.Directory.FullName } } $smBiosGuid = Get-LocalSMBIOSGuid $unattendFile = Get-ChildItem -Path $UnattendPathToResolve -Include "$smBiosGuid.xml" -Recurse -Force -File | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if ($unattendFile) { return $unattendFile.Directory.FullName } return $UnattendPathToResolve } function Get-BootDiskConfigPath { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $RemoteUnattendPath ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop $macAddress = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object MACAddress | ForEach-Object MACAddress | ForEach-Object { $_ -replace ':', '-' } | Where-Object { "$remoteUnattendPath\$_.BootDisk.xml" | Where-Object {Test-Path $_} } if ($macAddress) { $bootDiskConfigPath = $macAddress | ForEach-Object { "$RemoteUnattendPath\$_.BootDisk.xml" } } else { # No boot disk file matching the MAC address was found, attempt to find a boot disk file with the smbios guid instead $smBiosGuid = Get-LocalSMBIOSGuid $bootDiskConfigPath = $smBiosGuid | ForEach-Object { "$RemoteUnattendPath\$_.BootDisk.xml" } } return $bootDiskConfigPath } function Test-AzsHostTPMOwnership { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $LogPath ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop "Testing TPM ownership for AzureStack host" | Add-Content $LogPath try { "Getting Win32_TPM object in namespace root\cimv2\security\microsofttpm" | Add-Content $LogPath $tpmWMIObject = Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_TPM if ($null -eq $tpmWMIObject) { throw "Failed to get WMI object Win32_TPM" } "Calling TPM method IsOwned() to check if TPM is properly owned" | Add-Content $LogPath $tpmIsOwnedRet = $tpmWMIObject.IsOwned() if ($null -eq $tpmIsOwnedRet) { throw "Failed call to tpm method IsOwned()" } if ($tpmIsOwnedRet.ReturnValue -ne 0) { throw "Failed call to tpm method IsOwned(). ReturnValue is $($tpmIsOwnedRet.ReturnValue)" } if ($tpmIsOwnedRet.IsOwned -eq $true) { "TPM IsOwned() method confirmed that TPM is owned. No need to explicitly call TPM method TakeOwnerShip()" | Add-Content $LogPath return } "TPM is NOT owned. Will explicitly call TPM method TakeOwnerShip()" | Add-Content $LogPath "Calling TPM method TakeOwnerShip()" | Add-Content $LogPath $tpmTakeOwnerShipRet = $tpmWMIObject.TakeOwnerShip() if ($null -eq $tpmTakeOwnerShipRet) { throw "Failed call to TPM method TakeOwnerShip()" } if ($tpmTakeOwnerShipRet.ReturnValue -ne 0) { throw "Failed call to TPM method TakeOwnerShip(). ReturnValue is $($tpmTakeOwnerShipRet.ReturnValue)" } "Calling TPM method IsOwned() to check if TPM is properly owned after calling TPM method TakeOwnerShip()" | Add-Content $LogPath $tpmIsOwnedRet = $tpmWMIObject.IsOwned() if ($null -eq $tpmIsOwnedRet) { throw "Failed call to tpm method IsOwned()" } if ($tpmIsOwnedRet.ReturnValue -ne 0) { throw "Failed call to tpm method IsOwned(). ReturnValue is $($tpmIsOwnedRet.ReturnValue)" } if ($tpmIsOwnedRet.IsOwned -eq $false) { throw "Failure: TPM method IsOwned() shows that TPM is NOT owned even after calling TPM method TakeOwnerShip()" } "TPM is now owned after calling TPM method TakeOwnerShip()" | Add-Content $LogPath } catch { "Azs host test TPM ownership did not complete. Exception: $($_.Exception)" | Add-Content $LogPath "Test TPM ownership did not complete becaue of the following error/warning: $($_.Exception.Message)" | Add-Content $LogPath } } # Function Clear-AzsHostTPM # It is a precautionary mechanism to avoid issues with # TPM. If TPM could not be cleared # an error will be reported but deployment # should proceed. A common reason for TPM not to be cleared # is a host that requies user confirmation upon reboot. # In this case an error will be reported but deployment # should proceed function Clear-AzsHostTPM { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $LogPath ) $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop (Get-Date).ToString('yyyy/MM/dd HH:mm:ss') | Add-Content $LogPath "Clear TPM for AzureStack host" | Add-Content $LogPath try { "Retrieving a WMI object win32_TPM in namespace root\cimv2\security\microsofttpm" | Add-Content $LogPath $tpmWMIObject = Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_TPM if ($null -eq $tpmWMIObject) { throw "Aborting clear TPM. Failed to retrieve TPM WMI object. Make sure TPM is available and ready." } "Checking status of TPM" | Add-Content $LogPath if ((!$tpmWMIObject.IsActivated_InitialValue) -or (!$tpmWMIObject.IsEnabled_InitialValue)) { throw "Aborting clear TPM. TPM is either not activated or is not enabled" } "Testing TPM ownership. Calling Test-AzsHostTPMOwnership" | Add-Content $LogPath Test-AzsHostTPMOwnership -LogPath $LogPath "Retrieving a new WMI win32_TPM object after testing ownership in namespace root\cimv2\security\microsofttpm" | Add-Content $LogPath $tpmWMIObject = Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_TPM if ($null -eq $tpmWMIObject) { throw "Aborting clear TPM. Failed to retrieve TPM WMI object. Make sure TPM is available and ready." } "Starting process to clear TPM" | Add-Content $LogPath "Calling WMI TPM method GetPhysicalPresenceConfirmationStatus() with Operation input parameter set to 22 (Enable + Activate + Clear + Enable + Activate)" | Add-Content $LogPath $physicalPresenceConfRet = $tpmWMIObject.GetPhysicalPresenceConfirmationStatus(22) if ($null -eq $physicalPresenceConfRet) { throw "Aborting clear TPM. Failed call to WMI TPM method GetPhysicalPresenceConfirmationStatus()" } "Checking ReturnValue of WMI TPM method GetPhysicalPresenceConfirmationStatus()" | Add-Content $LogPath "ReturnValue of WMI TPM method GetPhysicalPresenceConfirmationStatus() is $($physicalPresenceConfRet.ReturnValue)" | Add-Content $LogPath if ($physicalPresenceConfRet.ReturnValue -ne 0) { throw "Aborting clear TPM. Failed call to TPM method GetPhysicalPresenceConfirmationStatus() with ReturnValue $($physicalPresenceConfRet.ReturnValue)" } "Checking ConfirmationStatus of WMI TPM method GetPhysicalPresenceConfirmationStatus()" | Add-Content $LogPath "ConfirmationStatus of WMI TPM method GetPhysicalPresenceConfirmationStatus() is $($physicalPresenceConfRet.ConfirmationStatus)" | Add-Content $LogPath if ($physicalPresenceConfRet.ConfirmationStatus -ne 4) { throw "Aborting clear TPM. Call to WMI TPM method GetPhysicalPresenceConfirmationStatus() returned ConfirmationStatus $($physicalPresenceConfRet.ConfirmationStatus). Host may require user intervention or BIOS change to enable clear TPM." } "Clearing TPM by calling WMI TPM method SetPhysicalPresenceRequest() with request input parameter set to 22 (Enable + Activate + Clear + Enable + Activate)" | Add-Content $LogPath $physicalPresenceRequestRet = $tpmWMIObject.SetPhysicalPresenceRequest(22) if ($null -eq $physicalPresenceRequestRet) { throw "Aborting clear TPM. Failed call to WMI TPM method SetPhysicalPresenceRequest()" } "Checking ReturnValue of WMI TPM method SetPhysicalPresenceRequest()" | Add-Content $LogPath "ReturnValue of WMI TPM method SetPhysicalPresenceRequest() is $($physicalPresenceRequestRet.ReturnValue)" | Add-Content $LogPath if ($physicalPresenceRequestRet.ReturnValue -ne 0) { throw "Aborting clear TPM. Failed call to WMI TPM method SetPhysicalPresenceRequest() with ReturnValue $($physicalPresenceRequestRet.ReturnValue)" } "Clearing host TPM configuration has completed. Changes will be applied after reboot" | Add-Content $LogPath } catch { "Azs host clear TPM did not complete. Exception: $($_.Exception)" | Add-Content $LogPath "Clear TPM did not complete becaue of the following error/warning: $($_.Exception.Message)" | Add-Content $LogPath } } Export-ModuleMember -Function Get-BootDiskConfigPath Export-ModuleMember -Function Get-ComputerNameFromUnattend Export-ModuleMember -Function Get-LocalSMBIOSGuid Export-ModuleMember -Function Get-LogFilePath Export-ModuleMember -Function Get-MACAddressOutputPath Export-ModuleMember -Function Get-UnattendFilePath Export-ModuleMember -Function Get-NodeSpecificRemoteUnattendPath Export-ModuleMember -Function New-NetworkDrive Export-ModuleMember -Function Set-Debugging Export-ModuleMember -Function Set-DiskConfiguration Export-ModuleMember -Function Set-HostVHDBoot Export-ModuleMember -Function Set-HostPhysicalDiskBoot Export-ModuleMember -Function Set-WinPEDeploymentPrerequisites Export-ModuleMember -Function Test-IpAddressBetween Export-ModuleMember -Function Clear-AzsHostTPM # SIG # Begin signature block # MIInvgYJKoZIhvcNAQcCoIInrzCCJ6sCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YF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