Andleeb Hasan
Andleeb Hasan

Reputation: 29

OnedriveMapper.ps1 4.04 script is showing network drive

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

Upvotes: 0

Views: 441

Answers (1)

ipanema211
ipanema211

Reputation: 40

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

Upvotes: 1

Related Questions