Running logon script with elevated permissions

hi folks
there is a logon script in the group policy (user configuration) :

netsh interface ip set dns name="Local Area Connection" static 132.x.x.x
netsh interface ip add dns name="Local Area Connection" addr=132.x.x.x index=2
netsh interface ip add dns name="Local Area Connection" addr=132.x.x.x index=3

it runs on windows 7
it does not work without administrator permissions.

How to run the script with elevated permissions?
nesher13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ben HartCommented:
Are you using Batch, Powershell?

If Batch you could call your file above with another:

runas /user:REQUIREDUSERNAME /savecred c:\SECONDBATCH.BAT

If Posh then it's a bit trickier but this place can def help:

http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/09/23/a-self-elevating-powershell-script.aspx
oBdACommented:
Run this script as a computer startup script applied to the machines in question, not as user logon script.
The startup script runs in the System security context, not as user, and has the required permissions.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
You can push DNS addresses via DHCP, or GPO. No need to elevate anything.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

arnoldCommented:
Using static mappings, suggests this is a server and waiting for a change until the reboot ....

powershell/WMI interaction could ..


You are trying to change both the IP and the name servers?

Static DHCP allocation is possible, but eventlog will be filled with related notices. Some roles do not function well when the system's IP is a DHCP based IP.  Even when you have Static reservation, the IP has to be obtained such that server roles might start when the IP has not been received/set.
nesher13Author Commented:
gheist

Using DHCP server account is not consideration.
how to solve the problem using the group policy?
gheistCommented:
If you are not in control over your network you must ask somebody who is. For network re-numbering you need their help and somebody diagnosing each and every server - if all IIS etc starts up after IP change.
nesher13Author Commented:
oBdA

running the script from  GPO - computer configuration is not working
gheistCommented:
Log in to machine remotely and run the script that changes IP and reboots machine with new ip
nesher13Author Commented:
gheist

I do not want to logon into every computer (300 workstation)
oBdACommented:
Try it with this script, then check the file "C:\Windows\Temp\startup.log".
If the file doesn't exist, you need to troubleshoot group policy, because the script didn't run.
set LogFile=C:\Windows\Temp\startup.log
>"%LogFile%" echo Startup script started: %Date% %Time%
netsh interface ip set dns name="Local Area Connection" static 132.x.x.x >>"%LogFile%" 2>&1
netsh interface ip add dns name="Local Area Connection" addr=132.x.x.x index=2 >>"%LogFile%" 2>&1
netsh interface ip add dns name="Local Area Connection" addr=132.x.x.x index=3 >>"%LogFile%" 2>&1

Open in new window

Alternatively, you can try the policy "DNS Servers" in "Computer Configuration\Policies\Administrative Templates\Network\DNS Client".
gheistCommented:
Then it is about workstations and YOU MUST USE DHCP
arnoldCommented:
Psexec/powershell scripting this is the way to go,
GPO how are you going to distinguish among the workstations to make sure the ip us unique?
Orate you thinking if creating a file per workstation?

Only servers should have static IPs, while workstations use DHCP thus you can change DHCP settings without having to tough each and every workstation.
gheistCommented:
I have whole network with static reservation, that way you can choose which way you like it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.