create user account from one domain to another domain

Archived from groups: microsoft.public.windowsnt.domain (More info?)

Hi Guys,

Hope you guys can help me out.

I would like to is there any way we can create a user account from one
domain to another domain. We are running web application (asp). say
for example domain01. From one of our web page we have option to
create a user account in the domain where the application runs through
calling the method.

This is the code we are using.

oContainerName = "Domain01"

'Use passed Administrator or Current Credentials
If bUseAdmin = True Then
Set oDSO = GetObject("WinNT:")
Set oContainer = oDSO.OpenDSObject("WinNT://" & oContainerName,
AdminUserName, AdminPassword, 0)
Else
Set oContainer = GetObject("WinNT://" & oContainerName)
End If

'First test to see if the user name already exists
oContainer.Filter = Array("User") 'Load the class level array
aUsers = Array("User")

'If it exists, return an error condition so that programmer may
prompt user for another name
If UserExists(UserName, DomainName) = True Then
AddUser = False
Else
'Otherwise, add the user
Set oUser = oContainer.Create("User", Trim(UserName))
oUser.SetInfo
If Len(UserPassword) > 0 Then
oUser.SetPassword Trim(UserPassword)
End If

AddUser = True
End If

Now our requirement is the applcation should be able to create a user
account in different domain from the domain where its runing. say for
example Domain02.

Please help me out in this issue.

Thanks
Saran.
1 answer Last reply
More about create user account domain domain
  1. Archived from groups: microsoft.public.windowsnt.domain (More info?)

    Change oContainer value to Domain2 as well as specify correct
    permissions?

    On 28 Oct 2004 16:52:21 -0700, ksaran_an@yahoo.co.in (skali) wrote:

    >Hi Guys,
    >
    >Hope you guys can help me out.
    >
    >I would like to is there any way we can create a user account from one
    >domain to another domain. We are running web application (asp). say
    >for example domain01. From one of our web page we have option to
    >create a user account in the domain where the application runs through
    >calling the method.
    >
    >This is the code we are using.
    >
    >oContainerName = "Domain01"
    >
    > 'Use passed Administrator or Current Credentials
    > If bUseAdmin = True Then
    > Set oDSO = GetObject("WinNT:")
    > Set oContainer = oDSO.OpenDSObject("WinNT://" & oContainerName,
    >AdminUserName, AdminPassword, 0)
    > Else
    > Set oContainer = GetObject("WinNT://" & oContainerName)
    > End If
    >
    > 'First test to see if the user name already exists
    > oContainer.Filter = Array("User") 'Load the class level array
    > aUsers = Array("User")
    >
    > 'If it exists, return an error condition so that programmer may
    >prompt user for another name
    > If UserExists(UserName, DomainName) = True Then
    > AddUser = False
    > Else
    > 'Otherwise, add the user
    > Set oUser = oContainer.Create("User", Trim(UserName))
    > oUser.SetInfo
    > If Len(UserPassword) > 0 Then
    > oUser.SetPassword Trim(UserPassword)
    > End If
    >
    > AddUser = True
    > End If
    >
    >Now our requirement is the applcation should be able to create a user
    >account in different domain from the domain where its runing. say for
    >example Domain02.
    >
    >Please help me out in this issue.
    >
    >Thanks
    >Saran.
Ask a new question

Read More

Domain Microsoft Windows