This is a portion of my powershell script where I have to map a local folder to the S: Drive. I can't map New-PSDrive when my script 'Run as Admin'. If I do, it is not visible on 'My PC'. I have ran Get-PSDrive and it shows it is visible just not on 'MY PC'.
I have tried Net-Use within PS. I have tried New-SMBmapping
New-SMBmapping -localpath 'S:' -remotepath '\\$comName\pos' -persistent $true
My script needs to Run As Admin for the rest of my script. Currently this is the my script.
#Get Computer name
$comName = $computerNameCSV.ComputerName
#This will map folder to S drive
New-SmbShare -Name "SOP" -Path "C:\FolderShare" -FullAccess Everyone
New-PSDrive -Name "S" -Root "\\$comName\c$\FolderShare" -Persist -PSProvider "FileSystem"