Module/BusinessCentral/Get-BCSServerInstances.ps1
<#
.SYNOPSIS .DESCRIPTION .EXAMPLE .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Get-BCSServerInstances { Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory = $false)] [string]$ServerInstance, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $false)] [string]$bcVersion ) begin {} process { Import-BCSDynamicsNavModules -serverInstance $ServerInstance -bcVersion $bcVersion $instances = Get-NAVServerInstance $Hash = [PSCustomObject]@(); foreach ($instance in $instances) { $item = New-Object PSObject $item | Add-Member -type NoteProperty -Name 'ServerInstance' -Value $instance.ServerInstance; $item | Add-Member -type NoteProperty -Name 'DisplayName' -Value $Instance.DisplayName; $item | Add-Member -type NoteProperty -Name 'State' -Value $instance.State $item | Add-Member -type NoteProperty -Name 'ServiceAccount' -Value $instance.ServiceAccount $item | Add-Member -type NoteProperty -Name 'Version' -Value $instance.Version $item | Add-Member -type NoteProperty -Name 'Default' -Value $instance.Default $Hash += $item; } $Hash } end { } } Export-ModuleMember -Function Get-BCSServerInstances |