本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
將檔案共用組態遷移到 Amazon FSx
您可以使用下列程序將現有的檔案共用組態遷移到 Amazon FSx。在此程序中,來源檔案伺服器是您要將其檔案共用組態遷移到 Amazon FSx 的檔案伺服器。
注意
在移轉檔案共用組態之前,請先將檔案移轉到 Amazon FSx。如需詳細資訊,請參閱 將現有的檔案儲存移轉至 FSx for Windows File Server。
若要將現有的檔案共用移轉至 Windows 檔案伺服器的 FSx
-
在來源檔案伺服器上,從內容功能表中選擇「以管理員身分執行」。 PowerShell以系統管理員身分開啟視窗。
-
SmbShares.xml
透過在中執行下列指令,將來源檔案伺服器的檔案共用匯出到名為的檔案 PowerShell。在此範例中,將 F: 替換為您要從中匯出檔案共用的檔案伺服器上的磁碟機代號。$shareFolder = Get-SmbShare -Special $false | ? { $_.Path -like “F:\*” } $shareFolder | Export-Clixml -Path F:\SmbShares.xml
-
編輯
SmbShares.xml
檔案,將 F: (您的磁碟機代號) 的所有參照取代為 D:\share,因為 Amazon FSx 檔案系統駐留在 D:\share. -
將現有的檔案共用組態匯入至 FSx for Windows File Server)。在可存取目的地 Amazon FSx 檔案系統和來源檔案伺服器的用戶端上,複製儲存的檔案共用組態。然後使用以下命令將其導入到變量中。
$shares = Import-Clixml -Path F:\SmbShares.xml
-
使用下列其中一個選項,準備在 FSx for Windows 檔案伺服器檔案伺服器上建立檔案共用所需的認證物件。
若要以互動方式產生認證物件,請使用下列命令。
$credential = Get-Credential
若要使用 AWS Secrets Manager 資源產生認證物件,請使用下列命令。
$credential = ConvertFrom-Json -InputObject (Get-SECSecretValue -SecretId $AdminSecret).SecretString $FSxAdminUserCredential = (New-Object PSCredential($credential.UserName,(ConvertTo-SecureString $credential.Password -AsPlainText -Force)))
-
使用下列指令碼將檔案共用組態遷移到 Amazon FSx 檔案伺服器。
$FSxAcceptedParameters = ("ContinuouslyAvailable", "Description", "ConcurrentUserLimit", "CATimeout", "FolderEnumerationMode", "CachingMode", "FullAccess", "ChangeAccess", "ReadAccess", "NoAccess", "SecurityDescriptor", "Path", "Name", "EncryptData") ForEach ($item in $shares) { $param = @{}; Foreach ($property in $item.psObject.properties) { if ($property.Name -In $FSxAcceptedParameters) { $param[$property.Name] = $property.Value } } Invoke-Command -ConfigurationName FSxRemoteAdmin -ComputerName amznfsxxxxxxxxx.corp.com -ErrorVariable errmsg -ScriptBlock { New-FSxSmbShare -Credential $Using:credential @Using:param } }