How to change a registry key on multiple machines via psexec?
Posted on 2009-02-18
Ok, I have looked at multiple other EE threads but thus far had no luck applying what I have seen to my organization. Here is what I am trying to do...
I need to edit a registry value located at HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR on a couple hundred desktops running Windows XP. My instinct was to export a key with the desired values and then use a script to execute the exported .reg file remotely via psexec since I have no way to force users to log off and log back in for a login script to run the file. I can go to a remote computer and execute my script which contains only a single line:
regedit /s \\absolute.path\to\file.reg
Path edited, obviously, but you get the point. If I sit at a remote computer and execute this .bat file, the registry value is changed as desired. However, if I run the same .bat file on the same computer via psexec, psexec returns with an error code 0 (so, no error) but the registry value does not change. The psexec command as I'm running it is thus:
psexec \\computername.my.domain -c mybatfile.bat
I have tried entering other switches into the psexec command, such as -s to run the .bat file in the System account, but the end result remains the same. No change is made to the registry on the remote machine despite no error being produced. The only way I have successfully been able to us psexec to execute this script is when I include the -i switch, running it so that it interacts with the desktop on the remote machine, but that still requires user input which is what I'm trying to avoid.
Can anyone tell me what I'm missing here?