Windows has a perfectly good dialog for mapping a network drive, but I find it slow to click through. net use does the same in one line, and it also tells you what is currently connected.
net use Z: \\server\share * /user:name /persistent:yes
This assigns the drive letter Z: to the share. The * in the password position makes Windows ask for the password, and the password is not shown while you type it. That keeps it out of your command history. With /user: you connect as a different user, and Domain\User is allowed. Put an asterisk instead of a drive letter and Windows picks the next free one.
The documentation says /persistent:yes saves the connection and restores it at the next logon, and /persistent:no does not. The default is whatever you used last, which is easy to forget. Run net use alone to list your connections, or net use Z: for one of them.
To remove one mapping:
net use Z: /delete
Caveats. net use * /delete cancels all network connections at once, so use it with care. You cannot disconnect a share that is your current drive or that a running process is using. A server name with spaces needs quotation marks. /savecred stores the credentials for reuse, which is convenient on a private PC and a bad idea on a shared one.
Further reading: Net use (Microsoft Learn, archived Windows Server reference)
Going deeper: Guide: your Unraid cache is full and Docker stopped, how to find out why and fix it