Tuesday, April 14, 2015

BHOLD Model Generator Input Files

Working with BHOLD lately, using PowerShell to create the input files for the model generator which is pretty simple but handy for later on.

Here’s the snippet for creating the input files:

@'

OU_Key;BHOLD_OU_Key;Managers_CorperateKey;SV_Role;Parent_OU_Key

001;011;007

002;012;007;;001

003;013;007

'@ | Out-File C:\Temp\BHOLD_OU_File.csv -Encoding ascii

Import-Csv -Path C:\Temp\BHOLD_OU_File.csv -Delimiter ';' | ft -AutoSize

 

 

@'

Employee_ID;Managers_CorperateKey;OU_Key_1;Description

007;;001;Bond

013;007;001;Dewitt

003;007;001;Craig

001;007;001;Jenn

'@ | Out-File C:\Temp\BHOLD_User_File.csv -Encoding ascii

Import-Csv -Path C:\Temp\BHOLD_User_File.csv -Delimiter ';' | ft -AutoSize

 

 

@'

Employee_ID;Account;Application_Name;Permission_Name;Role_Name

007;JamesBond;License to Kill;Apply;Agent

001;JennSandler;Budu Race;Shred;Racer

'@ | Out-File C:\Temp\BHOLD_Account-Permission_File.csv -Encoding ascii

Import-Csv -Path C:\Temp\BHOLD_Account-Permission_File.csv -Delimiter ';' | ft -AutoSize

 

The only reason I am posting this is because it took me way longer than I’ll admit to get this working.  Turns out the Model Generator does not like the files unless they are ASCII encoded.  It won’t complain about the file encoding, but will throw other errors such as:

  • “DumpStaticData >> CheckOUStaticDataErrors >> Number of records with empty Parent_OU_Key is 0, there should at least be 1 to proceed !”
  • “ParseUserAttributes >> System.Collections.ArrayList >> The mandatory column 'Employee_ID' does not exist in the user import file.”

Hopefully if you hit any of the above errors you can spend less time figuring it out than I did.

No comments: