Instead of using json as the config file, you could use a PowerShell data file which IMO is nicer to edit by hand as it's just the normal PowerShell syntax and you don't have to worry about escaping backslashes, adding commas after every element, and quoting everything. Here's a snippet of what the file would look like:
@{
VMS = @(
@{Name = "dc1"; IP = "192.168.48.10"}
@{Name = "rdgw"; IP = "192.168.48.11"}
)
DomainController = "dc1"
TemplateVHDXPath = "C:\Hyper-V\Virtual Hard Disks\Templates\template_server2019.vhdx"
}
And you'd import it like:
$Data = Import-PowerShellDataFile -Path .\Demo.psd1
Instead of using json as the config file, you could use a PowerShell data file which IMO is nicer to edit by hand as it's just the normal PowerShell syntax and you don't have to worry about escaping backslashes, adding commas after every element, and quoting everything. Here's a snippet of what the file would look like:
And you'd import it like:
$Data = Import-PowerShellDataFile -Path .\Demo.psd1