Hello Luigi,
I have make a Powershell script to get all Hubsite from a site:
CLS
$userName = "admin@contosnmicrosoft.com"
$passWord = "contosopassword"
$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord
Connect-PnPOnline -Url "https://contoso-admin.sharepoint.com/" -Credentials $cred
#Getting the hub site id for which we want to generate the report - those are connected to this hub site.
$hubSiteURL="https://contoso.sharepoint.com/sites/contoso"
$hubSite = Get-PnPTenantSite $hubSiteURL
$hubSiteId = $hubSite.HubSiteId
write-host "Hub Site URL: " $hubSiteURL
$associatedSites = @()
#Get all sites associated to the hub site(in the above hub site)
$sitesTenant = Get-PnPTenantSite -Detailed
# Create a new XML File
[System.XML.XMLDocument]$oXMLDocument=New-Object System.XML.XMLDocument
[System.XML.XMLElement]$oXMLRoot=$oXMLDocument.CreateElement("sites")
$oXMLDocument.appendChild($oXMLRoot)
$sitesTenant | select url | % {$oneSite = Get-PnPTenantSite $_.url
if($oneSite.hubsiteid -eq $hubSiteId)
{
if(![string]::IsNullOrEmpty($oneSite.title)) {
write-host "HUBSITE: " $oneSite.title
[System.XML.XMLElement]$oXMLSystem=$oXMLRoot.appendChild($oXMLDocument.CreateElement("site"))
$oXMLSystem.SetAttribute("sitenaam", $oneSite.title)
$oXMLSystem.SetAttribute("siteurl", $oneSite.url)
}
}
}
# Save File
$oXMLDocument.Save("c:\temp\sharepointsites.xml")
And the above XML I use in DN.
Kind regards,
Eric