Register this Connection's Address in DNS - VPN RRS feed

  • General discussion

  • This is tickbox under VPN Connection/Settings/Properties/IPV4/Advanced. I need to setup script to tick this so that the IPV4 address of the VPN address is correctly registered in DNS

    From articles I am trying this

    $VPN=get-wmiobject -class Win32_NetworkAdapterConfiguration -filter "Servicename = 'RasAgileVPN'"

    $VPN | %{$_SetDynamicDNSRegistration($true,$true)}

    But not working - can anyone advise?

    Ian Burnell, London (UK)

    • Changed type Bill_Stewart Wednesday, December 12, 2018 10:26 PM
    • Moved by Bill_Stewart Wednesday, December 12, 2018 10:26 PM Can't help with incomplete/missing information
    Wednesday, September 12, 2018 12:15 PM

All replies

  • The syntax you posted is not correct.

    When you say that something didn't work, you have to say how it didn't work.

    Please copy and paste the exact command and exact and complete error you are getting. (Remember: We cannot see your screen. No screen shots please. Please copy and paste the text.)

    -- Bill Stewart [Bill_Stewart]

    Wednesday, September 12, 2018 1:59 PM
  • All I am trying to do is to get that tick box enabled via a script so that our Helpdesk don't have to set it manually

    I think you have to be connected to the VPN for the connection to show and script has to run under user's account. I've tried thing thing like Get-VPNConnection | Set-DNSClient but also haven't been able to get the box ticked

    Ian Burnell, London (UK)

    Thursday, September 13, 2018 6:48 AM
  • I refer the honorable gentleman to my first reply posted less than 24 hours ago.

    -- Bill Stewart [Bill_Stewart]

    Thursday, September 13, 2018 2:36 PM
  • This should do it..

    wmic path Win32_NetworkAdapterConfiguration where Servicename='RasAgileVPN' call SetDynamicDNSRegistration DomainDNSRegistrationEnabled=TRUE FullDNSRegistrationEnabled=TRUE

    Thursday, September 13, 2018 5:39 PM
  • Thanks I-MANjuel. Tried that comes back with Return Value 84 which apparently means IP not enabled on adapter

    The difficulty is that it's a RAS/VPN entry

    @Bill_Stewart - I have a simple script that has this

    Set-DnsClient -InterfaceAlias $Profile -RegisterThisConnectionsAddress:$true -Verbose

    It appears to work fine BUT only when connected to the VPN. If I then do Get-DNSCLient is shows the connection with RegisterThis Connectionsaddress True BUT if you edit the adapeter in Windows that box is still not ticked

    I tried following this thread https://social.technet.microsoft.com/Forums/lync/en-US/b2310cef-a7c4-407a-a60a-a9bbe77b7e76/quotregister-this-connections-addresses-in-dnsquot-lt-can-this-be-set-with-powershell?forum=winserverpowershell

    From this I tried

    $VPN = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object ServiceName -eq RasAgileVpn

    But it comes back with Method invocation failed - does not contain a method named SetDynamicDNSRegistration

    If I type VPN | fl * to get all the properties I can see Properties for DomainDNSRegistrationEnabled and FullDNSRegistrationEnabled. I tried setting these to True as in $vpn.FullDNSRegistrationEnabled($true) but again I get does not contain method FullDNSRegistrationEnabled back

    Ian Burnell, London (UK)

    Sunday, September 16, 2018 7:59 AM
  • In that case you should check the eventlog for an event that tells you that "you are connected to your VPN".

    Then attach that event to your script as a scheduled task ..

    In that case the script will run as soon as you are connected to your vpn.

    Monday, September 17, 2018 8:46 PM