Sam 
Author Message
 Sam

Hi,
Do you know how can we do to extract user informations from the windows NT 4
server's SAM.(Account, comment, appartenence's group, name of his login
script) ?


Mon, 17 Feb 2003 13:53:12 GMT  
 Sam
Use ADSI...

vDomainUser = InputBox("Enter domainname/username",,"domainname/username")

if Trim(vDomainUser) = "" then WScript.quit
if Instr(1,vDomainUser,"/") = 0 then WScript.quit

Set oUser = GetObject("WinNT://" & vDomainUser & ",USER")
oUser.GetInfo

on error resume next

s = s & "Class: " _
      & oUser.Class & vbCrLf
s = s & "Name: " _
      & oUser.Name & vbCrLf
s = s & "FullName: " _
      & oUser.FullName & vbCrLf
s = s & "LastLogin: " _
      & oUser.LastLogin & vbCrLf
s = s & "PasswordExpirationDate: " _
      & oUser.PasswordExpirationDate & vbCrLf
s = s & "IsAccountLocked: " _
      & oUser.IsAccountLocked & vbCrLf
s = s & "==========================" & vbCrLf

for i = 1 to oUser.PropertyCount
 set prop = oUser.Next
 s = s & prop.name & "=" & oUser.Get(prop.name) & vbCRLF
next

msgbox s

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Hi,
> Do you know how can we do to extract user informations from the windows NT
4
> server's SAM.(Account, comment, appartenence's group, name of his login
> script) ?



Tue, 18 Feb 2003 11:42:41 GMT  
 Sam
Great.
Thanks a lot.
Bye :-)


Quote:
> Use ADSI...

> vDomainUser = InputBox("Enter domainname/username",,"domainname/username")

> if Trim(vDomainUser) = "" then WScript.quit
> if Instr(1,vDomainUser,"/") = 0 then WScript.quit

> Set oUser = GetObject("WinNT://" & vDomainUser & ",USER")
> oUser.GetInfo

> on error resume next

> s = s & "Class: " _
>       & oUser.Class & vbCrLf
> s = s & "Name: " _
>       & oUser.Name & vbCrLf
> s = s & "FullName: " _
>       & oUser.FullName & vbCrLf
> s = s & "LastLogin: " _
>       & oUser.LastLogin & vbCrLf
> s = s & "PasswordExpirationDate: " _
>       & oUser.PasswordExpirationDate & vbCrLf
> s = s & "IsAccountLocked: " _
>       & oUser.IsAccountLocked & vbCrLf
> s = s & "==========================" & vbCrLf

> for i = 1 to oUser.PropertyCount
>  set prop = oUser.Next
>  s = s & prop.name & "=" & oUser.Get(prop.name) & vbCRLF
> next

> msgbox s

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --



> > Hi,
> > Do you know how can we do to extract user informations from the windows
NT
> 4
> > server's SAM.(Account, comment, appartenence's group, name of his login
> > script) ?



Wed, 19 Feb 2003 01:38:33 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing SAM Database

2. Sam

3. Can the SAM be exported to a textfile?

4. SAM and Equivalent in W2000

5. Finding Users in NT SAM Request

6. can i access the SAM database from vbscript?

7. Sync the SAM via WSH?

8. ADSI for extract informations from SAM database.

9. transfer useraccounts between SAM's w/ passwords

10. Sam's Teach Yourself Windows Script Host in 21 Days

11. WSH and NT (SAM) user database

12. accessing the NT SAM

 

 
Powered by phpBB® Forum Software