November 8, 2005 at 9:46 pm
Hi All,
Perhaps someone out there can help me out with a little annoying issue i found with an ActiveX script job step.
I have a vbscript that pulls data from our AD and writes to a text file. It works just fine when it is run ourside SQL as a cscript or wscript job. However, when i place this same code into an SQL job step as ActiveX it still runs but annoyingly the last two fields 'whenChange' and 'whenCreated' are not extracted. These two fields are simply left out without any errors being generated.
Because of my, what i class as intermediate at best, skills in vb i suspect i have overlooked something simple.
The code is below.
Regards
Nick Harrison
---------------------------------------------------------------------------------------------------------
Option Explicit
Const ForWriting = 2
Const ForAppending = 8
Dim objFSO, objTextFile, oContainer, child
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("d:\temp\ad-data.txt", ForWriting, True)
Set oContainer = GetObject("LDAP://ou=Users,ou=container,dc=domain,dc=domain,dc=com")
oContainer.Filter = Array("user")
For Each child in oContainer
objTextFile.WriteLine(child.sAMAccountName & vbtab & child.displayName & vbtab & child.sn & vbtab & child.givenName & vbtab & _
child.mail & vbtab & child.title & vbtab & child.co & vbtab & child.st & vbtab & child.company & vbtab & child.department & vbtab & _
child.telephoneNumber & vbtab & child.otherTelephone & vbtab & child.mobile & vbtab & child.pager & vbtab & _
child.facsimileTelephoneNumber & vbtab & child.homePhone & vbtab & child.msExchAssistantName & vbtab & _
child.telephoneAssistant & vbtab & child.physicalDeliveryOfficeName & vbtab & child.manager & vbtab & child.l & vbtab & _
child.postOfficeBox & vbtab & child.postalCode & vbtab & child.c & vbtab & child.countryCode & vbtab & _
child.description & vbtab & child.ipPhone & vbtab & child.mailNickname & vbtab & child.name & vbtab & _
child.userAccountControl & vbtab & child.distinguishedName & vbtab & child.deletedItemFlags & vbtab & _
child.extensionAttribute1 & vbtab & child.extensionAttribute2 & vbtab & child.extensionAttribute3 & vbtab & _
child.extensionAttribute4 & vbtab & child.extensionAttribute5 & vbtab & child.extensionAttribute6 & vbtab & _
child.extensionAttribute7 & vbtab & child.extensionAttribute8 & vbtab & child.extensionAttribute9 & vbtab & _
child.extensionAttribute10 & vbtab & child.extensionAttribute11 & vbtab & child.extensionAttribute12 & vbtab & _
child.extensionAttribute13 & vbtab & child.extensionAttribute14 & vbtab & child.extensionAttribute15 & vbtab & _
child.homeDirectory & vbtab & child.homeDrive & vbtab & child.userPrincipalName & vbtab & _
right(child.msExchHomeServerName, 12) & vbtab & left(child.homeMDB, 12) & vbtab & _
child.msExchHideFromAddressLists & vbtab & child.whenCreated & vbtab & child.whenChanged)
Next
objTextFile.Close
Set objTextFile = objFSO.OpenTextFile ("c:\temp\ad-data.LOG", ForAppending, True)
objTextFile.WriteLine("AD data exported successfully" & vbtab & "Manual VBScript" & vbtab & now)
objTextFile.Close
set objFSO = Nothing
Set oContainer = Nothing
----------------------------------------------------------------------------------------------------------
November 11, 2005 at 8:00 am
This was removed by the editor as SPAM
November 11, 2005 at 12:59 pm
Could be the length of line that you are writting is too long. Try writting just the last 2 fields. Or open a second output file and write the last 2 fields.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply