OnedriveMapper.ps1 4.04 script is showing network drive

413 Views Asked by At

I am using famous Onedrivemapper version 4.04 powershell script from https://gitlab.com/Lieben/OnedriveMapper_V3/-/blob/master/OneDriveMapper.ps1

This is basically used for adding Sharepoints as network drive. when I mention my sharepoint link in the script and run, it shows that the drive is mapped but the drive is not showing in my machine.
Error_Screenshot

1

There are 1 best solutions below

0
ipanema211 On BEST ANSWER

The issue is the "...DavWWWRoot\\teamsite..." double backslash, therefor the net use command throws an error.

Add this to line 608 of his 4.04 script and it should work:

$driveMapping.webDavPath = $driveMapping.webDavPath.Replace('DavWWWRoot\\', 'DavWWWRoot\')

Your code should look like this:

.........
function MapDrive{ 
    Param( 
        $driveMapping
    )
    $driveMapping.webDavPath = $driveMapping.webDavPath.Replace('DavWWWRoot\\', 'DavWWWRoot\')
    if($driveMapping.targetLocationType -eq "driveletter"){ 
.........

I know it's dirty, but I didn't want to go through 3000 lines of code to solve this