Introduce sized deployment options
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-11 13:00:12 +02:00
parent 68f5b15d67
commit 5cf101d641
3 changed files with 65 additions and 15 deletions

View File

@ -34,11 +34,11 @@ foreach ($ovfProperty in $ovfProperties) {
}
# Check for mandatory values
Switch ($ovfPropertyValues['deployment.type']) {
'domainmember' {
Switch -regex ($ovfPropertyValues['deployment.type']) {
'^domainmember' {
$MandatoryProperties, $MissingProperties = @('guestinfo.hostname', 'guestinfo.ipaddress', 'guestinfo.prefixlength', 'guestinfo.gateway', 'addsconfig.domainname', 'addsconfig.username', 'addsconfig.password'), @()
}
'standalone' {
'^standalone' {
$MandatoryProperties, $MissingProperties = @('guestinfo.hostname', 'guestinfo.ipaddress', 'guestinfo.prefixlength', 'guestinfo.gateway', 'guestinfo.administratorpw', 'guestinfo.ntpserver'), @()
}
default {
@ -152,8 +152,8 @@ If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotCon
$ErrorActionPreference, $OldErrorActionPreference = $OldErrorActionPreference, $NULL
}
Switch ($ovfPropertyValues['deployment.type']) {
'domainmember' {
Switch -regex ($ovfPropertyValues['deployment.type']) {
'^domainmember' {
# Join Active Directory domain as member
If (!(Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain) {
$AddComputerSplat = @{
@ -174,7 +174,7 @@ Switch ($ovfPropertyValues['deployment.type']) {
# Exit
}
}
'standalone' {
'^standalone' {
# Change password of built-in Administrator
$BuiltinAdministrator = (Get-LocalUser | Where-Object {$_.SID -match '-500'})
$ConvertToSecureStringSplat = @{