remote pc>mapped drives to txt

405 views Asked by At

my intent is to get this..

cls
setlocal enableextensions disabledelayedexpansion
echo Create backup txt file of mapped drives
echo -----
set /p PCname=Asset tag or IP address:
set /p UserID=UserID:
for /f "tokens=2,3 delims=," %%a in (
'wmic netuse get LocalName^, RemoteName^, Status /format:list ^| find ":"'
) do echo(%%a %%b>> \\%PCname%\c$\windows\temp\%PCname%_%UserID%_map.txt
xcopy /d/y \\%PCname%\c$\windows\temp\%PCname%_%UserID%_map.txt ".\remoteStats\"
pause
Goto :mdmenu

to map drives of a remote pc,%PCname%,to a text file with just the drive letter and path, copy that text file to the techs computer running the script into a .\remotestats\ folder

this way I can use that same text file to remap those drives automatically

:mdrestore
cls
echo Map Drives from backup txt
echo -----
echo Notes:
echo Needs a backup to restore from, inside
echo remoteStats folder
echo. 
set /p PCname=Asset tag or IP address:
set /p UserID=Enter BH Username:
for /f %%a in (.\RemoteStats\%PCname%_%username%_map.txt) do Psexec \\%PCname% -d -s cmd /c net use %%a /p:Yes
psexec \\%PCname% -d cmd.exe /c net use S: \\mapped.drive\share /p:Yes
psexec \\%PCname% -d cmd.exe /c net use H: \\mappeddrive2\home  /p:Yes
Print "Drives mapped"
Timeout /t 30 >nul
GOTO :mdmenu
0

There are 0 answers