SystemUpTimeReport, ... kleinigkeiten
This commit is contained in:
@@ -66,12 +66,13 @@ Public Class Main
|
||||
If Not ds.Tables(0).Rows.Count = 0 Then
|
||||
RemoveSitzung()
|
||||
End If
|
||||
cSQL.InsertSQL("TbL_ThinClients", "(Benutzeranmeldename, Name, TeamviewerID, LastReport, ClientName) VALUES (
|
||||
cSQL.InsertSQL("TbL_ThinClients", "(Benutzeranmeldename, Name, TeamviewerID, LastReport, ClientName, SystemUpTime) VALUES (
|
||||
'" & cRes.LocalUser.BenutzeranmeldeName & "',
|
||||
'" & cRes.LocalUser.Name & "',
|
||||
'" & cRes.LocalTeamviewerID & "',
|
||||
'" & Date.Now & "',
|
||||
'" & cRes.LocalUser.Hostname & "')")
|
||||
'" & cRes.LocalUser.Hostname & "',
|
||||
'" & cRes.getuptime(True) & "')")
|
||||
End Function
|
||||
|
||||
Sub RemoveSitzung()
|
||||
@@ -80,20 +81,43 @@ Public Class Main
|
||||
|
||||
Public Sub WoBinIch()
|
||||
|
||||
If Environment.UserDomainName = "VERAGOST" Then
|
||||
'MsgBox(Environment.UserDomainName)
|
||||
|
||||
Select Case Environment.UserDomainName
|
||||
Case "VERAGOST"
|
||||
cboxStandort.SelectedItem = "VERAG SUB (rdpintern.verag.ag)"
|
||||
LDAP = "LDAP://DC=VERAG,DC=OST,DC=DMN"
|
||||
autoconnect = True
|
||||
autologoff = True
|
||||
ElseIf Environment.UserDomainName = "VERAG-SBG" Then
|
||||
Case "VERAG-SBG"
|
||||
cboxStandort.SelectedItem = "VERAG SBG (terminalsbg.verag.ag)"
|
||||
LDAP = "LDAP://DC=VERAG-SBG,DC=LOCAL"
|
||||
autoconnect = True
|
||||
autologoff = True
|
||||
Else
|
||||
Case "IMEX"
|
||||
cboxStandort.SelectedItem = "VERAG SUB (rdpintern.verag.ag)"
|
||||
LDAP = "LDAP://DC=IMEX,DC=LOCAL"
|
||||
autoconnect = True
|
||||
autologoff = True
|
||||
Case Else
|
||||
autoconnect = False
|
||||
autologoff = False
|
||||
End If
|
||||
End Select
|
||||
|
||||
'If Environment.UserDomainName = "VERAGOST" Then
|
||||
' cboxStandort.SelectedItem = "VERAG SUB (rdpintern.verag.ag)"
|
||||
' LDAP = "LDAP://DC=VERAG,DC=OST,DC=DMN"
|
||||
' autoconnect = True
|
||||
' autologoff = True
|
||||
'ElseIf Environment.UserDomainName = "VERAG-SBG" Then
|
||||
' cboxStandort.SelectedItem = "VERAG SBG (terminalsbg.verag.ag)"
|
||||
' LDAP = "LDAP://DC=VERAG-SBG,DC=LOCAL"
|
||||
' autoconnect = True
|
||||
' autologoff = True
|
||||
'Else
|
||||
' autoconnect = False
|
||||
' autologoff = False
|
||||
'End If
|
||||
|
||||
If sAppPath Like "*\bin\Debug" Or Environment.UserName = "miesenbeck" Or Environment.UserName = "Administrator" Or autologoff = False Then
|
||||
autoconnect = False
|
||||
|
||||
2
TSAnmeldung/My Project/Resources.Designer.vb
generated
2
TSAnmeldung/My Project/Resources.Designer.vb
generated
@@ -71,7 +71,7 @@ Namespace My.Resources
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Zeichenfolge, die 1.0.1.2 ähnelt.
|
||||
''' Sucht eine lokalisierte Zeichenfolge, die 1.0.1.7 ähnelt.
|
||||
'''</summary>
|
||||
Public ReadOnly Property ProgVersion() As String
|
||||
Get
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
<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">
|
||||
<value>1.0.1.2</value>
|
||||
<value>1.0.1.7</value>
|
||||
</data>
|
||||
<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>
|
||||
|
||||
@@ -16,7 +16,7 @@ Public Class cBenutzer
|
||||
Property localdistinguishedName As String = ""
|
||||
Property suchname As String = ""
|
||||
Property Hostname As String = ""
|
||||
|
||||
Property SystemUpTime As String = ""
|
||||
|
||||
|
||||
|
||||
@@ -26,17 +26,41 @@ Public Class cBenutzer
|
||||
userPrincipalName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName
|
||||
Name = System.DirectoryServices.AccountManagement.UserPrincipal.Current.Name
|
||||
Hostname = Environment.MachineName
|
||||
SystemUpTime = GetSystemUpTimeInfo()
|
||||
' MsgBox(SystemUpTime)
|
||||
Catch
|
||||
End Try
|
||||
Domäne = System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain.ToString
|
||||
BenutzeranmeldeName = Environment.UserDomainName & "\" & Environment.UserName
|
||||
|
||||
If dcabfrage = True Then
|
||||
'cRes.DebugText = userPrincipalName & LDAPa
|
||||
'Class1.DebugText = userPrincipalName & LDAPa
|
||||
FillFromDC(userPrincipalName, "userPrincipalName", LDAPa)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Shared Function GetSystemUpTimeInfo() As String
|
||||
Try
|
||||
Dim time = GetSystemUpTime()
|
||||
Dim upTime = String.Format("{0:D2}d-{1:D2}h:{2:D2}m", time.Days, time.Hours, time.Minutes) ':{2:D2}s:{3:D3}ms , time.Seconds, time.Milliseconds
|
||||
Return String.Format("{0}", upTime)
|
||||
Catch ex As Exception
|
||||
'handle the exception your way
|
||||
Return String.Empty
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Shared Function GetSystemUpTime() As TimeSpan
|
||||
Try
|
||||
Dim uptime = New PerformanceCounter("System", "System Up Time")
|
||||
uptime.NextValue
|
||||
Return TimeSpan.FromSeconds(uptime.NextValue)
|
||||
Catch ex As Exception
|
||||
'handle the exception your way
|
||||
Return New TimeSpan(0, 0, 0, 0)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Function FillFromDC(ByVal searchname As String, Optional ByVal searchfilter As String = "distinguishedName", Optional ByVal LDAP As String = "LDAP://DC=VERAG,DC=OST,DC=DMN")
|
||||
Try
|
||||
localdistinguishedName = searchname
|
||||
|
||||
@@ -7,7 +7,8 @@ Public Class cRes
|
||||
Public Shared LocalUser As New cBenutzer
|
||||
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=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 DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
|
||||
Public Shared Function GetUserGroupMembership(ByVal locUsername As String, ByVal LDAP As String) As List(Of String)
|
||||
@@ -95,13 +96,18 @@ Public Class cRes
|
||||
msgsend.Start()
|
||||
End Function
|
||||
|
||||
Public Shared Function getuptime()
|
||||
Public Shared Function getuptime(Optional ByVal Shorty As Boolean = False)
|
||||
Dim pc As PerformanceCounter = New PerformanceCounter("System", "System Up Time")
|
||||
|
||||
pc.NextValue() ' This returns zero for a reason I don't know
|
||||
|
||||
' This call to NextValue gets the correct value
|
||||
Dim ts As TimeSpan = TimeSpan.FromSeconds(pc.NextValue())
|
||||
If Shorty = True Then
|
||||
Dim upTime = String.Format("{0:D2}d-{1:D2}h:{2:D2}m", ts.Days, ts.Hours, ts.Minutes)
|
||||
Return upTime
|
||||
Exit Function
|
||||
End If
|
||||
Return ts.ToString()
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user