Remove deprecated ToastNotifications;Update README
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Danny Bessems 2021-01-28 14:31:51 +01:00
parent 659aac3c16
commit 38df466125
3 changed files with 3 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -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)
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")

View File

@ -4,30 +4,6 @@ Param(
# 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 = @{
LogName = 'Application'
Source = 'OVF-Properties'
@ -101,12 +77,6 @@ If ($MissingProperties.Length -gt 0) {
# Set hostname and description
If ($Env:ComputerName -ne $ovfPropertyValues['guestinfo.hostname']) {
# $NewToastSplat = @{
# Title = 'OVF Properties'
# Text = 'Configuring hostname and description...'
# }
# New-ToastNotification @NewToastSplat
$RenameComputerSplat = @{
NewName = $ovfPropertyValues['guestinfo.hostname']
Force = $True
@ -128,12 +98,6 @@ If ($Env:ComputerName -ne $ovfPropertyValues['guestinfo.hostname']) {
# Configure network interface
If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotContains $ovfPropertyValues['guestinfo.ipaddress']) {
# $NewToastSplat = @{
# Title = 'OVF Properties'
# Text = 'Configuring network...'
# }
# New-ToastNotification @NewToastSplat
$NewNetIPAddressSplat = @{
InterfaceAlias = (Get-NetAdapter).Name
AddressFamily = 'IPv4'
@ -188,12 +152,6 @@ If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotCon
# Promote to Domain Controller
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
$BuiltinAdministrator = (Get-LocalUser | Where-Object {$_.SID -match '-500'})
$ConvertToSecureStringSplat = @{
@ -212,12 +170,6 @@ If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole)
}
Set-LocalUser @SetLocalUserSplat
# $NewToastSplat = @{
# Title = 'OVF Properties'
# Text = 'Promoting to Domain Controller...'
# }
# New-ToastNotification @NewToastSplat
$ResolveDNSNameSplat = @{
Name = "_ldap._tcp.dc._msdcs.$($ovfPropertyValues['addsconfig.domainname'])"
ErrorAction = 'SilentlyContinue'
@ -276,12 +228,6 @@ If ((4,5) -NotContains (Get-WmiObject -Class 'Win32_ComputerSystem').DomainRole)
}
# 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
Do {
If ($Timestamp.AddMinutes($TimeoutMinutes) -lt (Get-Date)) {
@ -312,12 +258,6 @@ $GetItemSplat = @{
}
Get-Item @GetItemSplat | ForEach-Object {
Try {
# $NewToastSplat = @{
# Title = 'OVF Properties'
# Text = "Running script: '$($_.FullName)'"
# }
# New-ToastNotification @NewToastSplat
$WriteEventLogSplat = @{
LogName = 'Application'
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 = @{
LogName = 'Application'
Source = 'OVF-Properties'