We are working on sharing data with Oracle from our AD to keep our records up to date, etc. I am having the hardest time creating a script to automate the pull of certain data from active directory and include it in a csv, which then needs to be turned into a pipe delimeted form. The pipe delimeted part i think I can handle, but getting there is just not working.
What they require is the following. A table that has 6 headers such as:
METADATA|Worker|FLEX:PER_PERSONS_DFF|enterpriseId(PER_PERSONS_DFF=Global Data Elements)|EffectiveStartDate|PersonNumber
The first 3 columns will need to have nothing but the headers METADATA|Worker|FLEX:PER_PERSONS_DFF and under them have
the words MERGE | Worker | Global Data Elements.
The next fields will be pulled from Active Directory and be username | startdate | employeeID.
So the final will look somewhat like this…
METADATA|Worker|FLEX:PER_PERSONS_DFF|enterpriseId(PER_PERSONS_DFF=Global Data Elements)|EffectiveStartDate|PersonNumber
MERGE |Worker|Global Data Elements| employeeA username |10/27/2016 |100000000
MERGE |Worker|Global Data Elements| employeeB username |10/27/2016 |100000001
MERGE |Worker|Global Data Elements| employeec username |10/27/2016 |100000002
so the first 3 columns will always be the same and columns D, E, F will be pulled from AD.
I have something that will show me what I want to pull from AD when I run it that is in part like this… and the varibles for ADServer and Searchbase are defined.
$AllADUsers = Get-ADUser -server $ADServer -searchbase $SearchBase -filter * -Properties * | select sAMAccountName, EmployeeNumber, EmployeeID
$Co
$AllADUsers |
Select-Object
@{Label = “METADATA”;Expression = {“MERGE”}},
@{Label = “Worker”;Expression = {“Worker”}},
@{Label = “FLEX:PER_PERSONS_DFF”;Expression = {“Global Data Elements”}},
@{Label = “enterpriseId(PER_PERSONS_DFF=Global Data Elements)”;Expression = {$.sAMAccountName}},
@{Label = “EffectiveStartDate”;Expression = {$.EmployeeNumber}},
@{Label = “PersonNumber”;Expression = {$_.EmployeeI
The output is great but when I | export-Csv it looks like this…
IsReadOnly IsFixedSize IsSynchronized Keys Values SyncRoot Count
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
FALSE FALSE FALSE System.Collections.Hashtable+KeyCollection System.Collections.Hashtable+ValueCollection System.Object 2
So the export doesn’t look anything like what powershell shows.
If anyone could assist me i’d love it! I’m still fairly new…