Mandev23
asked on
Edit Proxy settings on a remote computer
Hi
I was given this code on experts exchange:
@echo off
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyServer /t reg_sz /d "w2k3rti03:8080" /f
reg add "HKEY_CURRENT_USER\SOFTWAR E\Policies \Microsoft \Windows\C urrentVers ion\Intern et Settings" /d "Security_HKLM_only" /t reg_dword /v 00000001 /f
exit
It enables the proxy for a remote computer, executed from my own laptop with the aid of PsTools.
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
However it doesnt seem to be working now, i changed my laptop, got PsTools in the C: along with the IEReg.bat file...? it works if i run it for my own pc but not a remote one? Any suggestions?
Also is there a way this script can be executed using a scheduled task, without prompting the user to authorise/action the prompt..
I was given this code on experts exchange:
@echo off
reg add "HKEY_CURRENT_USER\Softwar
reg add "HKEY_CURRENT_USER\Softwar
reg add "HKEY_CURRENT_USER\SOFTWAR
exit
It enables the proxy for a remote computer, executed from my own laptop with the aid of PsTools.
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
However it doesnt seem to be working now, i changed my laptop, got PsTools in the C: along with the IEReg.bat file...? it works if i run it for my own pc but not a remote one? Any suggestions?
Also is there a way this script can be executed using a scheduled task, without prompting the user to authorise/action the prompt..
Copy the script to the other computer and then log in as an admin and create a scheduled task to run the script. TO create a schedule task go the the control panel and select scheduled task. From there just follow the wizard.
ASKER
but when the script run, the user is prompted whether they want to ammend the registry with these settings (yes/no), a scheduled task wont cater for this, i tried it earlier and the task just continuously said ..running
My main issue is the script not working at the moment, can you test it please on a remote pc?
My main issue is the script not working at the moment, can you test it please on a remote pc?
ASKER
hi nsx
what you are suggesting i have already tried and is not working... but this is besides the point, forget running it as a task for now...
the actual execution of the script doesnt work??
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
when i specify a remote pc name, it says its executed fine, but there is no change on the proxy
- this is what i would like the experts to test please.!!
what you are suggesting i have already tried and is not working... but this is besides the point, forget running it as a task for now...
the actual execution of the script doesnt work??
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
when i specify a remote pc name, it says its executed fine, but there is no change on the proxy
- this is what i would like the experts to test please.!!
Put it in a logon script.
Just these 2.....
@echo off
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyServer /t reg_sz /d "w2k3rti03:8080" /f
Save it as logon.bat
Even a limited user should have rights to that portion of the profile, as long as there are no othert policies in place to restrict it...
PS, I thought this looked familiar. I reviewed the last thread, and saw where the local machine wasnt working for IE7.....
Please advise if this doesnt work...
Just these 2.....
@echo off
reg add "HKEY_CURRENT_USER\Softwar
reg add "HKEY_CURRENT_USER\Softwar
Save it as logon.bat
Even a limited user should have rights to that portion of the profile, as long as there are no othert policies in place to restrict it...
PS, I thought this looked familiar. I reviewed the last thread, and saw where the local machine wasnt working for IE7.....
Please advise if this doesnt work...
ASKER
hi john
good to hear from you again..
Remember we had this working, however i've changed laptops but when i log in as admin, the script no longer executes on a remote pc? it says its done it but...?
so this time just use the two command lines using
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
??
good to hear from you again..
Remember we had this working, however i've changed laptops but when i log in as admin, the script no longer executes on a remote pc? it says its done it but...?
so this time just use the two command lines using
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
??
ASKER
hi john
no the two lines you gave do not work...?
it says its executed but no result on the remote pc?
the proxy does not enable...
no the two lines you gave do not work...?
it says its executed but no result on the remote pc?
the proxy does not enable...
but remember, it will modify the registry of the user RUNNING psexec , not the one you are targeting...
Thats why it worked under HKLM, but not under HKCU.
Thats why it worked under HKLM, but not under HKCU.
ASKER
i dont understand that, it worked as HKCU before... it enabled the proxy on the remote pc...
gues i could try is as HKLM again...?
gues i could try is as HKLM again...?
ASKER
as you know
HKLM does not have the option for setting the proxy:
reg add "HKEY_LOCAL_MACHINE\Softwa re\Microso ft\Windows \CurrentVe rsion\Inte rnet Settings" ProxyEnable?
- its only in HKCU...
When i put my machine name in this it works?? but not a remote pc
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
HKLM does not have the option for setting the proxy:
reg add "HKEY_LOCAL_MACHINE\Softwa
- its only in HKCU...
When i put my machine name in this it works?? but not a remote pc
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh right ok..
shall i not use psexec at this stage then?
Just save:
@echo off
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
reg add "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows\ CurrentVer sion\Inter net Settings" /v ProxyServer /t reg_sz /d "w2k3rti03:8080" /f
as a logon.bat file, and execute on the remote pc itself?
shall i not use psexec at this stage then?
Just save:
@echo off
reg add "HKEY_CURRENT_USER\Softwar
reg add "HKEY_CURRENT_USER\Softwar
as a logon.bat file, and execute on the remote pc itself?
ASKER
John
I saved the script as a logon.bat file, ran it on a remote computer itself and it worked. The proxy enabled.
- how can i now use psexec to remotely enable the proxy for a remote pc?
- or do i place the logon.bat file in the ADUC profile path? so it runs when they log on (always)
I saved the script as a logon.bat file, ran it on a remote computer itself and it worked. The proxy enabled.
- how can i now use psexec to remotely enable the proxy for a remote pc?
- or do i place the logon.bat file in the ADUC profile path? so it runs when they log on (always)
ASKER
i think its sorted...
I added the 2 lines to my current user logon script, and it discreetly enables the proxy. Perfect!
Although i have hidden the connections tab, so users cannot change it, the script should still run ok...
I added the 2 lines to my current user logon script, and it discreetly enables the proxy. Perfect!
Although i have hidden the connections tab, so users cannot change it, the script should still run ok...
ASKER
John
just one question though...
we originally spoke of Psexec, so where does the command you showed me fit into this?
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
?
just one question though...
we originally spoke of Psexec, so where does the command you showed me fit into this?
C:\>Pstools\>psexec.exe \\remote_pc_name -c -d IEReg.bat
?
You can use it to modify HKLM entries on the remote machine with no problem, think the main thing was that IE7 didnt like the HKLM_Security_Only value......
Other things work well for psexec as well....
psexec \\remotepc cmd.exe, open a cmd prompt on your machine, but it physically is a remote cmd shell... You can view system info, use other reg add, reg query commands etc....
very powerful tool.
I wasnt sure if you already had a logon script, so we were going to create a simple one, and deploy it using psexec using a simple copy command... You can run almost ANY command as you would locally, on a remote PC using psexec, but you have to be aware of the environment on the remote one.
psexec \\remotepc copy s:\folder\file.txt c:\newfolder\file.txt wouldnt work if bob was logged on with an S drive, because your proifile may not ave it mapped....
Make sense?
Other things work well for psexec as well....
psexec \\remotepc cmd.exe, open a cmd prompt on your machine, but it physically is a remote cmd shell... You can view system info, use other reg add, reg query commands etc....
very powerful tool.
I wasnt sure if you already had a logon script, so we were going to create a simple one, and deploy it using psexec using a simple copy command... You can run almost ANY command as you would locally, on a remote PC using psexec, but you have to be aware of the environment on the remote one.
psexec \\remotepc copy s:\folder\file.txt c:\newfolder\file.txt wouldnt work if bob was logged on with an S drive, because your proifile may not ave it mapped....
Make sense?
ASKER
I just added the lines to our current logon policy... seems to have worked fine. I like it because it requires no user input or action to authorise the change. Do you remember we created a similar script before using .reg files, they prompted the user with yes/no to authorise the change in the reg file....?
wow, that sounds awesome!
so, in affect i could type psexec \\remotepc cmd.exe, and see information on that remote pc from my computer? without logging on it? test pings etc..?
you will have to send me a list of useful commands i could use to check sys information etc.
i would like to experiment...
wow, that sounds awesome!
so, in affect i could type psexec \\remotepc cmd.exe, and see information on that remote pc from my computer? without logging on it? test pings etc..?
you will have to send me a list of useful commands i could use to check sys information etc.
i would like to experiment...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, is there a way to check settings on a remote computer like if the proxy is in place?
using psexec
using psexec
Not by querying an HKCU value......
Unless you know thier SID, which is more trouble than it's worth..... Faster to use Remote Registry, and look under the HKEY_Users hive...
Unless you know thier SID, which is more trouble than it's worth..... Faster to use Remote Registry, and look under the HKEY_Users hive...
ASKER
true..
ok.. thanks for your help again John.
i'll see how this goes tommorrow...
ok.. thanks for your help again John.
i'll see how this goes tommorrow...
Good luck..., and I will be around in a limited capacity if needed.....
ASKER
for whatever reason i dont think the script ran on the vista pc, is it because in regedit they dont have HKCU but rather HKEY_USERS ? different abbreviation
i cant find 'ProxyServer' setting in regedit on a vista pc?
i found ProxyEnable
i cant find 'ProxyServer' setting in regedit on a vista pc?
i found ProxyEnable
Vista has HKEY_CURRENT_USERS as well.....
Where was proxy enable?
Where was proxy enable?
Why is everyone making this so difficult? All you have to do is modify the registry from the system you're on. Use the code below to make a SETUPPROXY.CMD batch file and then run it like this:
SETUPPROXY.CMD [NAME_OF_SERVER]
Examples: SETUPPROXY.CMD ANUBIS
SETUPPROXY.CMD MORPHEUS.SOMEDOMAIN.COM
SETUPPROXY.CMD 10.13.21.45
REMEMBER: If a user is logged on when you run this, they may have to log off and back on for it to work. You can alternatively try ending task on explorer.exe and restarting it (must also have all browser windows closed)
Justin Chandler
SETUPPROXY.CMD [NAME_OF_SERVER]
Examples: SETUPPROXY.CMD ANUBIS
SETUPPROXY.CMD MORPHEUS.SOMEDOMAIN.COM
SETUPPROXY.CMD 10.13.21.45
REMEMBER: If a user is logged on when you run this, they may have to log off and back on for it to work. You can alternatively try ending task on explorer.exe and restarting it (must also have all browser windows closed)
Justin Chandler
reg add "\\%1\HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
reg add "\\%1\HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t reg_sz /d "w2k3rti03:8080" /f
reg add "\\%1\HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /d "Security_HKLM_only" /t reg_dword /v 00000001 /f
That works GREAT if they are administrators of the machines........