Short story: I need a script (and best way to run it GPO LOGON etc) to log all mapped drives and report it back to a network share.
Long Story:
I am working for a client that had 10 servers (if putting a sticker that says "do not touch server" on a dell P4 makes it a server) running random shares. I am removing 8 of these "servers" and installed a real server. Since there is no logic behind what and where the shares are to begin with and most users have shares mapped staticly I need to know what people are connecting to. A few years ago I created a script that run at logon and reported the mapped drives to a log file that was sent to a network share. I have forgotten most of my scripting in that time and do not have the time to relearn it.
Please help
Active Directory
Last Comment
kind4me
8/22/2022 - Mon
drequinox
the following script will give you the list of all mapped drives
strComputer = "."
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colDrives = objWMI.ExecQuery("select * from Win32_MappedLogicalDisk")
WScript.Echo "Mapped Drives:"
for each objDrive in colDrives
WScript.Echo " Device ID: " & objDrive.DeviceID
WScript.Echo " Volume Name: " & objDrive.VolumeName
WScript.Echo " Session ID: " & objDrive.SessionID
WScript.Echo " Size: " & objDrive.Size
WScript.Echo
next
strComputer = "."
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colDrives = objWMI.ExecQuery("select * from Win32_MappedLogicalDisk")
WScript.Echo "Mapped Drives:"
for each objDrive in colDrives
WScript.Echo " Device ID: " & objDrive.DeviceID
WScript.Echo " Volume Name: " & objDrive.VolumeName
WScript.Echo " Session ID: " & objDrive.SessionID
WScript.Echo " Size: " & objDrive.Size
WScript.Echo
next