Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links



VBscript to extract userlogon to Workstations

Active Directory


Reply
 
Thread Tools Search this Thread
  #1  
Old 09-12-2008
Ezakial
 
Posts: n/a
VBscript to extract userlogon to Workstations

Hi,
I'm looking for VBScript script which should be able to extract information
of
1) SAMaccount
2) Firtname and Lastname
3) Logon - Workstation/Desktop/Server hostname

If the script can output in CSV format would be excellent.
Thanks





Reply With Quote
  #2  
Old 09-12-2008
Augusto Alvarez
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Try using dsquery and dsget:

dsquery group -name <groupname> |dsget group -members|dsget
user -samid -ln -fn

Not sure what you meant about Logon

Cheers

--
augusto alvarez | it pro | southworks
MCP - MCTS - MCITP DBA
http://blogs.southworks.net/aalvarez


"Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
> Hi,
> I'm looking for VBScript script which should be able to extract
> information
> of
> 1) SAMaccount
> 2) Firtname and Lastname
> 3) Logon - Workstation/Desktop/Server hostname
>
> If the script can output in CSV format would be excellent.
> Thanks
>
>
>
>
>


Reply With Quote
  #3  
Old 09-12-2008
Florian Frommherz [MVP]
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Howdie!

Ezakial wrote:
> Hi,
> I'm looking for VBScript script which should be able to extract information
> of
> 1) SAMaccount
> 2) Firtname and Lastname
> 3) Logon - Workstation/Desktop/Server hostname
>
> If the script can output in CSV format would be excellent.


The logon part could be a little difficult as AD doesn't store the last
machine the user logged on. Out of the box, you can either use dsquery
as Augusto said, that would give you both sAMAccountName and
First/Lastname (both from AD - you'd need either of them to query the
other) OR you can get sAMAccountname and machine the user is working on
(both from the local machine - in a logon script maybe - not interaction
with AD directory so first/lastname wouldn't be there in the first place).

The hybrid of the two would be a script that runs on user logon and
queries AD for the first/last name and then processes the information.
Not sure how much effort you're willing to put in there. I could also
imagine somethin fancy like WMI here.

cheers,

Florian
--
Microsoft MVP - Group Policy
eMail: prename [at] frickelsoft [dot] net.
blog: http://www.frickelsoft.net/blog.
Maillist (german): http://frickelsoft.net/cms/index.php?page=mailingliste
Reply With Quote
  #4  
Old 09-12-2008
Jorge de Almeida Pinto [MVP - DS]
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

get ADFIND from joeware.net Very powerfull LDAP query tool. Its brother,
ADMOD is a very powerful LDAP modification tool

ADFIND -default -f "(&(objectCategory=person)(objectClass=user))" givenName
sn sAMAccountName

if the users are in an OU it is better to scope that OU instead of querying
the complete AD domain
ADFIND -b "<DN of your OU>" -f
"(&(objectCategory=person)(objectClass=user))" givenName sn sAMAccountName

--

Cheers,
(HOPEFULLY THIS INFORMATION HELPS YOU!)

# Jorge de Almeida Pinto # MVP Identity & Access - Directory Services #

BLOG (WEB-BASED)--> http://blogs.dirteam.com/blogs/jorge/default.aspx
BLOG (RSS-FEEDS)--> http://blogs.dirteam.com/blogs/jorge/rss.aspx
------------------------------------------------------------------------------------------
* How to ask a question --> http://support.microsoft.com/?id=555375
------------------------------------------------------------------------------------------
* This posting is provided "AS IS" with no warranties and confers no rights!
* Always test ANY suggestion in a test environment before implementing!
------------------------------------------------------------------------------------------
#################################################
#################################################
------------------------------------------------------------------------------------------

"Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
> Hi,
> I'm looking for VBScript script which should be able to extract
> information
> of
> 1) SAMaccount
> 2) Firtname and Lastname
> 3) Logon - Workstation/Desktop/Server hostname
>
> If the script can output in CSV format would be excellent.
> Thanks
>
>
>
>
>

