📜 ⬆️ ⬇️

Experienced trivia windows admin

I always had the desire to write a cycle of posts, where I would gradually explain various interesting trivia and tasks that had to be solved in the daily routine of the system administrator.
Perhaps some of the above will be useful to other sysadmins.

At once I will make a reservation that I have a Windows environment and an Active Directory domain as the source data, with the OS mainly WindowsXP - Server2003. Well, the companies served were mostly small (from 30 to 500 users).

Let's start, perhaps, with the frequently encountered task of determining which of the users for which computer is working.

To solve this problem, various techniques have been tried:

As a result, we " built our lunapark with VBS and users, " and wrote 2 small logon-logo scripts that are run by group policy at the domain level when the user logs in and when they log out, respectively.
')
LOGON-Option

Dim adsinfo, ThisComp, oUser

'
Set adsinfo = CreateObject("adsysteminfo")
Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
Set oUser = GetObject("LDAP://" & adsinfo.UserName)

' AD
' Department ,
Thiscomp.put "Department", "Logged on: " + oUser.cn + " " + CStr(Now)
ThisComp.Setinfo

' Department
oUser.put "Department", "Logged on: " + ThisComp.cn + " " + CStr(Now)
oUser.Setinfo
wscript.quit


LOGOFF-Option

Dim adsinfo, ThisComp, oUser

'
Set adsinfo = CreateObject("adsysteminfo")
Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
Set oUser = GetObject("LDAP://" & adsinfo.UserName)

' AD
' Department ,
Thiscomp.put "Department", "Logged off: " + oUser.cn + " " + CStr(Now)
ThisComp.Setinfo

' Department
oUser.put "Department", "Logged off: " + ThisComp.cn + " " + CStr(Now)
oUser.Setinfo
wscript.quit

The explanations on the code are probably not needed, the script is elementary, I’ll tell you only about the pluses of the script, which in my situation significantly outweighed the minuses (which I will also tell you about).

pros


Minuses


To be continued.

PS Forgot to add. In operation, the system looks like this:

Source: https://habr.com/ru/post/121801/


All Articles