#46695 - 2003-10-17 07:34 PM
Re: Create AD Global Groups for printer objects
|
Howard Bullock
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.
|
Top
|
|
|
|
#46696 - 2003-10-17 08:05 PM
Re: Create AD Global Groups for printer objects
|
tjcarst
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
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
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.
|
Top
|
|
|
|
#46699 - 2003-10-21 10:39 PM
Re: Create AD Global Groups for printer objects
|
tjcarst
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.
|
Top
|
|
|
|
#46700 - 2003-10-22 12:14 AM
Re: Create AD Global Groups for printer objects
|
tjcarst
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 ....
|
Top
|
|
|
|
#46701 - 2003-10-22 03:09 AM
Re: Create AD Global Groups for printer objects
|
tjcarst
Hey THIS is FUN
Registered: 2003-09-08
Posts: 243
Loc: USA
|
|
Top
|
|
|
|
#46702 - 2003-10-22 07:00 PM
Re: Create AD Global Groups for printer objects
|
tjcarst
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
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 [ 22. October 2003, 23:59: Message edited by: tjcarst ]
|
Top
|
|
|
|
#46705 - 2003-10-23 03:18 AM
Re: Create AD Global Groups for printer objects
|
tjcarst
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
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 ]
|
Top
|
|
|
|
#46708 - 2003-10-23 05:24 AM
Re: Create AD Global Groups for printer objects
|
Howard Bullock
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.
|
Top
|
|
|
|
#46710 - 2003-10-23 05:31 AM
Re: Create AD Global Groups for printer objects
|
Howard Bullock
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?
|
Top
|
|
|
|
#46712 - 2003-10-23 05:39 AM
Re: Create AD Global Groups for printer objects
|
Howard Bullock
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 ]
|
Top
|
|
|
|
#46714 - 2003-10-23 01:10 PM
Re: Create AD Global Groups for printer objects
|
Howard Bullock
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 ]
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|