Script for OpenVPN

Welcome Forums General PowerShell Q&A Script for OpenVPN

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 7 months ago.

  • Author
  • #69030

    Points: 0
    Rank: Member

    Hallo, I am Powershell beginner. I need your valuable help with this. I need to be at the startup of the computer.

    Restarting OpenVPN ->
    Check if it is in the domain ->
    if so, then disconnect OpenVPN. ->
    if not, openvpn connect.

    So far I have this

    $SysInfo = New-Object -ComObject "ADSystemInfo"
    Try {
    $UserDN = $SysInfo.GetType().InvokeMember("ComputerName", "GetProperty", $Null, $SysInfo, $Null)
    Catch {
    "Not connected"

    Its check for domain connecting.

  • #69376

    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    A computer is "in" the domain whether it's talking to a domain controller or not. It might be better to ping a known IP address, like that of an internal DNS server, to see if you're connected to the private network.

The topic ‘Script for OpenVPN’ is closed to new replies.