@Iswarya Welcome to Microsoft Q&A Forum, Thank you forposting your query here!
Try to add localhost in front of storage account name when you add the drive. (localhost\storageaccount).
It seems like you're encountering an issue with the New-SmbGlobalMapping
command after upgrading to Windows Datacenter 2022. This error message, "A specified logon session does not exist. It may already have been terminated," can be quite frustrating, especially since the New-SmbMapping
command works without any issues.
Here are a few steps you can try to resolve this issue:
Check Credentials: Ensure that the credentials used for New-SmbGlobalMapping
are correct and have the necessary permissions to access the Azure share drive. Sometimes, the credentials might not be properly passed or recognized.
Session Persistence: The error might be related to session persistence. Ensure that the logon session is active and hasn't been terminated. You can try re-authenticating or using a different set of credentials.
Update Windows: Make sure your Windows Datacenter 2022 OS is up to date with the latest patches and updates. Sometimes, these updates can resolve underlying issues with commands and services.
Use New-SmbMapping
: Since New-SmbMapping
works, you can use it as an alternative. However, if you specifically need New-SmbGlobalMapping
, you might need to investigate further or contact Microsoft support for a more detailed resolution.
Review Documentation: Check the official Microsoft documentation for any changes or additional requirements for using New-SmbGlobalMapping
in Windows Datacenter 2022. There might be new parameters or configurations needed.
If you continue to face issues, it might be helpful to look into the specific differences between New-SmbMapping
and New-SmbGlobalMapping
commands and see if there are any additional configurations required for the latter in the new OS environment.
Here are a few steps you can try to resolve this issue:
Check Credentials: Ensure that the credentials used for the New-SmbGlobalMapping
command are correct and have the necessary permissions. You can use the Get-Credential
cmdlet to gather the credentials and pass them to the New-SmbGlobalMapping
command.
Use Persistent Flag: When creating the SMB global mapping, try using the -Persistent $true
flag. This ensures that the mapping persists across reboots. For example:
$creds = Get-Credential
New-SmbGlobalMapping -RemotePath "\\storageaccountname.file.core.windows.net\folder1" -Credential $creds -LocalPath T: -Persistent $true
- Add Localhost Prefix: Some users have found that adding
localhost
in front of the storage account name helps resolve the issue. For example:
New-SmbGlobalMapping -RemotePath "\\localhost\storageaccountname.file.core.windows.net\folder1" -Credential $creds -LocalPath T:
Check for Updates: Ensure that your Windows Datacenter 2022 server is up to date with the latest patches and updates. Sometimes, these updates can resolve underlying issues with the OS.
Alternative Methods: If the issue persists, you can try using the New-SmbMapping
command as a workaround, as you mentioned it works without issues.
References
New-SmbGlobalMapping (SmbShare) | Microsoft Learn
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.