Page 2 of 4 <1234>
Topic Options
#46695 - 2003-10-17 07:34 PM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What you are demonstrating is that the function works.

You will have to put the debugging code in place and in order to track all the values and success/failure of each ADSI I stated above.

The data in your last post provide little value except for proving the createadgroup function works.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46696 - 2003-10-17 08:05 PM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
I know it wasn't very helpful. I don't know why it isn't working, I just know it isn't. Sorry. I can post my script and post the output. Post the existing printers and the groups created. Beyond that, I'm stuck.

I thought I was passing my group names incorrectly to the CreateADGroup function. I know that by itself the CreateADGroup works and by itself the creation of the default and additional groups work. When I put the scripts together into one, it doesn't work.

I thought maybe I was missing a simple step to store the default and additional group names before passing to CreateAdGroup and was hoping someone would be able to help me get it to work.

I'll mess with this some more this weekend and see if I can get it to work. It is so close to working.

Top
#46697 - 2003-10-21 09:51 PM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Well, I've spent more time on getting this script to work than the time it would have taken to actually create the groups manually.

I can see the group names are returned correctly, and the createadgroup can create a single ad group correctly. Getting the two to work together isn't possible by me.

I am going to give up and do just that.

Thanks for trying to help me out.

tjcarst

Top
#46698 - 2003-10-21 10:29 PM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Sorry to hear that.

If you are still interested in honing your scripting skills, you could break the script in parts. First part woulf enumerate and write a file of the records to be processed lateer. Then open the file and read the line then send it to CreateADGroup().

There has to be a logical reason why thid ids not working in your current script.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46699 - 2003-10-21 10:39 PM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
That is an option. I could write it to c:\printers.txt and then try to call the info for use with CreateADGroup.udf.

That will take me two more hours to figure out. My problem is that I am stubborn and like to figure things out, so even though I have to give in and do this manually, I will figure this out. [Confused]

Top
#46700 - 2003-10-22 12:14 AM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
I may have found something. I was in the process of breaking down my script as you suggested.

I received the following error:

ERROR : unknown command [WriteLog2]!
Script: W:\CreateAdGroup.udf
Line : 60

I do not have the WriteLog2.udf. Initial searching of the UDF did not yield any results. I will search for this later tonight. Maybe my initial script will work. I just don't know why it could create a single group .... [Confused]

Top
#46701 - 2003-10-22 03:09 AM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Found it at http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000188#000000

I'll give it a try again tomorrow.

Top
#46702 - 2003-10-22 07:00 PM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
That wasn't it. I couldn't get that lucky.
Top
#46703 - 2003-10-22 11:45 PM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Interesting. I used the first part of my original script to write the names of the printers to a file (c:\printers.txt). Each line contains the name of a printer.

contents of c:\printers.txt

q-115hall
q-123hall
q-130hall
q-210hall
q-220hall
(etc.)

code:
; Creates printers.txt

;********** Beginning of group creation *********

$logfile=c:\printers.txt
$printers = GetObject("LDAP://OU=Printers,DC=madonna,DC=local")
$DN_of_OU ="OU=Printer Groups,DC=madonna,DC=local"

if @error
? @serror
else

$rc=redirectoutput($logfile,1)

for each $printer in $printers
$printername = $printer.name
$printername = substr($printername,4)

if left($printername,7) = "MRH-01-"

$printername = lcase(substr($printername,8))
? $printername

endif

next

$rc=redirectoutput('')

endif

Then I created this script to read the file.

code:
;http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=007920

call @ScriptDir+'\CreateAdGroup.udf'
call @ScriptDir+'\Readfile.udf'

$filename="c:\printers1.txt"

for each $line in ReadFile($filename)

$x=$line

if CreateAdGroup($DN_of_OU, "D_mrh-01_"+ $x, "global", 1, "Default Printer")=1
? "Group D_mrh_01_" + $x + " successfully created"
else
? "CreateAdGroup D_mrh_01_" + $x + " Failed with Error: " + @error
endif

if CreateAdGroup($DN_of_OU, "A_mrh_01_"+ $x, "global", 1, "Additional Printer")=1
? "Group A_mrh_01_"+" $x + " successfully created"

else

? "CreateAdGroup A_mrh_01_"+ $x + " Failed with Error: " + @error

endif

next

endif

I get the same error message.

