اصدقائي عيد سعيد
انا عندي سؤال محيرني
عايز اعرف مين اليوزرات اللي مشتغلوش على الشبكة من شهرين مثلا هل في امر او طريقة اعرف بيها اليوزرات دولا عشان احذفهم او اشوف وضعهم .
الامر DSquery ممكن ينفعني .
اصدقائي عيد سعيد
انا عندي سؤال محيرني
عايز اعرف مين اليوزرات اللي مشتغلوش على الشبكة من شهرين مثلا هل في امر او طريقة اعرف بيها اليوزرات دولا عشان احذفهم او اشوف وضعهم .
الامر DSquery ممكن ينفعني .
استعمل السكريبت التالي
'get domain and container
Dim sTarget, sOU
sTarget = InputBox("Target what domain?", "Domain?", _
"techmentorevent")
sLDAP = InputBox("LDAP version of domain name?", "LDAP Domain?", _
"dc=techmentorevents,dc=pri")
'iterate through all DCs?
Dim bCheckAll
bCheckAll = MsgBox("Check all DCs for last logon date?", _
4, "Check all DCs?")
If bCheckAll = 6 Then
bCheckAll = True
Else
bCheckAll = False
End If
'objects for output file
Dim sOutput, oFSO, oTS
sOutput = InputBox("Output path and filename?", "Filename?", _
"c:\domainreport.csv")
Set oFSO = CreateObject("Scripting.FileSystemObject")
'see if file exists
If oFSO.FileExists(sOutput) Then
MsgBox("File exists. Please select another.")
WScript.Quit
End If
'create output file
Set oTS = oFSO.CreateTextFile(sOutput)
Const cComma = ","
'output header
oTS.WriteLine "User" & _
cComma & "Disabled" & cComma & "Locked" & _
cComma & "IdleDays"
'get destination container
On Error Resume Next
Set oOU = GetObject("WinNT://" & sTarget)
If Err <> 0 Then
MsgBox "Error: " & vbCrLf & Err.Description
WScript.Quit
End If
On Error Goto 0
'filter for user objects
oOU.Filter = Array("User")
'get the Default Domain Controllers container
Dim oDCs, oDC
Set oDCs = GetObject("LDAP://ou=Domain Controllers," & _
sLDAP)
'go through container objects
Dim oObject
For Each oObject In oOU
'get attributes
Dim bDisabled, bLocked, iIdleDays
Dim dLastLogin, dLocalLastLogin
'reset last login date
dLastLogin = CDate("1/1/1900")
'is user disabled?
If oObject.accountdisabled Then
bDisabled = True
Else
bDisabled = False
End If
'is user locked out?
If oObject.isaccountlocked Then
bLocked = True
Else
bLocked = False
End If
'output basic info
oTS.Write oObject.name & cComma & _
bDisabled & cComma & _
bLocked & cComma
'check for last login?
If bCheckAll Then
'checking last login on all DCs
For Each oDC In oDCs
'get last login from this DC
Dim oLocalUser
Set oLocalUser = GetObject("WinNT://" & _
Replace(oDC.sAMAccountName,"$","") & "/" & _
oObject.name & ",user")
On Error Resume Next
dLocalLastLogin = oLocalUser.LastLogin
If Err <> 0 Then
dLocalLastLogin = CDate("1/1/1900")
End If
On Error Goto 0
'is that more recent?
If dLocalLastLogin > dLastLogin Then
dLastLogin = dLocalLastLogin
End If
Next
'output last login
oTS.Write DateDiff("d",dLastLogin,Date) & vbcrlf
Else
'not checking last login
oTS.Write "n/a" & vbcrlf
End If
Next
'close text file and notify
oTS.Close
MsgBox "Finished. Output is at " & sOutputمع مراعاة انه المرة الاولى ستدخل اسم النتبيوس و المر الثانية سيكون اسم الدومين ال Distinguished
Mahmoud Magdy
MVP - Exchange Server. MCITP (Windows Server 2008, Exhcange Server 2010,/2007),CCNP, MCTS(OCS 2007 R2, SCCM 2007)
Tech Lead
Ingazat Information Technology
Follow me on twitter: http://www.twitter.com/_busbar
my blog: http://autodiscover.wordpress.com
Link with me on linkedin: http://www.linkedin.com/profile?viewProfile=&key=71027694
or on experts-exchange.com: http://www.experts-exchange.com/M_1426100.html
صديقي شكرا
بس مش عارف كيف استخدم السكريبت يعني يكون policy والا يكون باتش .
لا ده و لا ده فقط حطه في ملف بامتداد VBS و شغله
Mahmoud Magdy
MVP - Exchange Server. MCITP (Windows Server 2008, Exhcange Server 2010,/2007),CCNP, MCTS(OCS 2007 R2, SCCM 2007)
Tech Lead
Ingazat Information Technology
Follow me on twitter: http://www.twitter.com/_busbar
my blog: http://autodiscover.wordpress.com
Link with me on linkedin: http://www.linkedin.com/profile?viewProfile=&key=71027694
or on experts-exchange.com: http://www.experts-exchange.com/M_1426100.html
شكرا لك اشتغل
هذا الموضوع مغلق.
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…