Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Adding User account to the local PC

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,29214
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding User account to the local PC
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Adding User account to the local PC - 12/20/2005 1:09:38 PM   
  gotoman

 

Posts: 22
Score: 0
Joined: 12/5/2005
Status: offline
Hi
I am having a problem.
I have the following code to add user to local pc.

<-------------
'On Error Resume Next
' *********** start User Name ****************
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserName = objNetwork.UserName
computername= objNetwork.Computername
'************* End User Name *************
strComputer=computername
strGroup="Administrators"
strDomain="MPDC"
strUser=strUserName
Set objGroupToUpdate = GetObject("WinNT://" & strComputer & "/" & strGroup & ",group")
Set objUserToAdd = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
objGroupToUpdate.Add(objUserToAdd.ADsPath)
-------------->
The thing is as i am a network adminstrator my login works fine.
As a user that is not a network administrator they get a error. 

Error:  "General access denied error".
Code : 80070005
Source Active Directory

Has anyone had this problem.

Thanks
 
 
Post #: 1
 
 RE: Adding User account to the local PC - 12/20/2005 1:35:34 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
Let me see if I read this correctly.  You are a Network Admin and the script you have shown to add a user to a local PC works.  However when an end user trys to run the same script to add a user to the local PC it errors out.  Is this correct?


Cybex

< Message edited by Cybex -- 12/20/2005 1:36:37 PM >


_____________________________

Common sense is not so common.

(in reply to gotoman)
 
 
Post #: 2
 
 RE: Adding User account to the local PC - 12/20/2005 1:40:00 PM   
  gotoman

 

Posts: 22
Score: 0
Joined: 12/5/2005
Status: offline
What i am trying to do is.
We a user logs onto the domain that domain user gets added to the user accounts on the pc.
If they are a new user i seem to get a error.

(in reply to Cybex)
 
 
Post #: 3
 
 RE: Adding User account to the local PC - 12/20/2005 1:43:37 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
Again, are you trying to have an end user create a user account for themselves or another user on that local PC during that users logon?

Cybex

_____________________________

Common sense is not so common.

(in reply to gotoman)
 
 
Post #: 4
 
 RE: Adding User account to the local PC - 12/20/2005 1:49:22 PM   
  gotoman

 

Posts: 22
Score: 0
Joined: 12/5/2005
Status: offline
Is that possible?
I am not to sure!

(in reply to gotoman)
 
 
Post #: 5
 
 RE: Adding User account to the local PC - 12/20/2005 2:12:15 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
That is why I am trying to ask you what you are trying to do...


Cybex

_____________________________

Common sense is not so common.

(in reply to gotoman)
 
 
Post #: 6
 
 RE: Adding User account to the local PC - 12/20/2005 2:34:58 PM   
  gotoman

 

Posts: 22
Score: 0
Joined: 12/5/2005
Status: offline
Thats what i am trying to do. What doesn't work.

(in reply to gotoman)
 
 
Post #: 7
 
 RE: Adding User account to the local PC - 12/20/2005 3:45:58 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
No it is not possible the way you are attempting it.

Why would you need to do this?

Are you the only NA on your network?

Cybex

< Message edited by Cybex -- 12/20/2005 3:47:50 PM >


_____________________________

Common sense is not so common.

(in reply to gotoman)
 
 
Post #: 8
 
 RE: Adding User account to the local PC - 12/20/2005 11:40:25 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
You have to be a member of the admin group to add to the admin group.  Normal users do not have the right to do this.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to Cybex)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding User account to the local PC Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts