|
1 | 1 | --- |
2 | 2 | title: Mapped network drive may fail to reconnect in Windows 10, version 1809 |
3 | 3 | description: An article provides a workaround to resolve mapped network drives not working in Windows 10, version 1809. |
4 | | -ms.date: 01/15/2025 |
| 4 | +ms.date: 04/14/2025 |
5 | 5 | manager: dcscontentpm |
6 | 6 | audience: itpro |
7 | 7 | ms.topic: troubleshooting |
@@ -51,9 +51,9 @@ while($True){ |
51 | 51 | foreach( $MappedDrive in $MappedDrives) |
52 | 52 | { |
53 | 53 | try { |
54 | | - New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True |
| 54 | + New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True -ErrorAction Stop |
55 | 55 | } catch { |
56 | | - Write-Host "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath" |
| 56 | + Write-Host "There was an error mapping $($MappedDrive.RemotePath) to $($MappedDrive.LocalPath)" |
57 | 57 | } |
58 | 58 | } |
59 | 59 | $i = $i - 1 |
@@ -97,3 +97,22 @@ All workarounds should be executed in standard user security context. Executing |
97 | 97 | 9. In the **Start in (optional)** field, type the location (_%SystemDrive%\\Scripts\\_) of the script file. |
98 | 98 | 10. On the **Conditions** tab, select the **Start only if the following network connection is available** option, select **Any connection**, and then select **OK**. |
99 | 99 | 11. Log off, and then log back on to the device to run the scheduled task. |
| 100 | + |
| 101 | +#### Workaround 3: Create a scheduled task for Microsoft VPN Client EventID 20225(VPN Connection Successfully established) |
| 102 | + |
| 103 | +1. Copy the script file MapDrives.ps1 to the following location: |
| 104 | + %SystemDrive%\\Scripts\\ |
| 105 | +2. In **Task Scheduler**, select **Action** > **Create Task**. |
| 106 | +3. On the **General** tab in the **Create Task** dialog box, type a name (such as *Map Network Drives*) and description for the task. |
| 107 | +4. Select **Change User or Group**, select a local user or group (such as **LocalComputer\\Users**) and then select **OK**. |
| 108 | +5. On the **Triggers** tab, select **New**, and then select **On an event** for the **Begin the task** field. |
| 109 | +6. On the **Triggers** tab, select **Log**, and then select **Application** from the **Log** dropdown list. |
| 110 | +7. On the **Triggers** tab, Type **RasClient** for the **Source** field. |
| 111 | +8. On the **Triggers** tab, Type **20225** for the **Event ID** field and then select **OK**. |
| 112 | +9. On the **Actions** tab, select **New**, and then select **Start a program** for the **Action** field. |
| 113 | +10. Type *Powershell.exe* for the **Program/script** field. |
| 114 | +11. In the **Add arguments (optional)** field, type the following: |
| 115 | + *-windowsstyle hidden -command .\\MapDrives.ps1 >> %TEMP%\\StartupLog.txt 2>&1* |
| 116 | +12. In the **Start in (optional)** field, type the location (*%SystemDrive%\\Scripts\\*) of the script file. |
| 117 | +13. On the **Conditions** tab, select the **Start only if the following network connection is available** option, select **Any connection**, and then select **OK**. |
| 118 | +14. Log off, and then log back on to the device to run the scheduled task. |
0 commit comments