outrun17
asked on
active directory computers field not slowing users
I have windows 2003 server and in active directory the computer tab slows me all my computers but not the username that is using that computer.
how can i made the username slow?
how can i made the username slow?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How about is i want to see all the computers list that i have in AD show the computer name and on the right of it want user?
This script will do what you want:
_______
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connec tion")
Set objCommand = CreateObject("ADODB.Comman d")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnectio n = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=fabrikam,DC=com ' " _
& "Where objectClass='computer'"
objCommand.Properties("Sea rchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strcomputer = objRecordSet.Fields("Name" ).Value
Set objWMIService = GetObject("winmgmts:{imper sonationLe vel=impers onate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo strcomputer & vbTab & objComputer.UserName
Next
objRecordSet.MoveNext
Loop
_______
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connec
Set objCommand = CreateObject("ADODB.Comman
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnectio
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=fabrikam,DC=com
& "Where objectClass='computer'"
objCommand.Properties("Sea
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strcomputer = objRecordSet.Fields("Name"
Set objWMIService = GetObject("winmgmts:{imper
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo strcomputer & vbTab & objComputer.UserName
Next
objRecordSet.MoveNext
Loop
ASKER
do I add this script in AD? also with the"."
i need to have it all computers in ad how would i do it/
i need to have it all computers in ad how would i do it/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
smilerz
would i add that in ad?
would i add that in ad?
Name the script LoggedInUsers.vbs and execute it from the command line:
cscript.exe LoggedInUsers.vbs
it will display the computers and logged in users in the command shell.
cscript.exe LoggedInUsers.vbs
it will display the computers and logged in users in the command shell.
ASKER
smilerz
I would like it to show in AD so i don't have to go to each computer and run it. i want so when i log on to the server and click on computers then i see the list of computers with the user name thats using that computer.
I would like it to show in AD so i don't have to go to each computer and run it. i want so when i log on to the server and click on computers then i see the list of computers with the user name thats using that computer.
There isn't any way to do that - the best you can do is run a script to show currently logged in users.
SMS provides a similar view if you use SMS - but ADUC doesn't support this functionality. The currently logged in user is not stored in the directory.
SMS provides a similar view if you use SMS - but ADUC doesn't support this functionality. The currently logged in user is not stored in the directory.
See the last script I linked to. It will put the name of the last user to sign on in the computer's Description field. This will then show up in AD Users and Computers.
ASKER
Shift-3
give me that script again.
give me that script again.
ASKER
Shift-3
and where would i add this script?
and where would i add this script?
ASKER
Shift-3
I just added the script that you gave to me the server; but now sure why its not working. please tell me steps when i need to do when i have the script on my computer.
I now have it on my desktop.
I just added the script that you gave to me the server; but now sure why its not working. please tell me steps when i need to do when i have the script on my computer.
I now have it on my desktop.
ASKER
Shift-3
please tell me step by step on what i need to do and give me the hole script.
Thank you so much for all you help that your giving.
please tell me step by step on what i need to do and give me the hole script.
Thank you so much for all you help that your giving.
You need to run that script as every users login script so that they update their computer description when they log on.
ASKER
I understand that; but would I add it in AD as a group polcy? where would i do that?
ASKER
how would i run the script? when will i do it on each computer or do i add the script in AD and if so how will I do it?
thanks
thanks
You can create a group policy object - there is a logon script parameter that can be set.
ASKER
I think I got it to work with this script. I created a test.vbs but I need to know how will i run it on all the computer in my AD. where do I place the script and where. here is the script.
Set objSysInfo = CreateObject("ADSystemInfo ")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
strMessage = objUser.CN & " logged on to " & objComputer.CN & " " & Now & "."
objUser.Description = strMessage
objUser.SetInfo
objComputer.Description = strMessage
objComputer.SetInfo
Set objSysInfo = CreateObject("ADSystemInfo
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
strMessage = objUser.CN & " logged on to " & objComputer.CN & " " & Now & "."
objUser.Description = strMessage
objUser.SetInfo
objComputer.Description = strMessage
objComputer.SetInfo
ASKER
can you give me step by step, because i can not find it.
ASKER
I added the script in AD in the group policy object - there is a logon script parameter.
Then I login in a workstation after that I looked in the server AD but it did not give me the username by the computer field.
any ideas?
Then I login in a workstation after that I looked in the server AD but it did not give me the username by the computer field.
any ideas?
http://www.microsoft.com/technet/sysinternals/Security/PsLoggedOn.mspx
If nobody is currently logged on, you can use the script from this article to find out who logged on last:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan07/hey0123.mspx