# PCS Toolkit - Mapped Drives Report # Lists all network drives and recent connections $timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" $outputFile = "$env:USERPROFILE\Desktop\MappedDrives_$timestamp.txt" function Log($msg) { Write-Host $msg Add-Content $outputFile $msg } Log "========================================" Log " PCS Toolkit - Mapped Drives Report" Log "========================================" Log "Generated: $(Get-Date)" Log "Computer: $env:COMPUTERNAME" Log "User: $env:USERNAME" Log "" Log "=== CURRENT NETWORK DRIVES ===" $netDrives = Get-PSDrive -PSProvider FileSystem | Where-Object { $_.DisplayRoot } if ($netDrives) { foreach ($drive in $netDrives) { Log "" Log "Drive $($drive.Name):" Log " Path: $($drive.DisplayRoot)" if ($drive.Used) { Log " Used: $([math]::Round($drive.Used / 1GB, 2)) GB" Log " Free: $([math]::Round($drive.Free / 1GB, 2)) GB" } } } else { Log "No network drives currently mapped" } Log "" Log "=== NET USE OUTPUT ===" net use 2>&1 | ForEach-Object { Log $_ } Log "" Log "=== PERSISTENT CONNECTIONS (Registry) ===" $netPaths = @( "HKCU:\Network", "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2" ) foreach ($path in $netPaths) { if (Test-Path $path) { Log "" Log "From: $path" Get-ChildItem $path -EA SilentlyContinue | ForEach-Object { $props = Get-ItemProperty $_.PSPath -EA SilentlyContinue if ($props.RemotePath) { Log " $($_.PSChildName): $($props.RemotePath)" } elseif ($_.PSChildName -like '##*') { # MountPoints2 uses ## prefix for UNC paths $uncPath = $_.PSChildName -replace '##', '\\' -replace '#', '\' Log " $uncPath" } } } } Log "" Log "=== RECENT NETWORK LOCATIONS ===" $recent = "$env:APPDATA\Microsoft\Windows\Recent" if (Test-Path $recent) { Get-ChildItem $recent -Filter "*.lnk" | Where-Object { $_.Name -match '\\\\' } | Select-Object -First 10 | ForEach-Object { Log " $($_.Name)" } } Log "" Log "========================================" Log "REPORT COMPLETE" Log "========================================" explorer.exe "/select,$outputFile" Read-Host "Press Enter to exit"