"JayCee" <> wrote in message
news:a4b85dc1-d71a-4011-8cf0-...
On Mar 16, 2:39 pm, Highlander <tron9...@msn.com> wrote:
> Hello All.
>
> Consider the following script:
> (watch for word wrap)
>
> strComputer = "atl-ws-01"
> strGroup = "Administrators"
> Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup &
> ",group")
> For Each objUser in objGroup.Members
> Wscript.Echo objUser.Name
> Next
>
> This script works fine; except if there's a dollar sign ($) in the
> group name. Then I get the dreaded "(null): The group name could not
> be found."
>
> Using "GetObject WinNT", how can I query a (Windows server) local
> group which has a "$" in the group name?
>
> Any help would be greatly appreciated. Thanks!
>
> - Dave
I tested this out, thought I duplicated the problem, and then realize
I made a stupid mistake. So make sure you aren't making this same
mistake.
I created 2 new groups on on a Windows 7 box, added myself to them,
and then ran this script against Administrators, test$test, and
$tester groups. All were successful.
I deleted the 2 groups I created. Moved the script to a winxp box,
again created the 2 extra groups and added myself. Administrators
worked fine. Both the $ groups failed with a null error like you
said.
The actual problem was that I forgot to update strComputer when I
moved the script to the new box.
Once I updated strComputer to the new machine name, it successfully
parsed my username out of all the groups.
========
I tested on an XP machine and found no problems. I created a group with the
name "Test$", because computer sAMAccountNames always have a trailing "$"
character and I thought that might matter. Your code worked for me.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--