Results returned to screen:
Create ADGroup D_mrh_01_q-115hall Failed with Error: -2147352567
Create ADGroup D_mrh_01_q-123hall Failed with Error: -2147352567
Create ADGroup D_mrh_01_q-130hall Failed with Error: -2147352567
Create ADGroup D_mrh_01_q-210hall Failed with Error: -2147352567
Create ADGroup D_mrh_01_q-220hall Failed with Error: -2147352567

and continues on for each printer.

tjcarst [Confused]

[ 22. October 2003, 23:59: Message edited by: tjcarst ]

Top
#46704 - 2003-10-23 03:09 AM Re: Create AD Global Groups for printer objects
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
$DN_of_OU is not specified in your script. Also use the CError() UDF to translate the COM error into plain text.
_________________________
There are two types of vessels, submarines and targets.

Top
#46705 - 2003-10-23 03:18 AM Re: Create AD Global Groups for printer objects
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Thanks for the reply.

In my actual script th $DN_of_OU is specified. I forgot to include that line in my copy and paste.

I'll try getting the COM error and post what I discover.

tjcarst

Top
#46706 - 2003-10-23 04:50 AM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
tjcarst, I have reproduced you error in my AD environment. I have tested quite a bit and could not find a reason for the behavior.

What I found is that, always on the second creation of a group, the SetInfo method failed with error 9 (The storage control block address is invalid). It did not matter in which order the groups were created. That ruled out any name issues.

quote:
c:\data\scripts>C:\Data\Kix2001\KiX2001.421\kix32 test.kix
GetObject= 0
Error.create=0
Error.put=0
Error.GrpType=0
Error.Descr=0
Error.Setinfo=0
Group A_mrh_01_q-123hall successfully created
GetObject= 0
Error.create=0
Error.put=0
Error.GrpType=0
Error.Descr=0
Error.Setinfo=9
Error=9

CreateAdGroup D_mrh_01_q-123hall Failed with Error: 9

This led me to believe that KiXtart or ADSI is not properly destroying the OU or group object and the Setinfo is trying to recreate the previous group. I added $oOU=0 and $oNewGrp=0 before the end of the UDF to force the issue, but this did not help.

In short the UDF seem to work only once per script execution. This has me very concerned. Can anyone offer any other testing scenarios or theories on what may be happening here?

[ 23. October 2003, 04:51: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46707 - 2003-10-23 05:15 AM Re: Create AD Global Groups for printer objects
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
One quick test suggestion, in your UDF, instead of using reflected property references (fe. $obj.Put("property-name","value") just use the simple hard-coded variety ($obj.property = value) ... we built our entire domain many times over using ADSI and LDAP and $OU.Create in loops ... no issues found ...
Top
#46708 - 2003-10-23 05:24 AM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Shawn, I am just perplexed by this behavior. I made the change you suggested (changing the $obj.Put(property, value) to just $obj.proerty = value) but the problem persists. [Frown] [Mad]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46709 - 2003-10-23 05:28 AM Re: Create AD Global Groups for printer objects
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Then your only option Howard, is to strip your UDF down to the bare essentials, maybe a simple one or two line Group create with default properties, then build it back up until it breaks.

I would like to lend a hand for testing tomorrow when I'm back in the office ...

Top
#46710 - 2003-10-23 05:31 AM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Well I am headed to bed now but greatly welcome your assistance with this issue. When will you be back in the office?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46711 - 2003-10-23 05:34 AM Re: Create AD Global Groups for printer objects
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I am going to fire-up your UDF against our AD first thing in the morning, around 8am my time. Your about an hour behind or same time ja ?
Top
#46712 - 2003-10-23 05:39 AM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
U.S. East Coast time. NY City etc.

[ 23. October 2003, 05:40: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46713 - 2003-10-23 05:47 AM Re: Create AD Global Groups for printer objects
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Are you using that test harness script you posted earlier, where your creating two groups with each iteration - or does it break even when creating a single group per iteration ?
Top
#46714 - 2003-10-23 01:10 PM Re: Create AD Global Groups for printer objects
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I am reading five root names from a file and pre-pending just like the example.

In a loop the script fails on the second create if it is the second create using the altered name within the same loop.

It also fails if I comment out the second call to the UDF within the loop and attempt to run through the five names.

Do you have a post rc1 custom build of 4.22 to try? I know there were some ADSI related fixes in it.

[ 23. October 2003, 13:13: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 2 of 4 <1234>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.045 seconds in which 0.018 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org