Hi @ahmed salah ,
There is some mistakes in your command, please refer to below command to adjust your command.
EXEC xp_cmdshell ‘net use <driver letter> \\<servername>\<sharename> /user:<username> <password>’
For example:
You can write the above statement as follows:
EXEC xp_cmdshell 'net use z: \192.168.1.1\shareddrive /user:YOURUSERNAME PASSWORD'
Once you run the above code it will map your shared folder share drive from the server 192.168.1.1 to the local system as a Z: drive.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".