Author: paul508
Subject: Add an .reg file on remote machine
Posted: 13 May 2016 at 2:31pm
This hasn't worked for me, My script is:
Edited by paul508 - 13 hours 29 minutes ago at 2:33pm
Subject: Add an .reg file on remote machine
Posted: 13 May 2016 at 2:31pm
This hasn't worked for me, My script is:
REGEDIT4
@echo off
CLS
REM This file assumes you have psexec installed
REM Ask for machine name or IP
set /p machine= Please enter the machine name or ip:
REM check for workstation online, if not exit
ping %machine% | find "Reply"
if errorlevel 1 goto :offline
if errorlevel 0 goto :install
@echo off
CLS
REM This file assumes you have psexec installed
REM Ask for machine name or IP
set /p machine= Please enter the machine name or ip:
REM check for workstation online, if not exit
ping %machine% | find "Reply"
if errorlevel 1 goto :offline
if errorlevel 0 goto :install
:offline
echo Workstation not online
pause
exit
echo Workstation not online
pause
exit
:install
copy "Q:\tools\pstools\pstools\*.*" \\local computer\c$\windows\system32\
copy "Q:\tools\pstools\pstools\*.*" \\%machine%\c$\windows\system32\
copy "Q:\Applications\fix.reg" \\%machine%\c$\windows\system32\
copy "Q:\tools\pstools\pstools\*.*" \\local computer\c$\windows\system32\
copy "Q:\tools\pstools\pstools\*.*" \\%machine%\c$\windows\system32\
copy "Q:\Applications\fix.reg" \\%machine%\c$\windows\system32\
rem regini -m \\%machine% reg_Multisz_file c$\temp\fix.reg
regedit.exe /i \\%machine%\c$\temp\fix.reg
rem \\%machine%\c$\temp\fix.reg regini -m \\%machine% -b
rem psexec -u -p cmd /s \\%machine%\c$\windows\system32\regedt32.exe
rem \\%machine%\c$\temp\fix.reg
rem PsExec \\%machine% -u -p reg.exe import \c$\windows\system32\fix.reg
regedit.exe /i \\%machine%\c$\temp\fix.reg
rem \\%machine%\c$\temp\fix.reg regini -m \\%machine% -b
rem psexec -u -p cmd /s \\%machine%\c$\windows\system32\regedt32.exe
rem \\%machine%\c$\temp\fix.reg
rem PsExec \\%machine% -u -p reg.exe import \c$\windows\system32\fix.reg
if errorlevel 1 goto :remove
if errorlevel 0 goto :remove
if errorlevel 0 goto :remove
:remove
Del \\%machine%\c$\windows\system32\psexec.exe
Del \\%machine%\c$\windows\system32\psfile.exe
Del \\%machine%\c$\windows\system32\psgetsid.exe
Del \\%machine%\c$\windows\system32\psinfo.exe
Del \\%machine%\c$\windows\system32\pskill.exe
Del \\%machine%\c$\windows\system32\pslist.exe
Del \\%machine%\c$\windows\system32\psloggedon.exe
Del \\%machine%\c$\windows\system32\psloglist.exe
Del \\%machine%\c$\windows\system32\pspasswd.exe
Del \\%machine%\c$\windows\system32\psservice.exe
Del \\%machine%\c$\windows\system32\pssuspend.exe
Del \\%machine%\c$\windows\system32\fix.reg
Del \\%machine%\c$\windows\system32\psexec.exe
Del \\%machine%\c$\windows\system32\psfile.exe
Del \\%machine%\c$\windows\system32\psgetsid.exe
Del \\%machine%\c$\windows\system32\psinfo.exe
Del \\%machine%\c$\windows\system32\pskill.exe
Del \\%machine%\c$\windows\system32\pslist.exe
Del \\%machine%\c$\windows\system32\psloggedon.exe
Del \\%machine%\c$\windows\system32\psloglist.exe
Del \\%machine%\c$\windows\system32\pspasswd.exe
Del \\%machine%\c$\windows\system32\psservice.exe
Del \\%machine%\c$\windows\system32\pssuspend.exe
Del \\%machine%\c$\windows\system32\fix.reg
pause
<< Reg file fix.reg>>
Windows Registry Editor Version 5.00
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
As you can see I have tried several command versions the active one is my most successful though that just runs the fix.reg file from the remote computer and updates my local machine so its not really that successful
Can anyone see anything I have incorrect?
Edited by paul508 - 13 hours 29 minutes ago at 2:33pm