Skip to content

Instantly share code, notes, and snippets.

@coppinri
coppinri / wake_mount.py
Created April 30, 2026 09:59
Open a network path even through Windows lazy mount.
""" Forces Windows to mount the drive, if this is the first time the drive is accessed. """
class _NETRESOURCEW(ctypes.Structure):
_fields_ = [
('dwScope', wt.DWORD),
('dwType', wt.DWORD),
('dwDisplayType', wt.DWORD),
('dwUsage', wt.DWORD),
('lpLocalName', wt.LPWSTR),
('lpRemoteName', wt.LPWSTR),