• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Viele hassen ihn, manche schwören auf ihn, wir aber möchten unbedingt sehen, welche Bilder Ihr vor Eurem geistigen Auge bzw. vor der Linse Eures iPhone oder iPad sehen könnt, wenn Ihr dieses Wort hört oder lest. Macht mit und beteiligt Euch an unserem Frühjahrsputz ---> Klick

Widget und SAP

Zino

Gast
Wie ich sehe wurde hier das Thema SAP nicht angesprochen.
Es beschäftigen sich viele mit dem Thema und das entwickelt sich blitzschnell.
ich kann euch beispiele lierfern wie ich mit hilfe von Widgets auf verschiedene funktionsbausteine zugreife.

mein problem ist was anderes. wie kann ich mit hilfe von vbs die Angemeldeten Benutzer sehn?
ein beispiel ist hier, aber nur von den benutzer die sich das erste mal eingelogt haben:

On Error Resume Next
Const ADS_SCOPE_SUBTREE =
2
dtmCreationDate1 = ""'20070701000000.0Z
dtmCreationDate2 = ""'20080731000000.0Z
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject(
"ADODB.Command")
objConnection.Provider =
"ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
'objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name, whenCreated FROM '
WHERE objectClass='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields(
"Name").Value, objRecordSet.Fields("whenCreated").Value
objRecordSet.MoveNext
Loop
 

Zino

Gast
so, hier ist der code:

Option Explicit
Dim objRootDSE, strConfig, adoConnection, adoCommand, strQuery
Dim adoRecordset, objDC
Dim strDNSDomain, objShell, lngBiasKey, lngBias, k, arrstrDCs()
Dim strDN, dtmDate, objDate, objList, strUser
Dim strBase, strFilter, strAttributes, lngHigh, lngLow
Dim Datum
Datum = date()
'AKTUELLES DATUM!!!
Wscript.Echo "DATUM HEUTE: " & Datum
Wscript.Echo
" "
Wscript.Echo "Es HABEN SICH HEUTE ANGEMELDET:"
Wscript.Echo " I I"
Wscript.Echo " I I"
Wscript.Echo " \ /"
Wscript.Echo " \/"
' Use a dictionary object to track latest lastLogon for each user.
Set objList = CreateObject("Scripting.Dictionary")
objList.CompareMode = vbTextCompare
' Obtain local Time Zone bias from machine registry.
Set objShell = CreateObject("Wscript.Shell")
lngBiasKey = objShell.RegRead(
"HKLM\System\CurrentControlSet\Control\" _
& "TimeZoneInformation\ActiveTimeBias")
If (UCase(TypeName(lngBiasKey)) = "LONG") Then
lngBias = lngBiasKey
ElseIf (UCase(TypeName(lngBiasKey)) =
"VARIANT()") Then
lngBias =
0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) *
256^k)
Next
End
If
' Determine configuration context and DNS domain from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get(
"configurationNamingContext")
strDNSDomain = objRootDSE.Get(
"defaultNamingContext")
' Use ADO to search Active Directory for ObjectClass nTDSDSA.
' This will identify all Domain Controllers.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject(
"ADODB.Connection")
adoConnection.Provider =
"ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strBase =
"<LDAP://" & strConfig & ">"
strFilter = "(objectClass=nTDSDSA)"'-----------------------------------------------
strAttributes = "AdsPath"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties(
"Page Size") = 100
adoCommand.Properties("Timeout") = 5
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
' Enumerate parent objects of class nTDSDSA. Save Domain Controller
' AdsPaths in dynamic array arrstrDCs.
k = 0
Do Until adoRecordset.EOF
Set objDC = _
GetObject(GetObject(adoRecordset.Fields(
"AdsPath").Value).Parent)
ReDim Preserve arrstrDCs(k)
arrstrDCs(k) = objDC.DNSHostName
k = k +
1
adoRecordset.MoveNext
Loop
adoRecordset.Close
' Retrieve lastLogon attribute for each user on each Domain Controller.
For k = 0 To Ubound(arrstrDCs)
strBase =
"<LDAP://" & arrstrDCs(k) & "/" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "Name,lastLogon"
strQuery = strBase & ";" & strFilter & ";" & strAttributes _
& ";subtree
"
adoCommand.CommandText = strQuery
'wscript.Echo strQuery
On Error Resume Next
Set adoRecordset = adoCommand.Execute
'adoRecordset.sort "Name"
If (Err.Number <> 0) Then
On Error GoTo
0
Wscript.Echo "Domain Controller not available: " & arrstrDCs(k)
Else
On Error GoTo
0
Do Until adoRecordset.EOF
strDN = adoRecordset.Fields(
"Name").Value
On Error Resume Next
Set objDate = adoRecordset.Fields(
"lastLogon").Value
If (Err.Number <>
0) Then
On Error GoTo
0
dtmDate = Datum 'äääääää
Else
On Error GoTo
0
lngHigh = objDate.HighPart
lngLow = objDate.LowPart
If (lngLow <
0) Then
lngHigh = lngHigh +
1
End If

If (lngHigh =
0) And (lngLow = 0 ) Then
dtmDate = Datum
'ääää
Else
dtmDate =
#1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow)/
600000000 - lngBias)/1440
End If
End If
If (objList.Exists(strDN) = True) Then
If (dtmDate > objList(strDN)) Then
objList.Item(strDN) = dtmDate
End If
Else
objList.Add strDN, dtmDate
End If
adoRecordset.MoveNext
Loop
adoRecordset.Close
End If
Next
'########################################################################
' Letzter Logon für JEDEN USER!!!.
For Each strUser In objList.Keys
if (StrUser =
"A") then
Wscript.Echo strUser &
" " & objList.Item(strUser)'++++++++++++++++
else
Wscript.Echo strUser &
" " & objList.Item(strUser)
Wscript.Echo
" "
end if

next

' Clean up.
adoConnection.Close
Set
objRootDSE = Nothing
Set
adoConnection = Nothing
Set
adoCommand = Nothing
Set
adoRecordset = Nothing
Set
objDC = Nothing
Set
objDate = Nothing
Set
objList = Nothing
Set
objShell = Nothing




die frage ist, wie sortiere ich die user nach namen????
 

DerPrenzlberger

Rhode Island Greening
Registriert
10.08.07
Beiträge
483
Also die Daten stehen in der Tabelle USR41

MANDT MANDT CLNT 3 0 Mandant
BNAME XUBNAME CHAR 12 0 Benutzername im Benutzerstamm
TERMID XUTERMID INT4 10 0 Terminalid
SERVER XUSERVER CHAR 20 0 Server
TERMINAL XUTERMINAL CHAR 36 0 Terminal
SPRACHE XULANGU LANG 1 0 Sprache
LOGON_DATE XULDATE DATS 8 0 Letzes Login-Datum
LOGON_TIME XULTIME TIMS 6 0 Letzte Login-Uhrzeit

Ist hier ein Eintrag drin ist der Nutzer angemeldet, wen nicht dann nicht.

Also alle User die in dieser Tabelle sind, sind an der in der Tabelle genannten Maschine online.