Mapped Network Drives ใช้เข้าถึง Drive บนคอมพิวเตอร์อื่น/Storage ภายนอก แต่ Windows 10 v1809+ มักมีปัญหา: แสดง Red X, Unavailable ใน CMD, หรือ Notification แจ้งเตือน อาจใช้เวลานานเกินไปในการเชื่อมต่อ แนะนำรัน Script ตอน Logon
Workarounds สำหรับ Mapped Drives ไม่ทำงาน
แต่ละวิธีเหมาะสถานการณ์ต่างกัน (Network at Logon, GPO Settings) เลือกที่เหมาะกับคุณ
สร้าง Scripts (2 ไฟล์)
MapDrives.cmd (รันที่ CMD ธรรมดา):
PowerShell -Command "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1 PowerShell -File "%SystemDrive%\Scripts\MapDrives.ps1" >> "%TEMP%\StartupLog.txt" 2>&1
MapDrives.ps1 (PowerShell Script):
$i=3
while($True){
$error.clear()
$MappedDrives = Get-SmbMapping |where -property Status -Value Unavailable -EQ | select LocalPath,RemotePath
foreach( $MappedDrive in $MappedDrives) {
try {
New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True
} catch {
Write-Host "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath"
}
}
$i = $i - 1
if($error.Count -eq 0 -Or $i -eq 0) {break}
Start-Sleep -Seconds 30
}
เก็บทั้ง 2 ไฟล์ในโฟลเดอร์เดียวกัน
วิธีรัน Script ให้เชื่อม Mapped Drives อัตโนมัติ
1. Startup Item (ต้องมี Network ตอน Logon)
- Copy MapDrives.cmd ไป
%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp - Copy MapDrives.ps1 ไป
%SystemDrive%\Scripts\ - จะสร้าง Log:
%TEMP%\StartupLog.txtLogout/Login ใหม่
2. Scheduled Task (แนะนำ)

- Copy MapDrives.ps1 ไป
%SystemDrive%\Scripts\ - เปิด Task Scheduler > Action > Create Task
- General: ชื่อ, Description, Change User or Group เลือก User/Group, Run with highest privileges
- Triggers: New > At Logon
- Actions: New > Start a Program:
- Program: Powershell.exe
- Arguments: -windowsstyle hidden -command .\MapDrives.ps1 >> %TEMP%\StartupLog.txt 2>&1
- Start in: %SystemDrive%\Scripts\
- Conditions: Start only if network connection available > Any connection

Reboot/Logoff แล้ว Login ใหม่ Task จะทำงาน
3. Group Policy Settings (ถ้า Mapped Drives มาจาก GPO)

เปลี่ยน Action ของ Drive Maps เป็น Replace (ลบ Drive เก่า สร้างใหม่ทุก Logon) — Settings บน Mapped Drive ที่ตั้งผ่าน GPO จะหายทุกครั้ง หากไม่ได้ รัน gpupdate /force
วิธีใดวิธีหนึ่งจาก Microsoft ควรช่วยแก้ปัญหาได้ บอกเราได้ว่าวิธีไหนใช้ได้