Reply With Quote
  #5  
Old 09-12-2008
Paul Bergson
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

I have a script on my website that might do the trick for you. It will list
out multiple user account attributes.

http://www.pbbergs.com/windows/downloads.htm
Select User Account Attributes

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.


"Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
> Hi,
> I'm looking for VBScript script which should be able to extract
> information
> of
> 1) SAMaccount
> 2) Firtname and Lastname
> 3) Logon - Workstation/Desktop/Server hostname
>
> If the script can output in CSV format would be excellent.
> Thanks
>
>
>
>
>


Reply With Quote
  #6  
Old 10-12-2008
Ezakial
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Thank you everyone for your view and suggestion. Infact i have already used
DSQUERY, LDAP query to extract AD related information. The main purpose of
posting the question is to extract userlogon computer name which is
challenge. If anybody has some script which can extract these samaccount and
logon computername will be very helpful. I need this information for my
computer object migration using ADMT 3.0

"Paul Bergson" wrote:

> I have a script on my website that might do the trick for you. It will list
> out multiple user account attributes.
>
> http://www.pbbergs.com/windows/downloads.htm
> Select User Account Attributes
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
>
> http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup This
> posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
> news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
> > Hi,
> > I'm looking for VBScript script which should be able to extract
> > information
> > of
> > 1) SAMaccount
> > 2) Firtname and Lastname
> > 3) Logon - Workstation/Desktop/Server hostname
> >
> > If the script can output in CSV format would be excellent.
> > Thanks
> >
> >
> >
> >
> >

>

Reply With Quote
  #7  
Old 10-12-2008
Ezakial
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Thank you everyone for your view and suggestion. Infact i have already used
DSQUERY, LDAP query to extract AD related information. The main purpose of
posting the question is to extract userlogon computer name which is
challenge. If anybody has some script which can extract these samaccount and
logon computername will be very helpful. I need this information for my
computer object migration using ADMT 3.0

"Florian Frommherz [MVP]" wrote:

> Howdie!
>
> Ezakial wrote:
> > Hi,
> > I'm looking for VBScript script which should be able to extract information
> > of
> > 1) SAMaccount
> > 2) Firtname and Lastname
> > 3) Logon - Workstation/Desktop/Server hostname
> >
> > If the script can output in CSV format would be excellent.

