Mapping OneDrive: Could Not Reconnect to All Network Drives


  1. Posts : 18
    Windows 10
       #1

    Mapping OneDrive: Could Not Reconnect to All Network Drives


    I've mapped OneDrive to use it as a backup storage per instruction here, but I get the said error every time I reboot. So I wrote a simple batch script to remap automatically when I logon to Windows.

    Usage: MapOneDrive.cmd [Number of checks] "[IPv4 to ping]" "[Drive letter]" "[OneDrive CID]" "[Username]" "[Password]"

    Example: MapOneDrive.cmd 60 "8.8.8.8" "Z" "123456789" "bulldog@live.net" "pwd123"

    The value "60" is the number of pings -- once per loop. A single loop is a little over a second.

    Save the following as "MapOneDrive.cmd". Create a shortcut to it with all the necessary information therein, then put it in the startup folder.

    Code:
    @ECHO OFF
    
    GOTO START
    
    :HELP
    ECHO.
    ECHO Usage: MapOneDrive.cmd [Number of checks] "[IP to ping]" "[Drive letter]" "[OneDrive CID]" "[Username]" "[Password]"
    ECHO.
    PAUSE
    GOTO END
    
    :START
    IF "%~1" == "/?" GOTO HELP
    IF "%~6" == "" (
        ECHO Something is missing!
        GOTO HELP
    )
    
    SETLOCAL
    SET count=0
    SET loop=%1
    
    :PING
    TIMEOUT /T 1 >nul
    SET /A count=count+1
    PING -4 -n 1 %2 | find "Reply from" >nul
    GOTO CHECK
    
    :CHECK
    IF NOT ERRORLEVEL 1 ( 
        GOTO MAP
    ) ELSE (
        IF %count% LSS %loop% (
            GOTO PING
        ) ELSE (
            GOTO END
        )
    )
    
    :MAP
    ECHO Mapping drive %3 in progress...
    NET USE %3: "https://d.docs.live.net/%4" /user:%5 %6 /persistent:yes
    GOTO END
    
    :END
    ENDLOCAL
    Hope you'll find it useful! :)
    Last edited by Taurean75; 12 Sep 2015 at 12:25.
      My Computer


  2. Posts : 149
    Windows 10 Pro
       #2

    Thanks for sharing! Worked like a charm!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:05.
Find Us




Windows 10 Forums