Anydesk eingebaut

This commit is contained in:
ms
2024-11-04 11:39:14 +01:00
parent 409e0de0e0
commit 48bf324eff
5 changed files with 105 additions and 10 deletions

View File

@@ -2,6 +2,9 @@
Imports System.Management.Automation
Imports System.Management.Automation.Runspaces
Imports System.Security
Imports System.Diagnostics
Imports System.Text
Imports System.Web
Public Class cExtProgramme
@@ -20,7 +23,7 @@ Public Class cExtProgramme
ElseIf URL = "" Then
Exit Function
Else
Dim mstsc As New Process
Dim mstsc As New Process
mstsc.StartInfo.FileName = "mstsc.exe"
mstsc.StartInfo.Arguments = " /v: " & URL
mstsc.Start()
@@ -143,6 +146,83 @@ Public Class cExtProgramme
End Try
End Function
Public Shared Function RunAnyDeskWithPassword(id As String, Optional password As String = "BmWr501956@4975!") As String
Dim output As New StringBuilder()
Dim err As New StringBuilder()
Try
Dim processInfo As New ProcessStartInfo("cmd.exe")
processInfo.RedirectStandardInput = True
processInfo.RedirectStandardOutput = True
processInfo.RedirectStandardError = True
processInfo.UseShellExecute = False
processInfo.CreateNoWindow = True
Using process As Process = Process.Start(processInfo)
Dim command As String = $"echo {password} | ""{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)}\AnyDesk\AnyDesk-ad_d4025ddb.exe"" {id} --with-password"
process.StandardInput.WriteLine(command)
process.StandardInput.Close()
' output.Append(process.StandardOutput.ReadToEnd())
'err.Append(process.StandardError.ReadToEnd())
'process.WaitForExit()
End Using
If err.Length > 0 Then
Console.WriteLine("Fehler: " & err.ToString())
End If
Return output.ToString()
Catch ex As Exception
Console.WriteLine("Fehler bei der Ausführung: " & ex.Message)
Return String.Empty
End Try
End Function
Public Shared Function PipeStringToProgram(programPath As String, input As String) As String
Dim output As New StringBuilder()
Dim err As New StringBuilder()
Try
Dim startInfo As New ProcessStartInfo()
startInfo.FileName = programPath
startInfo.UseShellExecute = False
startInfo.RedirectStandardInput = True
startInfo.RedirectStandardOutput = True
startInfo.RedirectStandardError = True
startInfo.CreateNoWindow = False
Using process As New Process()
process.StartInfo = startInfo
process.Start()
' Write the input string to the standard input of the process
Using writer As StreamWriter = process.StandardInput
writer.WriteLine(input)
End Using
' Read the output and error streams
output.Append(process.StandardOutput.ReadToEnd())
err.Append(process.StandardError.ReadToEnd())
process.WaitForExit()
End Using
If err.Length > 0 Then
Console.WriteLine("Error: " & err.ToString())
End If
Return output.ToString()
Catch ex As Exception
Console.WriteLine("Error executing program: " & ex.Message)
Return ex.Message
End Try
End Function
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "", Optional ByVal Fenster As Boolean = False, Optional ByVal admin As Boolean = False)
Dim mstsc As New Process
Dim AnmeldeDatenVorhanden As Boolean = False

View File

