PC Review


Reply
Thread Tools Rate Thread

wmi script adds LOCAL user need Local Admin

 
 
Al
Guest
Posts: n/a
 
      18th Mar 2004
I was looking all day for a script that would add a user
to a LOCAL machine. I finally found one! The only problem
is that I need to create the user in the "Administrators
Group" I edited the script over 100 time and could not
find any documentation on what class to call or anything.

Here is the script:
************
strComputer = "."
Set colAccounts = GetObject("WinNT://" & strComputer
& ",computer")
Set objUser = colAccounts.Create("user", "Admin2")
objUser.SetPassword "sA2xpWh"
objUser.SetInfo
**************

seems simple enough>>

Can anyone help???


 
Reply With Quote
 
 
 
 
Paul Adare - MVP - Microsoft Virtual PC
Guest
Posts: n/a
 
      18th Mar 2004
In article <c6c901c40ca2$d64fdd50$(E-Mail Removed)>, in the
microsoft.public.win2000.security news group, Al
<(E-Mail Removed)> says...

> I was looking all day for a script that would add a user
> to a LOCAL machine. I finally found one! The only problem
> is that I need to create the user in the "Administrators
> Group" I edited the script over 100 time and could not
> find any documentation on what class to call or anything.
>


Does it need to be a WMI script? Why not just use "net user" and "net
group"?

--
Paul Adare
Moral indignation is jealousy with a halo.
H. G. Wells, The Wife of Sir Isaac Harman
 
Reply With Quote
 
 
 
 
Bryston Nitta [MSFT]
Guest
Posts: n/a
 
      24th Mar 2004
http://www.microsoft.com/technet/com...r/default.mspx

You should be able to combine the code for Creating a Local User Account
with Adding a User to a Local Group

thx,
Bryston

This posting is provided "AS IS" with no warranties and confers no rights.

Al" <(E-Mail Removed)> wrote in message
news:c6c901c40ca2$d64fdd50$(E-Mail Removed)...
> I was looking all day for a script that would add a user
> to a LOCAL machine. I finally found one! The only problem
> is that I need to create the user in the "Administrators
> Group" I edited the script over 100 time and could not
> find any documentation on what class to call or anything.
>
> Here is the script:
> ************
> strComputer = "."
> Set colAccounts = GetObject("WinNT://" & strComputer
> & ",computer")
> Set objUser = colAccounts.Create("user", "Admin2")
> objUser.SetPassword "sA2xpWh"
> objUser.SetInfo
> **************
>
> seems simple enough>>
>
> Can anyone help???
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help on reg key (progs work as local admin not as domain admin) tingelton Microsoft Windows 2000 Registry 1 3rd Jul 2006 04:12 PM
Need help on reg key (progs work as local admin not as domain admin) tingelton Windows XP General 0 3rd Jul 2006 09:57 AM
WMI query local computer fails with access denied despite being local admin xr7 Windows XP WMI 0 17th Nov 2005 08:48 PM
Script that adds domain grp to local Admn group when joining domai =?Utf-8?B?SmltbXkgSw==?= Microsoft Windows 2000 Active Directory 5 5th Apr 2005 09:06 PM
script to list users and groups in domain admin and local admin gr =?Utf-8?B?Y3Jvc3N3aXJlZA==?= Microsoft Windows 2000 Security 6 29th Mar 2005 05:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:38 PM.