Mit Kommando -c kann das Tool auch auf Clients ausgeführt werden, Benutzername und Kennwort müssen dann eingegeben werden.

This commit is contained in:
ms
2023-01-09 23:03:36 +01:00
parent 0594a02a88
commit ba8202cedb
18 changed files with 796 additions and 110 deletions

97
TSAnmeldung/Anmeldung.Designer.vb generated Normal file
View File

@@ -0,0 +1,97 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Anmeldung
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(34, 55)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
Me.TextBox1.TabIndex = 0
'
'TextBox2
'
Me.TextBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.TextBox2.Location = New System.Drawing.Point(34, 99)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(100, 20)
Me.TextBox2.TabIndex = 1
Me.TextBox2.UseSystemPasswordChar = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(34, 36)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(75, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Benutzername"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(34, 82)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(52, 13)
Me.Label2.TabIndex = 3
Me.Label2.Text = "Kennwort"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(162, 97)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 4
Me.Button1.Text = "Anmelden"
Me.Button1.UseVisualStyleBackColor = True
'
'Anmeldung
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(290, 172)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Anmeldung"
Me.Text = "Anmeldung"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents TextBox1 As TextBox
Friend WithEvents TextBox2 As TextBox
Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label
Friend WithEvents Button1 As Button
End Class

120
TSAnmeldung/Anmeldung.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

94
TSAnmeldung/Anmeldung.vb Normal file
View File

@@ -0,0 +1,94 @@
Imports System.ComponentModel
Public Class Anmeldung
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Anmeldung_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim user As String = TextBox1.Text
Dim password As String = TextBox2.Text
If user.Length > 0 And password.Length > 0 Then
cRes.LocalUser.Name = user
If Not user.Contains("\") Then
user = "VERAGOST\" & user
End If
cRes.LocalUser.BenutzeranmeldeName = user
RDPConnect("rdpintern.verag.ag", "remote.verag.ag", user, password)
Main.Report()
Threading.Thread.Sleep(5000)
Me.Close()
End If
End Sub
Public Shared Function RDPConnect(host As String, Optional ByVal gateway 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
AnmeldeDatenVorhanden = True
commandcmd("cmdkey /generic:" & host & " /user:" & Username & " /pass:" & Password)
If gateway.Length > 0 Then
commandcmd("cmdkey /generic:" & gateway & " /user:" & Username & " /pass:" & Password)
End If
Threading.Thread.Sleep(3000)
End If
mstsc.StartInfo.FileName = "mstsc.exe"
mstsc.StartInfo.UseShellExecute = False
mstsc.StartInfo.Arguments = " /v: " & host & rdpASadmin & FensterString
mstsc.Start()
'If AnmeldeDatenVorhanden = True Then
' Threading.Thread.Sleep(3000)
' Dim Abmeldung As New Process
' commandcmd("cmdkey /delete:" & host)
'End If
End Function
Public Function deleteHostCred(host As String)
commandcmd("cmdkey /delete:" & host)
commandcmd("cmdkey /delete:TERMSRV/" & host)
End Function
Public Shared Function commandcmd(command As String)
Dim cmd As New Process
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
cmd.StartInfo.FileName = "cmd.exe"
cmd.StartInfo.Arguments = "/c " & command
cmd.Start()
End Function
Private Sub Anmeldung_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
deleteHostCred("rdpintern.verag.ag")
deleteHostCred("remote.verag.ag")
End Sub
End Class

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
</configuration> </configuration>

View File

@@ -31,13 +31,14 @@ Partial Class Main
Me.cboxStandort = New System.Windows.Forms.ComboBox() Me.cboxStandort = New System.Windows.Forms.ComboBox()
Me.Timer2 = New System.Windows.Forms.Timer(Me.components) Me.Timer2 = New System.Windows.Forms.Timer(Me.components)
Me.TimerReport = New System.Windows.Forms.Timer(Me.components) Me.TimerReport = New System.Windows.Forms.Timer(Me.components)
Me.TelAnmelden = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout() Me.SuspendLayout()
' '
'btnLogOFF 'btnLogOFF
' '
Me.btnLogOFF.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnLogOFF.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnLogOFF.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnLogOFF.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnLogOFF.Image = Global.TSAnmeldung.My.Resources.Resources.LogOff20
Me.btnLogOFF.ImageAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnLogOFF.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnLogOFF.Location = New System.Drawing.Point(12, 46) Me.btnLogOFF.Location = New System.Drawing.Point(12, 46)
Me.btnLogOFF.Name = "btnLogOFF" Me.btnLogOFF.Name = "btnLogOFF"
@@ -50,13 +51,12 @@ Partial Class Main
' '
Me.btnResetSession.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnResetSession.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnResetSession.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnResetSession.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnResetSession.Image = Global.TSAnmeldung.My.Resources.Resources.Reload20
Me.btnResetSession.ImageAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnResetSession.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnResetSession.Location = New System.Drawing.Point(12, 12) Me.btnResetSession.Location = New System.Drawing.Point(12, 12)
Me.btnResetSession.Name = "btnResetSession" Me.btnResetSession.Name = "btnResetSession"
Me.btnResetSession.Size = New System.Drawing.Size(184, 28) Me.btnResetSession.Size = New System.Drawing.Size(184, 28)
Me.btnResetSession.TabIndex = 29 Me.btnResetSession.TabIndex = 29
Me.btnResetSession.Text = "Sitzung neu starten" Me.btnResetSession.Text = "Sitzung (neu) starten"
Me.btnResetSession.UseVisualStyleBackColor = True Me.btnResetSession.UseVisualStyleBackColor = True
' '
'Timer1 'Timer1
@@ -67,7 +67,6 @@ Partial Class Main
' '
Me.btnShutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnShutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnShutdown.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnShutdown.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnShutdown.Image = Global.TSAnmeldung.My.Resources.Resources.ShutDown20
Me.btnShutdown.ImageAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnShutdown.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnShutdown.Location = New System.Drawing.Point(12, 114) Me.btnShutdown.Location = New System.Drawing.Point(12, 114)
Me.btnShutdown.Name = "btnShutdown" Me.btnShutdown.Name = "btnShutdown"
@@ -91,28 +90,51 @@ Partial Class Main
' '
'TimerReport 'TimerReport
' '
Me.TimerReport.Enabled = True
Me.TimerReport.Interval = 300000 Me.TimerReport.Interval = 300000
' '
'TelAnmelden
'
Me.TelAnmelden.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.TelAnmelden.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TelAnmelden.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.TelAnmelden.Location = New System.Drawing.Point(11, 148)
Me.TelAnmelden.Name = "TelAnmelden"
Me.TelAnmelden.Size = New System.Drawing.Size(184, 28)
Me.TelAnmelden.TabIndex = 34
Me.TelAnmelden.Text = "Telefon neu anmelden"
Me.TelAnmelden.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(13, 183)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 35
Me.Label1.Text = "Label1"
'
'Main 'Main
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.ControlLightLight Me.BackColor = System.Drawing.SystemColors.ControlLightLight
Me.ClientSize = New System.Drawing.Size(208, 156) Me.ClientSize = New System.Drawing.Size(208, 214)
Me.ControlBox = False Me.ControlBox = False
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TelAnmelden)
Me.Controls.Add(Me.cboxStandort) Me.Controls.Add(Me.cboxStandort)
Me.Controls.Add(Me.btnShutdown) Me.Controls.Add(Me.btnShutdown)
Me.Controls.Add(Me.btnResetSession) Me.Controls.Add(Me.btnResetSession)
Me.Controls.Add(Me.btnLogOFF) Me.Controls.Add(Me.btnLogOFF)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximumSize = New System.Drawing.Size(224, 195) Me.MaximumSize = New System.Drawing.Size(224, 300)
Me.MinimizeBox = False Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(224, 195) Me.MinimumSize = New System.Drawing.Size(224, 230)
Me.Name = "Main" Me.Name = "Main"
Me.ShowIcon = False Me.ShowIcon = False
Me.Text = "TSAnmeldung" Me.Text = "TSAnmeldung"
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout()
End Sub End Sub
@@ -123,4 +145,6 @@ Partial Class Main
Friend WithEvents cboxStandort As ComboBox Friend WithEvents cboxStandort As ComboBox
Friend WithEvents Timer2 As Timer Friend WithEvents Timer2 As Timer
Friend WithEvents TimerReport As Timer Friend WithEvents TimerReport As Timer
Friend WithEvents TelAnmelden As Button
Friend WithEvents Label1 As Label
End Class End Class

View File

@@ -126,6 +126,9 @@
<metadata name="TimerReport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="TimerReport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>195, 17</value> <value>195, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>341</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@@ -13,10 +13,13 @@ Public Class Main
Public ConBroker As String Public ConBroker As String
Public ConString As String Public ConString As String
Public ConType As String Public ConType As String
Public MAC As String
Public ClientMode As Boolean
Dim lastupdate As DateTime Dim lastupdate As DateTime
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Text = ""
Me.Text = "TSAnmeldung " & My.Resources.ProgVersion Me.Text = "TSAnmeldung " & My.Resources.ProgVersion
SendEvents() SendEvents()
@@ -42,36 +45,57 @@ Public Class Main
If s = "/d" Or s = "-d" Then If s = "/d" Or s = "-d" Then
autoconnect = False autoconnect = False
autologoff = False autologoff = False
cRes.LocalUser.FillWithLoggedOnUser(False) : Report() : TimerReport.Enabled = True
ElseIf s = "/c" Or s = "-c" Then
autoconnect = False
autologoff = False
ClientMode = True
cboxStandort.Enabled = False
cRes.LocalUser.FillWithLoggedOnUser(False)
Anmeldung.deleteHostCred("rdpintern.verag.ag")
Anmeldung.deleteHostCred("remote.verag.ag")
Else Else
autoconnect = True autoconnect = True
cRes.LocalUser.FillWithLoggedOnUser(False) : Report() : TimerReport.Enabled = True
End If End If
End If End If
i += 1 i += 1
Next Next
If Environment.GetCommandLineArgs.Length = 1 Then
cRes.LocalUser.FillWithLoggedOnUser(False) : Report() : TimerReport.Enabled = True
End If
' MsgBox(autoconnect) ' MsgBox(autoconnect)
Timer1.Enabled = autoconnect Timer1.Enabled = autoconnect
cRes.LocalUser.FillWithLoggedOnUser() 'cRes.LocalUser.FillWithLoggedOnUser(False)
cRes.LocalTeamviewerID = getTeamViewerID() cRes.LocalTeamviewerID = getTeamViewerID()
Report() ' Report()
Dim meh As New cPascom
meh.Anmelden()
End Sub End Sub
Function Report() Public Function Report()
lastupdate = Date.Now lastupdate = Date.Now
Dim ds As New DataSet Dim ds As New DataSet
cSQL.SQL2DS("select * from TbL_ThinClients where Benutzeranmeldename = '" & cRes.LocalUser.BenutzeranmeldeName & " ' ", ds) cSQL.SQL2DS("select * from TbL_ThinClients where Benutzeranmeldename = '" & cRes.LocalUser.BenutzeranmeldeName & " ' ", ds)
If Not ds.Tables(0).Rows.Count = 0 Then If Not ds.Tables(0).Rows.Count = 0 Then
RemoveSitzung() RemoveSitzung()
End If End If
cSQL.InsertSQL("TbL_ThinClients", "(Benutzeranmeldename, Name, TeamviewerID, LastReport, ClientName, SystemUpTime) VALUES ( cSQL.InsertSQL("TbL_ThinClients", "(Benutzeranmeldename, Name, TeamviewerID, LastReport, ClientName, Domain, Company, SystemUpTime) VALUES (
'" & cRes.LocalUser.BenutzeranmeldeName & "', '" & cRes.LocalUser.BenutzeranmeldeName & "',
'" & cRes.LocalUser.Name & "', '" & cRes.LocalUser.Name & "',
'" & cRes.LocalTeamviewerID & "', '" & cRes.LocalTeamviewerID & "',
'" & Date.Now & "', '" & Date.Now & "',
'" & cRes.LocalUser.Hostname & "', '" & cRes.LocalUser.Hostname & "',
'" & cRes.LocalUser.Domäne & "',
'" & cRes.LocalUser.Company & "',
'" & cRes.getuptime(True) & "')") '" & cRes.getuptime(True) & "')")
End Function End Function
@@ -181,7 +205,13 @@ Public Class Main
Private Sub btnResetSession_Click(sender As Object, e As EventArgs) Handles btnResetSession.Click Private Sub btnResetSession_Click(sender As Object, e As EventArgs) Handles btnResetSession.Click
killpro("mstsc") killpro("mstsc")
'rdp("rdpintern.verag.ag", "/noConsentPrompt /multimon /control") 'rdp("rdpintern.verag.ag", "/noConsentPrompt /multimon /control")
If ClientMode = False Then
connect() connect()
Else
Dim frm As New Anmeldung
frm.Show()
Me.WindowState = FormWindowState.Minimized
End If
End Sub End Sub
Private Sub connect() Private Sub connect()
@@ -191,6 +221,7 @@ Public Class Main
If ConType = "rdp" Then If ConType = "rdp" Then
rdp(-1, -1, ReturnTerminalserver()) rdp(-1, -1, ReturnTerminalserver())
Else Else
' MsgBox(ConString)
rdp(ConString, "/multimon") rdp(ConString, "/multimon")
End If End If
Case Else Case Else
@@ -199,7 +230,7 @@ Public Class Main
Else Else
autologoff = False autologoff = False
autoconnect = False autoconnect = False
MsgBox("Verbindung konnte nicht aufgebaut werden (Server ist nicht erreichbar)") MsgBox("Verbindung konnte nicht aufgebaut werden (Server" & ReturnTerminalserver() & " ist nicht erreichbar)")
End If End If
End Select End Select
@@ -257,7 +288,11 @@ Public Class Main
If sAppPath Like "*\bin\Debug" Or Environment.UserName = "miesenbeck" Or Environment.UserName = "Administrator" Or autologoff = False Then If sAppPath Like "*\bin\Debug" Or Environment.UserName = "miesenbeck" Or Environment.UserName = "Administrator" Or autologoff = False Then
Me.ControlBox = True Me.ControlBox = True
Else Else
Try
System.Diagnostics.Process.Start("shutdown", "-l") System.Diagnostics.Process.Start("shutdown", "-l")
Catch
End Try
End If End If
End Sub End Sub
@@ -279,19 +314,22 @@ Public Class Main
Public Function LoadParameters(ByVal Benutzername As String, ByRef _ConType As String, ByRef _ConString As String) Public Function LoadParameters(ByVal Benutzername As String, ByRef _ConType As String, ByRef _ConString As String)
Try Try
Dim lines = IO.File.ReadAllLines(sAppPath & "\TSAnmeldung.ini") Dim lines = IO.File.ReadAllLines("\\dc01.verag.ost.dmn\NETLOGON\TSAnmeldung.ini")
Dim colCount = lines.First.Split(";"c).Length Dim colCount = lines.First.Split(";"c).Length
For Each line In lines For Each line In lines
Dim objFields = From field In line.Split(";"c) Dim objFields = From field In line.Split(";"c)
Select Case objFields(0).ToString 'Select Case objFields(0).ToString
Case Benutzername ' Case Benutzername
If String.Compare(Benutzername, objFields(0).ToString, True) = 0 Then
_ConType = objFields(1).ToString _ConType = objFields(1).ToString
_ConString = objFields(2).ToString _ConString = objFields(2).ToString
Return True Return True
Exit Function Exit Function
End Select End If
' End Select
Next Next
Return False Return False
Catch ex As Exception Catch ex As Exception
@@ -304,14 +342,34 @@ Public Class Main
Report() Report()
End Sub End Sub
Private Sub TelAnmelden_Click(sender As Object, e As EventArgs) Handles TelAnmelden.Click
Dim meh As New cPascom
meh.Anmelden()
'If meh.Anmelden() = True Then
' Label1.Text = "Telefon (neu) verbunden"
'Else
' Label1.Text = "Telefon nicht ermittelbar"
'End If
End Sub
Function getTeamViewerID() Function getTeamViewerID()
Dim Reg As String = Nothing Dim Reg As String = Nothing
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) Is Nothing Then If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) Is Nothing Then
If My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing) Is Nothing Then
Reg = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer", "ClientID", Nothing)
Else
Reg = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing) Reg = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing)
End If
Else Else
Reg = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) Reg = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing)
End If End If
Label1.Text = "TV ID: " & Reg
Label1.Visible = True
Return Reg Return Reg
End Function End Function
End Class End Class

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@@ -14,10 +14,10 @@ Option Explicit On
Namespace My Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes, 'HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
' or if you encounter build errors in this file, go to the Project Designer ' oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
' (go to Project Properties or double-click the My Project node in ' (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
' Solution Explorer), and make changes on the Application tab. ' Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
' '
Partial Friend Class MyApplication Partial Friend Class MyApplication

View File

@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MyApplicationData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MySubMain>true</MySubMain> <MySubMain>true</MySubMain>
<MainForm>Form1</MainForm> <MainForm>Main</MainForm>
<SingleInstance>false</SingleInstance> <SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode> <ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles> <EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode> <AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit> <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData> </MyApplicationData>

View File

@@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary> '''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary> '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
@@ -60,6 +60,16 @@ Namespace My.Resources
End Set End Set
End Property End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>
Public ReadOnly Property Hakerl20() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("Hakerl20", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary> '''</summary>
@@ -71,7 +81,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die 1.0.1.7 ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die 1.1.0.0 ähnelt.
'''</summary> '''</summary>
Public ReadOnly Property ProgVersion() As String Public ReadOnly Property ProgVersion() As String
Get Get

View File

@@ -117,17 +117,20 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="LogOff20" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LogOff20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProgVersion" xml:space="preserve"> <data name="ProgVersion" xml:space="preserve">
<value>1.0.1.7</value> <value>1.1.0.0</value>
</data> </data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Reload20" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Reload20" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Reload20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Reload20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ShutDown20" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ShutDown20" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ShutDown20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ShutDown20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="LogOff20" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LogOff20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Hakerl20" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\..\..\..\Pictures\Programmbilder\Hakerl20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@@ -15,21 +15,21 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality" #Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then If My.Application.SaveMySettingsOnExit Then
My.Settings.Save() My.Settings.Save()
End If End If

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC-Manifestoptionen
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
Knoten "requestedExecutionLevel" wie folgt.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
für die Anwendung erforderlich ist.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel, eine Aktivierung
ist nicht erforderlich. Für Windows Forms-Anwendungen für .NET Framework 4.6, die diese Einstellung aktivieren, muss
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der Datei "app.config" auf TRUE festgelegt werden.
Hierdurch können für die Anwendung lange Pfade verwendet werden. Weitere Informationen finden Sie unter https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation.-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@@ -11,9 +11,11 @@
<AssemblyName>TSAnmeldung</AssemblyName> <AssemblyName>TSAnmeldung</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType> <MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@@ -26,7 +28,6 @@
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
@@ -39,6 +40,7 @@
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>TSAnmeldung.xml</DocumentationFile> <DocumentationFile>TSAnmeldung.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -49,6 +51,7 @@
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DocumentationFile>TSAnmeldung.xml</DocumentationFile> <DocumentationFile>TSAnmeldung.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OptionExplicit>On</OptionExplicit> <OptionExplicit>On</OptionExplicit>
@@ -65,8 +68,18 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Admin.ico</ApplicationIcon> <ApplicationIcon>Admin.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="ChilkatDotNet47, Version=9.5.0.88, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Verag\ChilkatDotNet47.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Deployment" /> <Reference Include="System.Deployment" />
<Reference Include="System.DirectoryServices" /> <Reference Include="System.DirectoryServices" />
@@ -94,20 +107,29 @@
<Import Include="System.Threading.Tasks" /> <Import Include="System.Threading.Tasks" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="cBenutzer.vb" /> <Compile Include="Anmeldung.Designer.vb">
<Compile Include="cRes.vb" /> <DependentUpon>Anmeldung.vb</DependentUpon>
<Compile Include="cSQL.vb" /> </Compile>
<Compile Include="Form1.vb"> <Compile Include="Anmeldung.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.vb"> <Compile Include="cBenutzer.vb" />
<DependentUpon>Form1.vb</DependentUpon> <Compile Include="cChilkat_Helper.vb" />
<Compile Include="cPascom.vb" />
<Compile Include="cRes.vb" />
<Compile Include="cSQL.vb" />
<Compile Include="Main.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.vb">
<DependentUpon>Main.vb</DependentUpon>
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb"> <Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon> <DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile> </Compile>
<Compile Include="My Project\Resources.Designer.vb"> <Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
@@ -121,8 +143,11 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="Anmeldung.resx">
<DependentUpon>Form1.vb</DependentUpon> <DependentUpon>Anmeldung.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx"> <EmbeddedResource Include="My Project\Resources.resx">
<Generator>PublicVbMyResourcesResXFileCodeGenerator</Generator> <Generator>PublicVbMyResourcesResXFileCodeGenerator</Generator>
@@ -132,6 +157,7 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="My Project\app.manifest" />
<None Include="My Project\Application.myapp"> <None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator> <Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput> <LastGenOutput>Application.Designer.vb</LastGenOutput>
@@ -170,5 +196,8 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project> </Project>

View File

@@ -17,11 +17,12 @@ Public Class cBenutzer
Property suchname As String = "" Property suchname As String = ""
Property Hostname As String = "" Property Hostname As String = ""
Property SystemUpTime As String = "" Property SystemUpTime As String = ""
Property Company As String = ""
Function FillWithLoggedOnUser(Optional ByVal dcabfrage As Boolean = False, Optional ByVal LDAPa As String = "") '"LDAP://DC=VERAG,DC=OST,DC=DMN") Function FillWithLoggedOnUser(Optional ByVal dcabfrage As Boolean = True, Optional ByVal LDAPa As String = "") '"LDAP://DC=VERAG,DC=OST,DC=DMN")
Try Try
userPrincipalName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName userPrincipalName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName
Name = System.DirectoryServices.AccountManagement.UserPrincipal.Current.Name Name = System.DirectoryServices.AccountManagement.UserPrincipal.Current.Name
@@ -120,6 +121,7 @@ Public Class cBenutzer
.PropertiesToLoad.Add("distinguishedName") .PropertiesToLoad.Add("distinguishedName")
.PropertiesToLoad.Add("msDS-PrincipalName") .PropertiesToLoad.Add("msDS-PrincipalName")
.PropertiesToLoad.Add("userPrincipalName") .PropertiesToLoad.Add("userPrincipalName")
.PropertiesToLoad.Add("company")
End With End With
Dim Result As DirectoryServices.SearchResult = searcher.FindOne Dim Result As DirectoryServices.SearchResult = searcher.FindOne
@@ -134,11 +136,13 @@ Public Class cBenutzer
Me.BenutzeranmeldeName = blablabla(Result, "msDS-PrincipalName") Me.BenutzeranmeldeName = blablabla(Result, "msDS-PrincipalName")
Me.msDSPrincipalName = blablabla(Result, "msDS-PrincipalName") Me.msDSPrincipalName = blablabla(Result, "msDS-PrincipalName")
Me.userPrincipalName = blablabla(Result, "userPrincipalName") Me.userPrincipalName = blablabla(Result, "userPrincipalName")
Me.Company = blablabla(Result, "company")
Catch ex As Exception Catch ex As Exception
MsgBox("FillFromDC: " & ex.Message) MsgBox("FillFromDC: " & ex.Message)
End Try End Try
'MsgBox(Me.Company)
End Function End Function
Function isDokuAdmin() As Boolean Function isDokuAdmin() As Boolean

