Private/_InitialSettings.ps1
function _InitialSettings { [CmdletBinding()] param ( [Parameter()] [ValidateScript({ Test-Path $_ })] [string] $Path, [switch]$SCCM, [string]$SCCMServer, [switch]$Exchange, [string]$DefaultDC, [string]$ObjectFolder ) $FeatureSettings = [PSCustomObject]@{ SCCM = $SCCM Exchange = $Exchange } $SCCMSettings = [PSCustomObject]@{ SCCMServerHostname = $SCCMServer SCCMDefaultCollection = 'All Systems' } # TODO validate a trailing '\' $ObjectsSettings = [PSCustomObject]@{ ObjectStorageFolder = $ObjectFolder } $DCSettings = [PSCustomObject]@{ DomainController = $DefaultDC } $Settings = [PSCustomObject]@{ Theme = "Light" FeatureSettings = $FeatureSettings SCCMSettings = $SCCMSettings ObjectsSettings = $ObjectsSettings DCSettings = $DCSettings } try { $Settings | ConvertTo-Json | Out-File "$($Path)Settings.json" } catch { $MessageSplat = @{ MessageText = "Unable to save initial settings.`n$_" MessageIcon = 'Hand' ButtonType = 'OK' MessageTitle = 'Error' } _ShowMessageBox @MessageSplat break } } |