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

 
Keymaster
2 years ago.

  • Author
    Posts
  • #69030

    Participant
    Topics: 3
    Replies: 3
    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)
    "Connected"
    }
    Catch {
    "Not connected"
    }

    Its check for domain connecting.

  • #69376

    Keymaster
    Topics: 13
    Replies: 4872
    Points: 1,811
    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.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort