#skype4b #powershell Always Up-to-date Infrastructure Inventory (Topology)

#requires -version 3.0
###############################################################################
# Copyright (c) 201x-2018 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Version 1.00
#
# Skype for Business Server – Always Up-to-date Inventory (Topology)
# Gathers core #skype4b infrastructure inventory (topology), supporting
# server roles, file stores and SQL backend databases.
#
# NOTE – change SiteId where appropriate
###############################################################################

$topo = Get-CsTopology
$dbuser = Get-CsService -UserDatabase
$dbmon = Get-CsService -MonitoringDatabase
$wacSrv = Get-CsService -WacServer
$fileStoreSrv = Get-CsService -FileStore
$pfqdn = (Get-CsService -Registrar | ? SiteId -eq “Site:FR”).PoolFqdn

$list = @()
$pfqdn | % {
foreach ($c in $topo.Clusters)
{
if ($c.Fqdn -eq $PsItem)
{
$psi = $PsItem
$SqlBackEnd = ($dbuser | ? { $_.DependentServiceList | ? { $_ -match “$psi” } } )
$SqlMon = ($dbmon | ? { $_.DependentServiceList | ? { $_ -match “$psi” } } )
$wac = ($wacSrv | ? { $_.DependentServiceList | ? { $_ -match “$psi” } } )
$fstore = ($fileStoreSrv | ? { $_.DependentServiceList | ? { $_ -match “$psi” } } )

$obj = New-Object PsCustomObject
$obj | Add-Member -Type NoteProperty -Name Pool -Value $psi
$obj | Add-Member -Type NoteProperty -Name ClusterId -Value $c.ClusterId
$obj | Add-Member -Type NoteProperty -Name Nodes -Value $c.machines
$obj | Add-Member -Type NoteProperty -Name SqlServer -Value $SqlBackEnd.PoolFqdn
$obj | Add-Member -Type NoteProperty -Name SqlInstance -Value $SqlBackEnd.SqlInstanceName
$obj | Add-Member -Type NoteProperty -Name SqlMon -Value $SqlMon.PoolFqdn
$obj | Add-Member -Type NoteProperty -Name SqlMonInstance -Value $SqlMon.SqlInstanceName
$obj | Add-Member -Type NoteProperty -Name WacPoolFqdn -Value $wac.PoolFqdn
$obj | Add-Member -Type NoteProperty -Name FileShareUncPath -Value $fstore.UncPath

$list += $obj
}
}
}

#$list
#$list.count
$list | ogv -Title “www.leedesmond.com #skype4b Always Up-to-date Inventory (Topology) ($($list.count))”

Leave a Reply