Re: Add User to Local Group using WMI?



Gerry,

This has been a thorny issue for me, too. I explored ways to deal with local group management about 4-5 years and the only built-in solution then was the WinNT provider. Doing a check now on some resources and then exploring WMI on even Win7, I don't find anything else for it.

Looking at the security-related methods and properties in WMI, what you'll see is that properties are almost universally read-only, and methods that do anything substantial are designed to perform tasks that you can't do with WinNT: and ldap:. That's even more of an irritation to me now than it was back then because I use PowerShell frequently and the way .NET binding to those providers works forces you to map out method bindings on your own. : /

Is there a particular kind of situation you're trying to handle with this?

"Gerry Hickman" <gerry666uk2@xxxxxxxxxxxxxxxx> wrote in message news:#YrafIH1JHA.4288@xxxxxxxxxxxxxxxxxxxxxxx
Hello Jialiang,

As I said in the original post, I already have the ADSI solution. My question is how to do this using WMI classes.

--
Gerry Hickman
London (UK)

""Jialiang Ge [MSFT]"" <jialge@xxxxxxxxxxxxxxxxxxxx> wrote in message news:qyxuUhG1JHA.2064@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Gerry

Here you go:

strComputer = "COMPUTER NAME"
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "TestUser1")
objUser.SetPassword "PASSWORD"
objUser.SetInfo
Set objGroup = GetObject("WinNT://"& strComputer &"/Administrators")
objGroup.Add "WinNT://"& strComputer & "/TestUser1"

This script creates a user "TestUser1" whose password is "PASSWORD" on the
specified computer and add the user to the Administrators group.

Regards,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • RE: How can I install SQL Server Managment Studio (2005)?
    ... Did you choose "Management Toos" in the Advanced option during your setup process? ... Microsoft Online Community Support ... Please feel free to let my manager ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.sqlserver.setup)
  • RE: Hide Attributes without completely hiding Dimension Members
    ... Unfortunately SSAS 2005 does not provide such function in such a thin granular level. ... Microsoft Online Community Support ... Please feel free to let my manager ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.sqlserver.olap)
  • Re: Unable to open msg store if first prompt for password canceled
    ... I am performing research on this issue and may need more time to get back to you. ... We welcome your comments and suggestions about how we can improve the support we provide to you. ... Please feel free to let my manager know what you think of the level of service provided. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.win32.programmer.messaging)
  • RE: 2000 AS SP4 RepositoryUser and OLAP Admins Group
    ... That did it (after checking off msdb in Permissions tab on the Login ... Open SQL Server Enterprise Manager, expand Security folder, right click Logins, click ... Microsoft Online Community Support ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.sqlserver.olap)
  • RE: Regarding ASP.NET Web Application
    ... I think Asp.Net Membership and Role Manager can achieve it as you wish. ... The following link is about "Authorizing Access to a Page with Role ... Microsoft Online Support ... initial response from the community or a Microsoft Support Engineer within ...
    (microsoft.public.dotnet.framework.aspnet.security)

Loading