Re: Add User to Local Group using WMI?
- From: "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com>
- Date: Fri, 15 May 2009 11:35:32 -0400
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@xxxxxxxxxxxxxxxxxxxxxxxxxHi 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.
- Follow-Ups:
- Re: Add User to Local Group using WMI?
- From: Gerry Hickman
- Re: Add User to Local Group using WMI?
- References:
- Add User to Local Group using WMI?
- From: Gerry Hickman
- RE: Add User to Local Group using WMI?
- From: "Jialiang Ge [MSFT]"
- Re: Add User to Local Group using WMI?
- From: Gerry Hickman
- Add User to Local Group using WMI?
- Prev by Date: Re: Get wireless data rate via WMI
- Next by Date: Re: Add User to Local Group using WMI?
- Previous by thread: Re: Add User to Local Group using WMI?
- Next by thread: Re: Add User to Local Group using WMI?
- Index(es):
Relevant Pages
|
Loading