>
> The logon part could be a little difficult as AD doesn't store the last
> machine the user logged on. Out of the box, you can either use dsquery
> as Augusto said, that would give you both sAMAccountName and
> First/Lastname (both from AD - you'd need either of them to query the
> other) OR you can get sAMAccountname and machine the user is working on
> (both from the local machine - in a logon script maybe - not interaction
> with AD directory so first/lastname wouldn't be there in the first place).
>
> The hybrid of the two would be a script that runs on user logon and
> queries AD for the first/last name and then processes the information.
> Not sure how much effort you're willing to put in there. I could also
> imagine somethin fancy like WMI here.
>
> cheers,
>
> Florian
> --
> Microsoft MVP - Group Policy
> eMail: prename [at] frickelsoft [dot] net.
> blog: http://www.frickelsoft.net/blog.
> Maillist (german): http://frickelsoft.net/cms/index.php?page=mailingliste
>

Reply With Quote
  #8  
Old 10-12-2008
Florian Frommherz [MVP]
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Howdie!

Ezakial wrote:
> Thank you everyone for your view and suggestion. Infact i have already used
> DSQUERY, LDAP query to extract AD related information. The main purpose of
> posting the question is to extract userlogon computer name which is
> challenge. If anybody has some script which can extract these samaccount and
> logon computername will be very helpful. I need this information for my
> computer object migration using ADMT 3.0


The name of the machine is saved in the %COMPUTERNAME% environmental
varible - you can use it in your scrips. If you mean to query for the
logon server, %LOGONSERVER% is your way to go. Note that logonserver has
some gotchas like cached credentials.

cheers,

Florian
--
Microsoft MVP - Group Policy
eMail: prename [at] frickelsoft [dot] net.
blog: http://www.frickelsoft.net/blog.
Maillist (german): http://frickelsoft.net/cms/index.php?page=mailingliste
Reply With Quote
  #9  
Old 10-12-2008
Paul Bergson
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Checkout oldcomp on joeware.net or just extract via adfind on joeware.net as
well.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.


"Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
news:097DDDB4-E586-48A4-98A5-6D1016375F01@microsoft.com...
> Thank you everyone for your view and suggestion. Infact i have already
> used
> DSQUERY, LDAP query to extract AD related information. The main purpose of
> posting the question is to extract userlogon computer name which is
> challenge. If anybody has some script which can extract these samaccount
> and
> logon computername will be very helpful. I need this information for my
> computer object migration using ADMT 3.0
>
> "Paul Bergson" wrote:
>
>> I have a script on my website that might do the trick for you. It will
>> list
>> out multiple user account attributes.
>>
>> http://www.pbbergs.com/windows/downloads.htm
>> Select User Account Attributes
>>
>> --
>> Paul Bergson
>> MVP - Directory Services
>> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
>> 2008, 2003, 2000 (Early Achiever), NT4
>>
>> http://www.pbbergs.com
>>
>> Please no e-mails, any questions should be posted in the NewsGroup This
>> posting is provided "AS IS" with no warranties, and confers no rights.
>>
>>
>> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
>> news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
>> > Hi,
>> > I'm looking for VBScript script which should be able to extract
>> > information
>> > of
>> > 1) SAMaccount
>> > 2) Firtname and Lastname
>> > 3) Logon - Workstation/Desktop/Server hostname
>> >
>> > If the script can output in CSV format would be excellent.
>> > Thanks
>> >
>> >
>> >
>> >
>> >

>>


Reply With Quote
  #10  
Old 12-12-2008
Ezakial
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

Hi Paul,

I did try with oldcmp but it does not give me teh details of user logon to
which computer... :( and adfind also does not give the expected output...

"Paul Bergson" wrote:

> Checkout oldcomp on joeware.net or just extract via adfind on joeware.net as
> well.
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
>
> http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup This
> posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
> news:097DDDB4-E586-48A4-98A5-6D1016375F01@microsoft.com...
> > Thank you everyone for your view and suggestion. Infact i have already
> > used
> > DSQUERY, LDAP query to extract AD related information. The main purpose of
> > posting the question is to extract userlogon computer name which is
> > challenge. If anybody has some script which can extract these samaccount
> > and
> > logon computername will be very helpful. I need this information for my
> > computer object migration using ADMT 3.0
> >
> > "Paul Bergson" wrote:
> >
> >> I have a script on my website that might do the trick for you. It will
> >> list
> >> out multiple user account attributes.
> >>
> >> http://www.pbbergs.com/windows/downloads.htm
> >> Select User Account Attributes
> >>
> >> --
> >> Paul Bergson
> >> MVP - Directory Services
> >> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> >> 2008, 2003, 2000 (Early Achiever), NT4
> >>
> >> http://www.pbbergs.com
> >>
> >> Please no e-mails, any questions should be posted in the NewsGroup This
> >> posting is provided "AS IS" with no warranties, and confers no rights.
> >>
> >>
> >> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
> >> news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
> >> > Hi,
> >> > I'm looking for VBScript script which should be able to extract
> >> > information
> >> > of
> >> > 1) SAMaccount
> >> > 2) Firtname and Lastname
> >> > 3) Logon - Workstation/Desktop/Server hostname
> >> >
> >> > If the script can output in CSV format would be excellent.
> >> > Thanks
> >> >
> >> >
> >> >
> >> >
> >> >
> >>

>

Reply With Quote
  #11  
Old 12-12-2008
Jorge de Almeida Pinto [MVP - DS]
 
Posts: n/a
Re: VBscript to extract userlogon to Workstations

the "which computers" information you need is NOT stored in AD. It is stored
in the security event log of EACH DC. So you need a tool to query each
security event log of each DC or you need to get a tool that collects all
info (or partial) that you need to a central location and then query that

