locked
Modify DeleteVPNConnections.ps1 to delete a VPN connection with a specific server address automatically RRS feed

  • General discussion

  • Hi Guys,

    Firstly, thank you for the DeleteVPNConnections.ps1 it does help me out to an extent.

    I'm hoping you can guide me in modifying it to fit my scenario.

    I am assisting a client with around 200 users that make use of VPN, but they have configured it wrong on every client so I am trying to write a powershell script to remove the old connection based on the server address in the table and then add the following connection which I know works properly

    Add-VpnConnection -Name "NewVPNConnectionName" -ServerAddress "server.address.com" -TunnelType Automatic -EncryptionLevel Optional -AuthenticationMethod MSChapv2 -UseWinlogonCredential -SplitTunneling -AllUserConnection -RememberCredential -PassThru -DnsSuffix "company.local"

    I want to push it out via a GPO logon script, so would like there to be no user intervention what so ever. But I can't seem to find a way to delete a VPN connection with a specific server address and ensuring the user doesn't even know it has happened.

    Any and all help is greatly appreciated.

    Thanks

    Shaun

    • Changed type Bill_Stewart Monday, May 7, 2018 10:07 PM
    • Moved by Bill_Stewart Monday, May 7, 2018 10:07 PM This is not "teach me step by step how to use functions from a module" forum
    Wednesday, March 7, 2018 8:26 PM

All replies

  • You may have missed the first post from right at the top of this forum:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 7, 2018 8:59 PM
  • Hey Bill,

    Thanks for pointing that out, I'm not requesting for them to change the script, but rather looking to guide me in the right direction to modify it.

    The last part I can do no problem, was just wondering whether it's possible to delete the VPN by server name and not by actual name and how to go about modifying the script myself to do it.

    I would prefer to learn so that I can do it myself in the future and not have to rely on someone writing it for me.

    Not sure if that is still in contravention of that rule?

    Wednesday, March 7, 2018 9:34 PM
  • If you read the documentation for the script you will see how to get the VPNs which you can filter by server address.

    There is no need to modify anything. The script is set of functions designed to do this.

    Post here for help: https://gallery.technet.microsoft.com/scriptcenter/Delete-specific-VPN-581bcf4d/view/Discussions#content


    \_(ツ)_/

    Wednesday, March 7, 2018 9:44 PM