
[SPS] Export UPA User Properties values to text using PS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
#Add SPS Assemblies [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles") [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") # Connect to CA site $site = new-object Microsoft.SharePoint.SPSite("http://yourCASite:9999"); $ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site); $ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext) #Define output file and its headers $file = New-Object System.IO.StreamWriter "C:\temp\UserProfilestest2.txt"; $file.WriteLine("AboutMe;NewBirthday;FirstNameAlpha;CellPhone;HomePhone;SPS-TimeZone;Innovation;SPS-Skills;FirmenichProjects;LastTraining;GenPubl;SPS-Responsibility;SPS-PastProjects;Language;Lang1;Lang1Level;Lang2;Lang2Level;Lang3;Lang3Level;Lang4;Lang4Level;propRoleMandate-IndAcc;propRoleMandate-keySharedAcc;propRoleMandate-DecRigOwn;propRoleMandate-DecRigInf;propRoleMandate-DecRigVal;propRoleMandate-ParaSucKeyMet;propRoleMandate-ParaSucTarMet;propRoleMandate-ParaSucOrg;SPS-Interests;PersoFlavor;PersoFragrance;PersoQuote;SPS-EmailOptin;FavouriteDivisions;FavouriteLinks"); #connect to user's profile and get properties $profile=$ProfileManager.GetUserProfile("domain\user") $AboutMe=$profile["AboutMe"] $NewBirthday=$profile["NewBirthday"].value $FirstNameAlpha=$profile["FirstNameAlpha"] $CellPhone=$profile["CellPhone"] $HomePhone=$profile["HomePhone"] $SPSTimeZone=$profile["SPS-TimeZone"].value $Innovation=$profile["Innovation"] $SPSSkills=$profile["SPS-Skills"] $MyProjects=$profile["MyProjects"] $LastTraining=$profile["LastTraining"] $GenPubl=$profile["GenPubl"] $SPSResponsibility=$profile["SPS-Responsibility"] $SPSPastProjects=$profile["SPS-PastProjects"] $Language=$profile["Language"] $Lang1=$profile["Lang1"] $Lang1Level=$profile["Lang1Level"] $Lang2=$profile["Lang2"] $Lang2Level=$profile["Lang2Level"] $Lang3=$profile["Lang3"] $Lang3Level=$profile["Lang3Level"] $Lang4=$profile["Lang4"] $Lang4Level=$profile["Lang4Level"] $propRoleMandateIndAcc=$profile["propRoleMandate-IndAcc"] $propRoleMandatekeySharedAcc=$profile["propRoleMandate-keySharedAcc"] $propRoleMandateDecRigOwn=$profile["propRoleMandate-DecRigOwn"] $propRoleMandateDecRigInf=$profile["propRoleMandate-DecRigInf"] $propRoleMandateDecRigVal=$profile["propRoleMandate-DecRigVal"] $propRoleMandateParaSucKeyMet=$profile["propRoleMandate-ParaSucKeyMet"] $propRoleMandateParaSucTarMet=$profile["propRoleMandate-ParaSucTarMet"] $propRoleMandateParaSucOrg=$profile["propRoleMandate-ParaSucOrg"] $SPSInterests=$profile["SPS-Interests"] $PersoFlavor=$profile["PersoFlavor"] $PersoFragrance=$profile["PersoFragrance"] $PersoQuote=$profile["PersoQuote"] $SPSEmailOptin=$profile["SPS-EmailOptin"].value $FavouriteDivisions=$profile["FavouriteDivisions"] $FavouriteLinks=$profile["FavouriteLinks"] #write output to defined variable $file.Writeline("$($AboutMe);$($NewBirthday);$($FirstNameAlpha);$($CellPhone);$($HomePhone);$($SPSTimeZone);$($Innovation);$($SPSSkills);$($MyProjects);$($LastTraining);$($GenPubl);$($SPSResponsibility);$($SPSPastProjects);$($Language);$($Lang1);$($Lang1Level);$($Lang2);$($Lang2Level);$($Lang3);$($Lang3Level);$($Lang4);$($Lang4Level);$($propRoleMandateIndAcc);$($propRoleMandatekeySharedAcc);$($propRoleMandateDecRigOwn);$($propRoleMandateDecRigInf);$($propRoleMandateDecRigVal);$($propRoleMandateParaSucKeyMet);$($propRoleMandateParaSucTarMet);$($propRoleMandateParaSucOrg);$($SPSInterests);$($PersoFlavor);$($PersoFragrance);$($PersoQuote);$($SPSEmailOptin);$($FavouriteDivisions);$($FavouriteLinks)"); #close filewrite stream $file.close(); #dispose site $site.Dispose() |