Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this code (.bat file) that I want to run by going to each computer that is logged in and executing it. However, not all users have admin rights. Is there anything I can do without logging off to change the IP's from static to DHCP?

netsh interface ip set address name="Local Area Connection" source=dhcp

netsh interface ip set dns name="Local Area Connection" source=dhcp
share|improve this question

1 Answer 1

up vote 8 down vote accepted

You really want to do this with Group Policy. You can set this as a computer startup script and it will run as the local SYSTEM account, which has permission to change these settings.

Otherwise, you can use psexec to run it remotely on a machine as a privileged user.

share|improve this answer
    
I tried it as a startup script but running gpresult seems to have it filtered out for some reason. –  Markaway Dec 5 '12 at 16:27
1  
You should try and track down why and fix it. Not being able to use Group Policy is crippling. –  MDMarra Dec 5 '12 at 16:45
    
I added Auth Users, the name of the computer, and the user that logs in. None of it seems to make a difference. Is it safe to put the GPO directly under the domain name rather than in the OU ? –  Markaway Dec 5 '12 at 16:51
1  
That warning message is because different GPOs may apply (which is actually what you want). It's not going to break authentication or anything. Generally, you can move objects freely between OUs with no ill effects other than the applied GPOs changing. Test it with one machine, do gpupdate /force on it to get the new policy immediately after moving it, then reboot and make sure you're good. If you are, move the rest. –  MDMarra Dec 5 '12 at 17:08
2  
The Domain Computers group is not part of Authenticated users, and of course it needs to be shared. How else would the computers have access to the script if it isn't shared? A standard place to put this is the sysvol share for the domain. It sounds like you might need to read through some TechNet articles about Group Policy design and implementation before you go any farther. Group Policy is very powerful and you should have a much better understanding of how it works before you go any farther. It's a very dangerous thing if you don't know what you're doing. –  MDMarra Dec 5 '12 at 17:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.