public/Get-AppVentiXConfigShare.ps1
<#
.SYNOPSIS Retrieves the AppVentiX configuration share if defined. .DESCRIPTION The Get-AppVentiXConfigShare function retrieves the AppVentiX configuration share if defined. .EXAMPLE Get-AppVentiXConfigShare .NOTES Function : Get-AppVentiXConfigShare Author : John Billekens Copyright: Copyright (c) AppVentiX Version : 1.0 #> function Get-AppVentiXConfigShare { [CmdletBinding()] Param() $output = @{} $output.ConfigShare = $Script:AppVentix.ConfigShare if ([String]::IsNullOrEmpty($($output.ConfigShare))) { try { $centralViewSettingsFilename = $Script:AppVentiX.CentralViewSettingsFilename if ($null -ne $centralViewSettingsFilename -and (Test-Path -Path $centralViewSettingsFilename)) { Write-Verbose "Reading the Central View Settings file!" $centralViewSettingsXml = New-Object -TypeName System.Xml.XmlDocument try { $centralViewSettingsXml.Load($centralViewSettingsFilename) $output.ConfigShare = $centralViewSettingsXml.Root.Configurationshare } catch { Write-Warning "Could not read the Central View Settings file!" } } } catch { Write-Warning "Caught an error while reading the Central View Settings file!" } } if ([String]::IsNullOrEmpty($($output.ConfigShare))) { Write-Warning "Config share not (yet) defined!`r`nPlease run 'Set-AppVentiXConfigShare -ConfigShare `"\\path.to\ConfigShare`" first or`r`ndefine the '-ConfigShare `"\\path.to\ConfigShare`"' parameter for each function." return $null } if (Test-Path -Path $($output.ConfigShare)) { Write-Verbose "Config share `"$($output.ConfigShare)`" is accessable!" return $([PSCustomObject]$output) } else { Write-Warning "Could not access the config share `"$ConfigShare`"!" } } |