--

Cheers,
(HOPEFULLY THIS INFORMATION HELPS YOU!)

# Jorge de Almeida Pinto # MVP Identity & Access - Directory Services #

BLOG (WEB-BASED)--> http://blogs.dirteam.com/blogs/jorge/default.aspx
BLOG (RSS-FEEDS)--> http://blogs.dirteam.com/blogs/jorge/rss.aspx
------------------------------------------------------------------------------------------
* This posting is provided "AS IS" with no warranties and confers no rights!
* Always test ANY suggestion in a test environment before implementing!
------------------------------------------------------------------------------------------
#################################################
#################################################
------------------------------------------------------------------------------------------

"Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
news:CC9BE92B-ED3B-4801-A672-7F83C41FADCA@microsoft.com...
> Hi Paul,
>
> I did try with oldcmp but it does not give me teh details of user logon to
> which computer... :( and adfind also does not give the expected output...
>
> "Paul Bergson" wrote:
>
>> Checkout oldcomp on joeware.net or just extract via adfind on joeware.net
>> as
>> well.
>>
>> --
>> Paul Bergson
>> MVP - Directory Services
>> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
>> 2008, 2003, 2000 (Early Achiever), NT4
>>
>> http://www.pbbergs.com
>>
>> Please no e-mails, any questions should be posted in the NewsGroup This
>> posting is provided "AS IS" with no warranties, and confers no rights.
>>
>>
>> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
>> news:097DDDB4-E586-48A4-98A5-6D1016375F01@microsoft.com...
>> > Thank you everyone for your view and suggestion. Infact i have already
>> > used
>> > DSQUERY, LDAP query to extract AD related information. The main purpose
>> > of
>> > posting the question is to extract userlogon computer name which is
>> > challenge. If anybody has some script which can extract these
>> > samaccount
>> > and
>> > logon computername will be very helpful. I need this information for my
>> > computer object migration using ADMT 3.0
>> >
>> > "Paul Bergson" wrote:
>> >
>> >> I have a script on my website that might do the trick for you. It
>> >> will
>> >> list
>> >> out multiple user account attributes.
>> >>
>> >> http://www.pbbergs.com/windows/downloads.htm
>> >> Select User Account Attributes
>> >>
>> >> --
>> >> Paul Bergson
>> >> MVP - Directory Services
>> >> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
>> >> 2008, 2003, 2000 (Early Achiever), NT4
>> >>
>> >> http://www.pbbergs.com
>> >>
>> >> Please no e-mails, any questions should be posted in the NewsGroup
>> >> This
>> >> posting is provided "AS IS" with no warranties, and confers no rights.
>> >>
>> >>
>> >> "Ezakial" <Ezakial@discussions.microsoft.com> wrote in message
>> >> news:79386280-C433-42EE-B3DA-8B5DE5850132@microsoft.com...
>> >> > Hi,
>> >> > I'm looking for VBScript script which should be able to extract
>> >> > information
>> >> > of
>> >> > 1) SAMaccount
>> >> > 2) Firtname and Lastname
>> >> > 3) Logon - Workstation/Desktop/Server hostname
>> >> >
>> >> > If the script can output in CSV format would be excellent.
>> >> > Thanks
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>

>>

Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "VBscript to extract userlogon to Workstations"
Thread Thread Starter Forum Replies Last Post
Workstations not pulling all updates cholmes Server Update Service 3 19-03-2011 12:30 AM
Cannot connect to workstations using RWW SBS 2008 JimmyS Small Business Server 8 08-07-2009 10:41 PM
Delegate ad workstations to domain skip Active Directory 5 17-04-2009 04:31 PM
Move Workstations around OU's via script. net1994 Active Directory 2 18-03-2009 06:54 PM
VBScript to uninstall older versions of Java on Vista Workstations ShawnTMaloney@gmail.com Vista Help 0 08-04-2008 04:48 AM


All times are GMT +5.5. The time now is 09:30 PM.