Update VeragProgAllgemein; Feature: RDP direkt starten;

This commit is contained in:
ms
2022-11-22 10:53:34 +01:00
parent 67f2a10607
commit f717deac50
31 changed files with 900 additions and 315 deletions

View File

@@ -1,4 +1,6 @@
Public Class cExtProgramme
Imports System.IO
Public Class cExtProgramme
Public Shared Function startlink(URL As String)
@@ -24,16 +26,16 @@
End Function
Public Shared Function startputty(IP As String)
Public Shared Function startputty(IP As String, Optional ByVal Port As Integer = 22)
Dim Benutzer, Passwort As String
Class1.GetUserPasswort(IP, Benutzer, Passwort)
Try
Dim putty As New Process
putty.StartInfo.FileName = "putty.exe"
If Benutzer = "" And Passwort = "" Then
putty.StartInfo.Arguments = IP
putty.StartInfo.Arguments = IP & " -P " & Port
Else
putty.StartInfo.Arguments = IP & " -l " & Benutzer & " -pw " & Passwort
putty.StartInfo.Arguments = IP & " -P " & Port & " -l " & Benutzer & " -pw " & Passwort
End If
putty.Start()
@@ -43,6 +45,15 @@
End Try
End Function
Public Shared Function commandcmd(command As String)
Dim cmd As New Process
cmd.StartInfo.FileName = "cmd.exe"
cmd.StartInfo.Arguments = "/c " & command
cmd.Start()
End Function
Public Shared Function pingip(ip As String, Optional ByVal Argument As String = "")
Dim ping As New Process
'ping.StartInfo.FileName = "cmd.exe"
@@ -67,35 +78,58 @@
End Function
Public Shared Function StartTeamviewer(ID As String, Optional Passwort As String = "BmWr501956")
Dim p As String = ""
If Passwort.Length < 1 Then
Passwort = "BmWr501956"
End If
If File.Exists("C:\Program Files (x86)\TeamViewer\Teamviewer.exe") Then
p = "C:\Program Files (x86)\TeamViewer"
Else
p = "C:\Program Files\TeamViewer"
End If
Dim teamviewer As New Process
With teamviewer.StartInfo
.FileName = "Teamviewer.exe"
.WorkingDirectory = "C:\Program Files (x86)\TeamViewer"
.WorkingDirectory = p
.Arguments = "-i " & ID & " -P " & Passwort
End With
teamviewer.Start()
Try
teamviewer.Start()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "")
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "", Optional ByVal Fenster As Boolean = False)
Dim mstsc As New Process
Dim AnmeldeDatenVorhanden As Boolean = False
Dim rdpASadmin As String = ""
Dim FensterString As String = ""
If Fenster = True Then
FensterString = " /w:1280 /h:1024"
Else
FensterString = " /f"
End If
If host = "rdpintern.verag.ag" Then
commandcmd("cmdkey /delete:" & host)
commandcmd("cmdkey /delete:TERMSRV/" & host)
ElseIf host.StartsWith("TS") Then
rdpASadmin = " /admin"
End If
If Username.Length > 0 And Password.Length > 0 Then
Dim Anmeldung As New Process : AnmeldeDatenVorhanden = True
With Anmeldung
.StartInfo.FileName = Environment.ExpandEnvironmentVariables("%SystemRoot%\system32\cmdkey.exe")
.StartInfo.Arguments = "/add:TERMSRV/" & host & " /user:" & Username & " /pass:" & Password
.Start()
End With
AnmeldeDatenVorhanden = True
commandcmd("cmdkey /generic:" & host & " /user:" & Username & " /pass:" & Password)
End If
Threading.Thread.Sleep(1000)
mstsc.StartInfo.FileName = "mstsc.exe"
mstsc.StartInfo.UseShellExecute = False
mstsc.StartInfo.Arguments = " /v: " & host
mstsc.StartInfo.Arguments = " /v: " & host & rdpASadmin & FensterString
mstsc.Start()
@@ -103,11 +137,7 @@
Threading.Thread.Sleep(3000)
Dim Abmeldung As New Process
With Abmeldung
.StartInfo.FileName = Environment.ExpandEnvironmentVariables("%SystemRoot%\system32\cmdkey.exe")
.StartInfo.Arguments = "/delete:TERMSRV/" & host
End With
commandcmd("cmdkey /delete:" & host)
End If