Gmail Calendar Documents Web Reader more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Creating local user account remotely
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jarxale  
View profile  
 More options Nov 14 2009, 5:00 am
Newsgroups: microsoft.public.scripting.vbscript
From: Jarxale <Jarx...@discussions.microsoft.com>
Date: Fri, 13 Nov 2009 21:00:01 -0800
Local: Sat, Nov 14 2009 5:00 am
Subject: RE: Creating local user account remotely
SOLVED: I removed the On Error statement, got this error msg ' A member could
not be added to or removed from the local group because the member does not
exist '.

Found this article, http://kb.parallels.com/en/3939.

Realised I made a silly mistake, I have been using the IP address of the
server for the computer name, switched it back to hostname and everything
works.

FYI LikeToCode the alternative statement you suggested for the adding to
group works fine too.

Thanks again to both of you. :D

"LikeToCode" wrote:
> Hi Jarxale,
> I have found that the computer name must be exactly the computer name not
> "mycomputer.domain.com" or "." Allof your code looks fine and I agree you
> should remove the "On Error" statement. Also try the following statement in
> place of the one you have now.

> Set oGroup = GetObject("WinNT://" & sComputerName & "/Administrators,group")

> "Jarxale" wrote:

> > Hi all

> > I am working on a way to remotely create a local user account on one W2k3
> > server from W2k3 another server on a non-AD environment. For example, from
> > server A, I will create a new account onto Server B remotely.

> > Found this script from google but has an issue with it.

> > '--------------------8<----------------------
> > ' name of user to be created
> > sNewUser = "dummy"

> > ' name of the group the user is to be added to
> > sGroupname = "Administrators"

> > ' get computer name
> > Set oWshNet = CreateObject("WScript.Network" )
> > sComputerName = "ServerB"

> > ' connect to the Winnt provider
> > Set oComputer = GetObject("WinNT://" & sComputerName)

> > ' create the user
> > Set oUser = oComputer.Create("user", sNewUser)

> > oUser.SetPassword "qwerty@1"

> > On Error Resume Next
> > ' save the user
> > oUser.Setinfo

> > ' If user exists already or password restrictions
> > ' are not fulfilled, we get an error
> > If Err.Number = 0 Then

> > ' configure the user
> > On Error Goto 0

> > ' Enable "User Must Change Password at Next Logon"
> > oUser.Put "PasswordExpired", 1

> > oUser.Fullname = "Mr Dummy"
> > oUser.Description = "Dummy Sys Admin"
> > oUser.Setinfo
> > End If
> > On Error Goto 0

> > ' Add the user to the group
> > Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)

> > ' Use error handling in case he is a member already
> > On Error Resume Next
> > oGroup.Add(oUser.ADsPath)
> > On Error Goto 0
> > '--------------------8<----------------------

> > After execution, the new account is created with all the details as
> > specified in the script except for the Group section, which turns up empty.
> > Both servers are using the same credentials for login. Any help is
> > appreciated.

> > Regards :)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google