View File

@@ -0,0 +1,28 @@
Imports Chilkat
Public Class cChilkat_Helper
'Declare Function meh Lib "ChilkatDotNet47.dll" () As Integer
Public Shared Sub UnlockCilkat()
Dim glob As Chilkat.[Global] = New Chilkat.[Global]()
Dim success As Boolean = glob.UnlockBundle("VERAGS.CB1122022_JJ6kgS2zoR0g")
If success <> True Then
Debug.WriteLine(glob.LastErrorText)
Return
End If
Dim status As Integer = glob.UnlockStatus
If status = 2 Then
Debug.WriteLine("Unlocked using purchased unlock code.")
Else
Debug.WriteLine("Unlocked in trial mode.")
End If
Debug.WriteLine(glob.LastErrorText)
End Sub
End Class

133
TSAnmeldung/cPascom.vb Normal file
View File

@@ -0,0 +1,133 @@
Imports System.Reflection
Imports System.IO
Imports Chilkat
Public Class cPascom
' Declare Function meh Lib "ChilkatDotNet47.dll" () As Integer
Dim API_USER_AUTHORIZATION = "bW9ieTpnWlhTSVprTnhmaUQxOEU="
Dim Arbeitsplatz As String = ""
Public Function Anmelden() As Boolean
If GetTelArbeitsplatz4Host() Then
Try
'Benutzername: moby
'Passwort: XgDsFmMSutaMLA1
'BASIC Auth String: bW9ieTpYZ0RzRm1NU3V0YU1MQTE =
cChilkat_Helper.UnlockCilkat()
Dim API_STRING = "pbx3.flashnet.at"
Dim rest As New Chilkat.Rest
Dim success As Boolean
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
If (success <> True) Then
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
Return False
End If
rest.AddHeader("Content-Type", "application/json")
rest.SetAuthBasic("moby", "XgDsFmMSutaMLA1")
Dim json As New Chilkat.JsonObject
Dim successJsonLoad As Boolean = json.Load("
{""action"":""relocate"",""username"":""" & Environment.UserName & """}}")
If (successJsonLoad <> True) Then
MsgBox(json.LastErrorText)
Return False
End If
Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
' MsgBox(sbRequestBody.ToString)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST", "/verag/services/location/" & Arbeitsplatz, sbRequestBody, sbResponseBody)
If (success <> True) Then
Debug.WriteLine(rest.LastErrorText)
Return False
End If
Dim respStatusCode As Integer = rest.ResponseStatusCode
If (respStatusCode <> 200) Then
' MsgBox(sbResponseBody.GetAsString())
Return False
End If
Dim jsonResp = New Chilkat.JsonObject()
jsonResp.LoadSb(sbResponseBody)
Dim Logfile As String = "C:\Verag\ErrorLog.txt"
'File.AppendAllText(Logfile, String.Format(rest.ResponseStatusCode & " " & sbRequestBody.ToString))
Using writer As New StreamWriter(Logfile, True)
writer.WriteLine(rest.ResponseStatusCode & " " & Arbeitsplatz & " " & DateTime.Now.ToString & " " & sbRequestBody.ToString)
End Using
Dim gatewayId = jsonResp.StringOf("gatewayId")
Dim Resp_error = jsonResp.StringOf("error")
Dim Resp_errorCode = jsonResp.StringOf("errorCode")
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
Return True
Else
Return False
End If
End Function
Public Function GetTelArbeitsplatz4Host() As Boolean
Try
Dim lines = IO.File.ReadAllLines("\\dc01.verag.ost.dmn\NETLOGON\Telefonarbeitsplaetze.ini")
Dim colCount = lines.First.Split(";"c).Length
For Each line In lines
Dim objFields = From field In line.Split(";"c)
If String.Compare(cRes.LocalUser.Hostname, objFields(0).ToString, True) = 0 Then
Arbeitsplatz = objFields(1).ToString
'_ConString = objFields(2).ToString
Return True
Exit Function
End If
' End Select
Next
Return False
Catch ex As Exception
' MsgBox("Fehler beim Lesen TSAnmeldung.ini: " & vbCrLf & ex.Message)
End Try
End Function
End Class

