c:\PSTools\> pstools \\remotecomputer -c -u domain\username -p password c:\files\regowner.reg
...where the .reg file looks like this when opened up in notepad for editing:Windows Registry Editor 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] "RegisteredOwner"="The Boss"
I ran this^^ exact syntax a few minutes prior with a batch file (a .bat file used to do something else on the computer) from the same location and it worked fine. Then I ran it with the .reg file and it connected to the other computer, but gave the following error:
PsExec could not start regowner.reg on remotecomputer: The system cannot find the file specified.
SO, I looked something up and tried it this way instead:
c:\PSTools\> psexec \\remotecomputer -c -u domain\username -p password regedit \\localcomputer\files\regowner.reg
...where the "files" directory (and all subdirectories) is also a share, if that matters.
The program hung for a long time... but when I checked the remotecomputer, the registry key had not been applied and when I use Start > Run > regedit, it gives me the error:
Regedit is not a valid win32 applicationI checked, and I actually have a regedit.exe in 2 locations (C:\WINDOWS and also C:\WINDOWS\system32) and both are different sizes and different dates. The C:\WINDOWS file actually opens the registry editor where the other gives me the previous error message.
Other possibly relevant info:
- I backed up (exported) the entire registry to a .reg file
- There is no regedit.com file anywhere (I've read that that could be the problem)
- Once I was able to open the registry editor, I tried to restore the backup copy I made just before I had done all of this, but it got almost to the end and said not all files could be imported or restored (don't remember the exact message)
- Got the same error ("not valid win32 app...") when I double-clicked the .reg backup file I made of the entire registry before trying this procedure
- I rebooted the computer and tried again, same error
- The localcomputer command prompt showed the follwing error when I rebooted the remotecomputer:
Error communicating with PsExec service on remotecomputer: The specified network name is no longer available. Could not delete regedit.exe from remotecomputer: The network path was not found....which I guess means it had regedit running, since the program (not just the .reg file) was specified to run in the command syntax. PSTools seems to copy the executable file, then run it, then remove it when it is done (all done silently in the background on the remote machine), which explains the "Could not delete.." portion of this error.
Any idea what I've done here or how to fix it? Is it possible to execute a .reg file remotely using PSTools? Is there another/better way of changing the RegisteredOwner key remotely? If so, where did I go wrong with the syntax or anything else? Please help... thanks.
Edited by johnnybiggles, 02 May 2012 - 12:17 PM.