Remove deprecated ToastNotifications;Update README
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
659aac3c16
commit
38df466125
BIN
.assets/vAppProperties-example.png
Normal file
BIN
.assets/vAppProperties-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
@ -1,2 +1,5 @@
|
|||||||
# Packer.Images [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Packer.Images/status.svg?ref=refs/heads/ADDS)](https://ci.spamasaurus.com/djpbessems/Packer.Images)
|
# Packer.Images [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Packer.Images/status.svg?ref=refs/heads/ADDS)](https://ci.spamasaurus.com/djpbessems/Packer.Images)
|
||||||
|
|
||||||
|
This OVA appliance allows deploying an Active Directory Domain Controller fully automated:
|
||||||
|
When deploying the appliance through the 'Deploy OVF template...' wizard, or through vApp-compatible tooling (such as HashiCorp Terraform), it is possible to provide all relevant configuration through vApp properties.
|
||||||
|
![vApp properties](.assets/vAppProperties-example.png?raw=true "vApp properties")
|
@ -4,30 +4,6 @@ Param(
|
|||||||
# No parameters
|
# No parameters
|
||||||
)
|
)
|
||||||
|
|
||||||
Function New-ToastNotification {
|
|
||||||
Param(
|
|
||||||
[Parameter()]
|
|
||||||
[string]$Stream = 'OVF Properties',
|
|
||||||
[Parameter(Mandatory)]
|
|
||||||
[string]$Title,
|
|
||||||
[Parameter(Mandatory)]
|
|
||||||
[string]$Text
|
|
||||||
)
|
|
||||||
|
|
||||||
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
||||||
$Template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
|
|
||||||
|
|
||||||
$XML = [xml]$Template.GetXml()
|
|
||||||
$XML.SelectSingleNode("toast/visual/binding/text[@id='1']").InnerText = $Title
|
|
||||||
$XML.SelectSingleNode("toast/visual/binding/text[@id='2']").InnerText = $Text
|
|
||||||
|
|
||||||
$SerializedXml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
||||||
$SerializedXml.LoadXml($XML.OuterXml)
|
|
||||||
|
|
||||||
$Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($Stream)
|
|
||||||
$Notifier.Show([Windows.UI.Notifications.ToastNotification]::new($SerializedXml))
|
|
||||||
}
|
|
||||||
|
|
||||||
$NewEventLogSplat = @{
|
$NewEventLogSplat = @{
|
||||||
LogName = 'Application'
|
LogName = 'Application'
|
||||||
Source = 'OVF-Properties'
|
Source = 'OVF-Properties'
|
||||||
@ -101,12 +77,6 @@ If ($MissingProperties.Length -gt 0) {
|
|||||||
|
|
||||||
# Set hostname and description
|
# Set hostname and description
|
||||||
If ($Env:ComputerName -ne $ovfPropertyValues['guestinfo.hostname']) {
|
If ($Env:ComputerName -ne $ovfPropertyValues['guestinfo.hostname']) {
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = 'Configuring hostname and description...'
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$RenameComputerSplat = @{
|
$RenameComputerSplat = @{
|
||||||
NewName = $ovfPropertyValues['guestinfo.hostname']
|
NewName = $ovfPropertyValues['guestinfo.hostname']
|
||||||
Force = $True
|
Force = $True
|
||||||
@ -128,12 +98,6 @@ If ($Env:ComputerName -ne $ovfPropertyValues['guestinfo.hostname']) {
|
|||||||
|
|
||||||
# Configure network interface
|
# Configure network interface
|
||||||
If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotContains $ovfPropertyValues['guestinfo.ipaddress']) {
|
If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotContains $ovfPropertyValues['guestinfo.ipaddress']) {
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = 'Configuring network...'
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$NewNetIPAddressSplat = @{
|
$NewNetIPAddressSplat = @{
|
||||||
InterfaceAlias = (Get-NetAdapter).Name
|
InterfaceAlias = (Get-NetAdapter).Name
|
||||||
AddressFamily = 'IPv4'
|
AddressFamily = 'IPv4'
|
||||||
@ -188,12 +152,6 @@ If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotCon
|
|||||||
|
|
||||||
# Promote to Domain Controller
|
# Promote to Domain Controller
|
||||||
If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole) {
|
If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole) {
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = 'Configuring local administrator password...'
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
# Change password of built-in Administrator
|
# Change password of built-in Administrator
|
||||||
$BuiltinAdministrator = (Get-LocalUser | Where-Object {$_.SID -match '-500'})
|
$BuiltinAdministrator = (Get-LocalUser | Where-Object {$_.SID -match '-500'})
|
||||||
$ConvertToSecureStringSplat = @{
|
$ConvertToSecureStringSplat = @{
|
||||||
@ -212,12 +170,6 @@ If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole)
|
|||||||
}
|
}
|
||||||
Set-LocalUser @SetLocalUserSplat
|
Set-LocalUser @SetLocalUserSplat
|
||||||
|
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = 'Promoting to Domain Controller...'
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$ResolveDNSNameSplat = @{
|
$ResolveDNSNameSplat = @{
|
||||||
Name = "_ldap._tcp.dc._msdcs.$($ovfPropertyValues['addsconfig.domainname'])"
|
Name = "_ldap._tcp.dc._msdcs.$($ovfPropertyValues['addsconfig.domainname'])"
|
||||||
ErrorAction = 'SilentlyContinue'
|
ErrorAction = 'SilentlyContinue'
|
||||||
@ -276,12 +228,6 @@ If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Wait for Active Directory to become available
|
# Wait for Active Directory to become available
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = 'Waiting for Active Directory services...'
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$Timestamp, $TimeoutMinutes = (Get-Date), 15
|
$Timestamp, $TimeoutMinutes = (Get-Date), 15
|
||||||
Do {
|
Do {
|
||||||
If ($Timestamp.AddMinutes($TimeoutMinutes) -lt (Get-Date)) {
|
If ($Timestamp.AddMinutes($TimeoutMinutes) -lt (Get-Date)) {
|
||||||
@ -312,12 +258,6 @@ $GetItemSplat = @{
|
|||||||
}
|
}
|
||||||
Get-Item @GetItemSplat | ForEach-Object {
|
Get-Item @GetItemSplat | ForEach-Object {
|
||||||
Try {
|
Try {
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = "Running script: '$($_.FullName)'"
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$WriteEventLogSplat = @{
|
$WriteEventLogSplat = @{
|
||||||
LogName = 'Application'
|
LogName = 'Application'
|
||||||
Source = 'OVF-Properties'
|
Source = 'OVF-Properties'
|
||||||
@ -340,12 +280,6 @@ Get-Item @GetItemSplat | ForEach-Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# $NewToastSplat = @{
|
|
||||||
# Title = 'OVF Properties'
|
|
||||||
# Text = "Sequence finished; ready for use!"
|
|
||||||
# }
|
|
||||||
# New-ToastNotification @NewToastSplat
|
|
||||||
|
|
||||||
$WriteEventLogSplat = @{
|
$WriteEventLogSplat = @{
|
||||||
LogName = 'Application'
|
LogName = 'Application'
|
||||||
Source = 'OVF-Properties'
|
Source = 'OVF-Properties'
|
||||||
|
Loading…
Reference in New Issue
Block a user