#151731 - 2005-11-17 07:06 PM
Errors using GroupAdd UDF
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Hey guys. I am encountering errors using a script to add the Domain Users global group to the Power Users local group on a list of machines in a specific OU. I am using the fnLDAPQuery and GroupAdd UDFs. Here is my code (minus the UDFs) Code:
Break On ;RedirectOutput("c:\jobs\lclGroupModder.log") $aAttributes = "name" $sADsPath = "LDAP://OU=Computers,OU=MOR,OU=US,DC=na,DC=healthcare,DC=cnb" $strFilter = "(objectClass=Computer)" $aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter) FOR each $res in $aResults "GroupAdd('$res', '$res\Power Users', 'Domain Users')"? $junk=GroupAdd('$res', '$res\Power Users', 'Domain Users') @SERROR ? Next
Here is the log file with the error:
Code:
C:\JOBs>kix32 lclgrpmodder GroupAdd('MOR6E6', 'MOR6E6\Power Users', 'Domain Users') The network path was not found. GroupAdd('MOR621', 'MOR621\Power Users', 'Domain Users') Error (317 / 13D) while retrieving error information for 800708AC GroupAdd('MOR661', 'MOR661\Power Users', 'Domain Users') The network path was not found. GroupAdd('MOR6BH', 'MOR6BH\Power Users', 'Domain Users') The network path was not found. GroupAdd('MOR6BR', 'MOR6BR\Power Users', 'Domain Users') Error (317 / 13D) while retrieving error information for 800708AC GroupAdd('MOR6D3', 'MOR6D3\Power Users', 'Domain Users') Error (317 / 13D) while retrieving error information for 800708AC
The network path not found ones I understand (they are not on). However, the ones that ARE on return strange errors. Is it the quotes? I have tried a bunch of different variations of Domain\Username, Workstation\Power Users, without the domain, etc.
|
|
Top
|
|
|
|
#151732 - 2005-11-17 09:11 PM
Re: Errors using GroupAdd UDF
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
using the following code, we can get the decimal error numnber... Code:
? val("&"+Right('800708AC',4))
which yields:
2220 c:\data\scripts>net helpmsg 2220
The group name could not be found.
EXPLANATION
You specified an unknown group name.
ACTION
Check the spelling of the group name. To display a list of the groups in the security database, type:
NET GROUP
what about the "Domain Users" reference? Should it be "domain\Domain Users"
Edited by Howard Bullock (2005-11-17 09:13 PM)
|
|
Top
|
|
|
|
#151733 - 2005-11-17 10:01 PM
Re: Errors using GroupAdd UDF
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Ok... I think that led me in the right direction. I think my main problem is interpreting the error msgs. See my log file now... this first entry is when the group was not populated: Code:
GroupAdd('MOR6H1', 'Power Users', 'BHC-NA\Domain Users') The operation completed successfully. That looks good, of course. If I run it again, though, it would be nice to get a friendlier message than the following: Code:
C:\JOBs>kix32 lclgrpmodder GroupAdd('MOR6H1', 'Power Users', 'BHC-NA\Domain Users') COM exception error "Add" ((null) - (null)) [-2147352567/80020009]
In the above case it would be nice to see a "The user/group is already a member of the local group" or something similar. Beggers can't be choosers, though, I suppose. Any other suggestions?
|
|
Top
|
|
|
|
#151734 - 2005-11-17 10:36 PM
Re: Errors using GroupAdd UDF
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#151736 - 2005-11-17 11:25 PM
Re: Errors using GroupAdd UDF
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Well, Les, my first post was in the right forum.  I guess I was griping in the latter reply... or asking if there is a way to get a friendlier response... in which case, Howard's reply was right on point! Thanks Howard!
|
|
Top
|
|
|
|
#151737 - 2005-11-18 03:59 PM
Re: Errors using GroupAdd UDF
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Hey Howard (or whoever wants to comment),
I included the fnComErr UDF, which is great, but if the group already exists when it attempts to add, it says "The storage control block is invalid". This is much better than: COM exception error "Add" ((null) - (null)) [-2147352567/80020009]
However it is still not descriptive of the situation. The other errors are good... "Network path not found", and "The operation completed successfully."
I know I am being nitpicky... or I think there is another word for someone who spends too much time on small stuff.
|
|
Top
|
|
|
|
#151739 - 2005-11-18 04:22 PM
Re: Errors using GroupAdd UDF
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Duly noted Les.
 *looking up Mapquest for directions to Bill Gates house*
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1452 anonymous users online.
|
|
|