Powershell and WMI setting DNS

rated by 0 users
This post has 2 Replies | 1 Follower

Top 500 Contributor
Posts 6
Snoobie Posted: 05-11-2012 1:07 AM

Hi Richard,

First off i want to say that your book is awesome and is so well laid out and easy(er for WMI) to understand. 

Could i also pick your brains in an issue i am having with some end users.  All end users are on dhcp.  However, when they are connecting from home on VPN, when they try to access a sharepoint site they get alot of issues.  One way we have worked around this is to change their nic settings to static and manually configure the dns settings to 8.8.8.8.  This then navigates around the connection issue to our sharepoint sites. 

I have come across your DNS settings (Technique 86) but as you said that is for a static address.  Our users are not local admins so they are unable to change this while out of the office.  Is there a way i can change their nic to static so i can configure their dns to 8.8.8.8?

Your help is greatly appreciated.

Steve

Top 10 Contributor
Posts 296
Microsoft MVP
Top Contributor

Thank you very much for the feed back on the book.  I like your comment about easy(er) - and agree completely. WMI is very powerful but needs some light shining on to it which I've tried to do

One possibilty would be to leave the NIC set on DHCP and use the Alternative Configuration tab to set a static address & DNS info for when they connect over VPN. I have used this in the past and it works. Off the top of my head I don't know how to set it in a script - time for some investigations Big Smile.  Alternatively, you could link a DHCP server to your VPN to give addresses and DNS info

The Win32_NetworkAdapterConfiguration class has an EnableStatic method that will chnage the NIC to static - you need to set the address and DNS settings etc. If the users aren't local admins you could try doing it remotely but you'll hit the problems discussed in technique 102 on pages 347-348. Alternatively, you could run a scheduled job to perform the change and let it run with admin credentials.

You would need to change the NIC back to DHCP when the users disconnected from the VPN.

Hope this helps. Please feel free to come back if I can help further

 

 

Top 500 Contributor
Posts 6

Thanks Richard, much appreciated.

Look forward to more releases from you Big Smile

Page 1 of 1 (3 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.