I struggled with this for awhile. It is now working correctly for me, but I don't know what fixed it. (My PC has a fresh install of Windows 11 Pro for Workstations 23H2 (Version 10.0.22631), and my server is CentOS Linux.)
Note: Microsoft has a document about this exact problem, but it was written for Windows 7:
https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/mapped-drives-not-available-from-elevated-command
Here are things I tried which might have contributed to the eventual success.
First, In "Network" I enabled network discovery and file sharing. (No joy.)
Then in Settings:
System -> (perhaps "Optional Features" -> ) "More Windows Features"
-> enable SMB... (everything) [SMB 1.0 CIFS File Sharing Support]
(Alternately, I've read that from an elevated/Administrator prompt you can do: "DISM /Online /Enable-Feature /All /FeatureName:SMB1Protocol" which should be equivalent.)
Then restart.
Then I went to "This PC" (not "Network!" WHY WHY WHY, Microsoft??), clicked "...", then "Map network drive" with "Reconnect at sign-in" checked, and mapped my X: drive letter to my Samba share.
That enabled visibility of X: from non-elevated command prompts, but not from elevated ("as Administrator") command prompts.
Then I opened an elevated / Administrator CMD.EXE command prompt.
From there:
I ran C:\Windows\explorer.exe
(Since I started it from an elevated command prompt, I hoped it would be running elevated, too.)
From the resulting Windows File Explorer window, I went to "This PC," clicked "...", then "Map network drive" with "Reconnect at sign-in" checked, and mapped my X: drive letter to my Samba share. (I might have "disconnected" it first -- sorry, I don't recall.) Then I closed the Windows File Explorer window.
(At first I thought that hadn't worked, but now I'm unsure.)
Back at the elevated / Administrator command prompt...
net use /persistent:yes
net use X: \\MYSAMBASERVER\myvolume /global
net use /persistent:yes
I probably also did this from a regular (not elevated) command prompt, but I doubt it was useful:
net use X: /delete
net use /persistent:yes
net use X: \\MYSAMBASERVER\myvolume /global
net use /persistent:yes
(There were several reboots along the way, too.)
And, now, after a reboot, both regular and elevated command prompts (and PowerShell prompts) can see my X: network drive.
Notes:
"net use /persistent:yes" is a standalone command, not an option to be added to the mapping command. From the documentation it is unclear whether it applies to future drive letter mappings or to already established mappings, so I did it both before and after the mapping command.
"wmic netuse" displays the "persistence" of an existing drive mapping, but it seems to have nothing to do with whether or not the drive mapping is reestablished after a reboot.
Running "net use" commands as a Scheduled Task never worked for me. I even tried running them from a .bat file, via a .lnk to the .bat file which forced the .bat file to run "as Administrator." It did no good.
I also could never manage to get anything to run as the "NT AUTHORITY\SYSTEM" account (which doesn't appear to exist on my system).
I don't know what, if anything, the /global option does. It is not mentioned in the net use documentation which I found.