Something obvious I'm missing?

Status
Not open for further replies.

hawkbox

Ars Legatus Legionis
13,914
Subscriptor
I'm working on a powershell script to import about 1300 users into our AD because our HR department decided our Intranet should be set up in the dumbest way possible and I'm having some issues getting the accounts imported. If I do a batch of ~100 the script seems to work fine and all the fields are created properly but when I point it at the primary CSV it doesn't properly populate the email, title, and department fields. Now the only major issue in these accounts is that some have email and some don't but that seems to be caught by my script as I intend it. I'm wondering if any of you smarty pants can see anything obviously wrong with my script? I'm already harassing the powershell IRC group but I thought I would see if any of you had any ideas.

http://jaykul.com/679
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
When running through the full file, do any accounts get created/populated properly?

If you put a couple of the accounts that aren't getting populated properly into the test file, do they still get populated/created improperly?

Looking at the CSV lines for the accounts that aren't getting properly populated, are there any red-flags in the data itself (extra commas or quotes, non-ascii characters, extra spaces, etc.)?

If you had to chunk the input into 14 100-ish line files, would that be the end of the world (that is, is this a one-time job or a regular/ongoing need)?
 

hawkbox

Ars Legatus Legionis
13,914
Subscriptor
[url=http:/civis/viewtopic.php?p=25577033#p25577033:1vx2yrsf said:
minnmass[/url]":1vx2yrsf]When running through the full file, do any accounts get created/populated properly?

If you put a couple of the accounts that aren't getting populated properly into the test file, do they still get populated/created improperly?

Looking at the CSV lines for the accounts that aren't getting properly populated, are there any red-flags in the data itself (extra commas or quotes, non-ascii characters, extra spaces, etc.)?

If you had to chunk the input into 14 100-ish line files, would that be the end of the world (that is, is this a one-time job or a regular/ongoing need)?

I have taken the first 100, a middle 100, and the end 100 and as a small batch they all create fine. When done as a large batch I check those same accounts and they don't create properly. I've gone through everything I can reasonably review and there are no obvious flags that catch my attention so I'm not sure.

I can drop it into smaller batches, that isn't the end of the world. I'm just curious as to what I did that caused this. Because I could see if failing at a certain account or line and then dropping out but the script is making each account as it goes so the ones before it fails should at the very least be proper.
 

hawkbox

Ars Legatus Legionis
13,914
Subscriptor
[url=http:/civis/viewtopic.php?p=25577349#p25577349:2ol0irbl said:
dragonlord[/url]":2ol0irbl]Would it be useful to add a sleep at the end of the loop once you've processed say 50 of them (declare a counter outside the loop and increment it at the end of each iteration, then sleep for 5 seconds or so and reset the counter). This is incase it's a problem with AD not catching up fast enough.

That's not a bad idea. It's definitely worth a try.
 
Status
Not open for further replies.