fork(2) download
  1. Imports DotRas
  2.  
  3. Module MainModule
  4.  
  5. Sub Main()
  6. If Not My.Application.CommandLineArgs.Count = 3 Then
  7. ShowUsage()
  8. Else
  9. Dim VpnName As String = My.Application.CommandLineArgs(0)
  10. Dim Destination As String = My.Application.CommandLineArgs(1)
  11. Dim PresharedKey As String = My.Application.CommandLineArgs(2)
  12.  
  13. Try
  14. Dim PhoneBook As New RasPhoneBook
  15. PhoneBook.Open()
  16. Dim VpnEntry As RasEntry = RasEntry.CreateVpnEntry(VpnName, Destination, DotRas.RasVpnStrategy.L2tpOnly, _
  17. DotRas.RasDevice.Create(VpnName, DotRas.RasDeviceType.Vpn))
  18. VpnEntry.Options.UsePreSharedKey = True
  19. VpnEntry.Options.UseLogOnCredentials = True
  20. PhoneBook.Entries.Add(VpnEntry)
  21. VpnEntry.UpdateCredentials(RasPreSharedKey.Client, PresharedKey)
  22. Console.WriteLine("VPN connection created successfully")
  23. Catch ex As Exception
  24. Console.WriteLine("ERROR: " & ex.Message & vbNewLine)
  25. Environment.Exit(999)
  26. End Try
  27. End If
  28. End Sub
  29.  
  30. Private Sub ShowUsage()
  31. Console.WriteLine("Invalid number of arguments specified." & vbNewLine & vbNewLine & _
  32. "Usage: VpnSetup.exe [VPN Name] [Destination] [Preshared Key]" & vbNewLine & vbNewLine & _
  33. "EXAMPLE: VpnSetup.exe ""New VPN"" vpn.mycompany.com SomePassword" & vbNewLine)
  34. End Sub
  35.  
  36. End Module
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
10
42
11
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/rrWqpJ/prog.vb (2,1) : Warning VBNC40056: The import 'DotRas' could not be found.
/home/rrWqpJ/prog.vb (14,50) : Error VBNC30451: Could not resolve the name 'RasPhoneBook'
/home/rrWqpJ/prog.vb (16,41) : Error VBNC30451: Could not resolve the name 'RasEntry'
There were 2 errors and 1 warnings.
Compilation took 00:00:00.7060770
stdout
Standard output is empty