Created
April 13, 2023 10:40
-
-
Save transiient/2a4d87bdbf08d0fe1b4c4a02b4ae82a5 to your computer and use it in GitHub Desktop.
Export Azure File Sync drive mappings from Azure to a CSV file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$RSG_Name = Read-Host "Enter the name of the Resource Group in which the Sync Service resides:" | |
$SyncService_Name = Read-Host "Enter the name of the Sync Service:" | |
$ExportPath = Read-Host "Enter the path and filename (ending with .csv) to export to:" | |
$StorageSyncGroups = Get-AzStorageSyncGroup -ResourceGroupName $RSG_Name -StorageSyncServiceName $SyncService_Name | |
$Objects = foreach ($_SSG in $StorageSyncGroups) { | |
$_SSE = Get-AzStorageSyncServerEndpoint -ResourceGroupName $RSG_Name -StorageSyncServiceName $SyncService_Name -SyncGroupName $_SSG.SyncGroupName | |
New-Object -TypeName PSObject -Property @{ | |
SyncGroupName = $_SSG.SyncGroupName | |
SyncServerName = $_SSE.FriendlyName | |
SyncServerLocalPath = $_SSE.ServerLocalPath | |
CloudTiering = $_SSE.CloudTiering | |
} | Select-Object SyncGroupName,SyncServerName,SyncServerLocalPath,CloudTiering | |
} | |
$Objects | Export-Csv -NoTypeInformation -NoClobber "${ExportPath}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment