Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Change Local Admin Password and Add a Domain Group as Local Administrator

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Change Local Admin Password and Add a Domain Group as Local Administrator
  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 >>
 Change Local Admin Password and Add a Domain Group as L... - 8/30/2007 3:52:44 AM   
  jeferson.propheta

 

Posts: 10
Score: 0
Joined: 8/27/2007
Status: offline
'**************************************************************************************************************
'*   Change Local Pass and Add Group as Local Admin                                                                                                                                      *
'*   -------------------------------------                                                                                                                                                                    *
'*   Written by: Jeferson Propheta                                                                                                                                                                    *
'*   July / 2007                                                                                                                                                                                                   *
'**************************************************************************************************************

On Error Resume Next

strComputer = "."
Set objShell       = CreateObject("WScript.Shell")
strLocalLanguage   = objShell.ExpandEnvironmentStrings("%ProgramFiles%")

If inStr(strLocalLanguage, "Program") Then
Set objGroup      = GetObject("WinNT://" & strComputer & "/Administrators")
Set objLocaladmin = GetObject("WinNT://" & strComputer & "/Administrator")

Else
Set objGroup      = GetObject("WinNT://" & strComputer & "/Administradores")
Set objLocaladmin = GetObject("WinNT://" & strComputer & "/Administrador")
End If

Set objUser       = GetObject("WinNT://DOMAIN_NAME/DESKTOPAdmins.Group")

  objGroup.Add(objUser.ADsPath)
  objLocaladmin.SetPassword("PUT_PASS_HERE")

Set objGroup      = Nothing
Set objUser       = Nothing
Set objLocaladmin = Nothing
Wscript.Quit



      

< Message edited by jeferson.propheta -- 8/30/2007 4:12:08 AM >


_____________________________

Wscript.Echo("Just4 Fun")
 
 
Revisions: 1 | Post #: 1
 
 RE: Change Local Admin Password and Add a Domain Group ... - 9/6/2007 10:10:40 PM   
  jasminnakar

 

Posts: 4
Score: 0
Joined: 9/6/2007
Status: offline
Amazing Post!!!

really appreciate your efforts for posting such usefull post.
i am new to VB i used the script and seek your help
if user dont have admin rights then this script dont work. can we program the script in such a way that if the user even if dont have admin rights this script will work?
or can we input the Admin credentials into the script itself

thanks a ton in advance

(in reply to jeferson.propheta)
 
 
Post #: 2
 
 RE: Change Local Admin Password and Add a Domain Group ... - 9/10/2007 12:19:15 AM   
  jeferson.propheta

 

Posts: 10
Score: 0
Joined: 8/27/2007
Status: offline
Hello Jasminnakar

Is not a good Idea to expose Admins Username/Password in your scripts. so, you some ways like:

Use LSrunase.exe - http://www.moernaut.com

LSrunase can be used to run a command using another user account and passing the encrypted password as a parameter

or

Look for WSF script, and you can dispatch the script remotely(from your computer as a Sample).  There are many ways to elevate credentials to run this kind of script, But remember, is important to keep in mind that is not a good ideia to put passwords in your scripts.
Hope it help you

_____________________________

Wscript.Echo("Just4 Fun")

(in reply to jasminnakar)
 
 
Post #: 3
 
 RE: Change Local Admin Password and Add a Domain Group ... - 12/3/2007 8:57:19 AM   
  rager_mx

 

Posts: 2
Score: 0
Joined: 11/30/2007
Status: offline
very good!!! u r a good Network adminstrator.
hahaha. despues hablamos, para que me apoyes en el trabajo..

MA

(in reply to jeferson.propheta)
 
 
Post #: 4
 
 RE: Change Local Admin Password and Add a Domain Group ... - 2/4/2008 7:45:54 AM   
  dogboyaa

 

Posts: 26
Score: 0
Joined: 12/20/2004
From:
Status: offline
How do you add a domain group to the local admin group.... if your logged in as a local user.

I have been looking at this for a while and I cant get it to work.

Im trying to make a script that simply joins a computer to the domain and then adds a tech group to the local admin group.

thanks for any suggestions.

(in reply to rager_mx)
 
 
Post #: 5
 
 RE: Change Local Admin Password and Add a Domain Group ... - 2/4/2008 11:25:09 PM   
  mbouchard


Posts: 1823
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
quote:

ORIGINAL: dogboyaa

How do you add a domain group to the local admin group.... if your logged in as a local user.

I have been looking at this for a while and I cant get it to work.

Im trying to make a script that simply joins a computer to the domain and then adds a tech group to the local admin group.

thanks for any suggestions.


Please post your question to the WSH & Vbscript Client forum.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to dogboyaa)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Change Local Admin Password and Add a Domain Group as Local Administrator 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