@@ -309,7 +309,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.94 ähnelt.
''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.95 ähnelt.
'''</summary>
Friend ReadOnly Property Version() As String
Get

View File

@@ -149,7 +149,7 @@
<value>..\Resources\external-content.duckduckgo.com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>0.0.1.94</value>
<value>0.0.1.95</value>
</data>
<data name="mstsc1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mstsc1.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@@ -30,6 +30,7 @@ Partial Class uscntr_TSSitzungen
Me.NachrichtSendenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.UpdateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ProfildatenÖffnenExplorerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.TeamVIDKopierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Panel1 = New System.Windows.Forms.Panel()
Me.lblAnzahl = New System.Windows.Forms.Label()
@@ -43,7 +44,7 @@ Partial Class uscntr_TSSitzungen
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.timDisUpdateTimer = New System.Windows.Forms.Timer(Me.components)
Me.TeamVIDKopierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.VerbindenMitAnydeskToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
CType(Me.dgvTSSitzungen, System.ComponentModel.ISupportInitialize).BeginInit()
Me.ContextMenuStrip1.SuspendLayout()
Me.Panel1.SuspendLayout()
@@ -77,9 +78,9 @@ Partial Class uscntr_TSSitzungen
'
'ContextMenuStrip1
'
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.VerbindenMitTeamVToolStripMenuItem, Me.NachrichtSendenToolStripMenuItem, Me.UpdateToolStripMenuItem, Me.ProfildatenÖffnenExplorerToolStripMenuItem, Me.TeamVIDKopierenToolStripMenuItem})
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.VerbindenMitTeamVToolStripMenuItem, Me.VerbindenMitAnydeskToolStripMenuItem, Me.NachrichtSendenToolStripMenuItem, Me.UpdateToolStripMenuItem, Me.ProfildatenÖffnenExplorerToolStripMenuItem, Me.TeamVIDKopierenToolStripMenuItem})
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(225, 136)
Me.ContextMenuStrip1.Size = New System.Drawing.Size(225, 158)
'
'VerbindenMitTeamVToolStripMenuItem
'
@@ -105,6 +106,12 @@ Partial Class uscntr_TSSitzungen
Me.ProfildatenÖffnenExplorerToolStripMenuItem.Size = New System.Drawing.Size(224, 22)
Me.ProfildatenÖffnenExplorerToolStripMenuItem.Text = "Profildaten öffnen (Explorer)"
'
'TeamVIDKopierenToolStripMenuItem
'
Me.TeamVIDKopierenToolStripMenuItem.Name = "TeamVIDKopierenToolStripMenuItem"
Me.TeamVIDKopierenToolStripMenuItem.Size = New System.Drawing.Size(224, 22)
Me.TeamVIDKopierenToolStripMenuItem.Text = "TeamV. ID kopieren"
'
'Timer1
'
Me.Timer1.Interval = 10000
@@ -259,11 +266,11 @@ Partial Class uscntr_TSSitzungen
'
Me.timDisUpdateTimer.Interval = 60000
'
'TeamVIDKopierenToolStripMenuItem
'VerbindenMitAnydeskToolStripMenuItem
'
Me.TeamVIDKopierenToolStripMenuItem.Name = "TeamVIDKopierenToolStripMenuItem"
Me.TeamVIDKopierenToolStripMenuItem.Size = New System.Drawing.Size(224, 22)
Me.TeamVIDKopierenToolStripMenuItem.Text = "TeamV. ID kopieren"
Me.VerbindenMitAnydeskToolStripMenuItem.Name = "VerbindenMitAnydeskToolStripMenuItem"
Me.VerbindenMitAnydeskToolStripMenuItem.Size = New System.Drawing.Size(224, 22)
Me.VerbindenMitAnydeskToolStripMenuItem.Text = "Verbinden mit Anydesk"
'
'uscntr_TSSitzungen
'
@@ -307,4 +314,5 @@ Partial Class uscntr_TSSitzungen
Public WithEvents btnReset As Button
Friend WithEvents timDisUpdateTimer As Timer
Friend WithEvents TeamVIDKopierenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents VerbindenMitAnydeskToolStripMenuItem As ToolStripMenuItem
End Class

View File

@@ -248,4 +248,11 @@
Private Sub TeamVIDKopierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TeamVIDKopierenToolStripMenuItem.Click
Clipboard.SetText(Class1.DBNull2emptyString(dgvTSSitzungen.CurrentRow.Cells("TeamviewerID").Value))
End Sub
Private Sub VerbindenMitAnydeskToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles VerbindenMitAnydeskToolStripMenuItem.Click
Dim Name As String = Class1.DBNull2emptyString(dgvTSSitzungen.CurrentRow.Cells("BenutzerAnmeldeName").Value)
Name = Name.Substring(Name.LastIndexOf("\") + 1)
Dim sitzung As String = Class1.DBNull2emptyString(dgvTSSitzungen.CurrentRow.Cells("TSServer").Value) & "\" & Name
cExtProgramme.RunAnyDeskWithPassword(sitzung)
End Sub
End Class