View File

@@ -7,7 +7,6 @@ Public Class cRes
Public Shared LocalUser As New cBenutzer Public Shared LocalUser As New cBenutzer
Public Shared LocalTeamviewerID As String Public Shared LocalTeamviewerID As String
'Public Shared DBConString As String = "Server=buchhaltung.verag.ost.dmn\SQLEXPRESS;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared DBConString As String = "Server=sqlcluster.verag.ost.dmn\verag;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" Public Shared DBConString As String = "Server=sqlcluster.verag.ost.dmn\verag;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
@@ -45,7 +44,7 @@ Public Class cRes
'Dim oStartInfo As New ProcessStartInfo("cmd.exe", "/c ping 192.168.0.190 -n 1 > C:\temp.txt") 'Dim oStartInfo As New ProcessStartInfo("cmd.exe", "/c ping 192.168.0.190 -n 1 > C:\temp.txt")
oStartInfo.Domain = "veragost" oStartInfo.Domain = "veragost"
oStartInfo.UserName = "administrator" oStartInfo.UserName = "administrator"
oStartInfo.PasswordInClearText = "BmWr501956" ' oStartInfo.PasswordInClearText = "BmWr501956"
oStartInfo.CreateNoWindow = True oStartInfo.CreateNoWindow = True
oStartInfo.UseShellExecute = False oStartInfo.UseShellExecute = False
oStartInfo.RedirectStandardOutput = True oStartInfo.RedirectStandardOutput = True
@@ -90,7 +89,7 @@ Public Class cRes
msginfo.CreateNoWindow = True msginfo.CreateNoWindow = True
msginfo.Domain = "veragost" msginfo.Domain = "veragost"
msginfo.UserName = "miesenbeck" msginfo.UserName = "miesenbeck"
msginfo.PasswordInClearText = "verag#3" ' msginfo.PasswordInClearText = "verag#3"
msginfo.UseShellExecute = False msginfo.UseShellExecute = False
msgsend.StartInfo = msginfo msgsend.StartInfo = msginfo
msgsend.Start() msgsend.Start()
@@ -100,7 +99,7 @@ Public Class cRes
Dim pc As PerformanceCounter = New PerformanceCounter("System", "System Up Time") Dim pc As PerformanceCounter = New PerformanceCounter("System", "System Up Time")
pc.NextValue() ' This returns zero for a reason I don't know pc.NextValue() ' This returns zero for a reason I don't know
Try
' This call to NextValue gets the correct value ' This call to NextValue gets the correct value
Dim ts As TimeSpan = TimeSpan.FromSeconds(pc.NextValue()) Dim ts As TimeSpan = TimeSpan.FromSeconds(pc.NextValue())
If Shorty = True Then If Shorty = True Then
@@ -109,6 +108,10 @@ Public Class cRes
Exit Function Exit Function
End If End If
Return ts.ToString() Return ts.ToString()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function End Function
Public Shared Function encode(ByVal str As String) As String Public Shared Function encode(ByVal str As String) As String
@@ -148,4 +151,6 @@ Public Class cRes
Next Next
End Function End Function
End Class End Class