Last active
November 17, 2018 20:32
-
-
Save darrenjrobinson/8f0e602207f355c09c832e692bf3f6c4 to your computer and use it in GitHub Desktop.
Microsoft Identity Manager PowerShell Management Agent for Twitter. Supporting blog post here https://blog.darrenjrobinson.com/a-twitter-management-agent-for-microsoft-identity-manager/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
$Username, | |
$Password, | |
$Credentials, | |
$OperationType, | |
$downloadDirectory = 'C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\MaData\Twitter', | |
[bool] $usepagedimport, | |
$pagesize | |
) | |
[string]$CSVFile = $null | |
$DebugFilePath = "C:\PROGRA~1\MICROS~2\2010\SYNCHR~1\EXTENS~2\Twitter\Debug\DebugTWeetMA.txt" | |
if(!(Test-Path $DebugFilePath)) | |
{ | |
$DebugFile = New-Item -Path $DebugFilePath -ItemType File | |
} | |
else | |
{ | |
$DebugFile = Get-Item -Path $DebugFilePath | |
} | |
"Starting Import : " + (Get-Date) | Out-File $DebugFile -Append | |
## Load Previously Retreived Twitter Feed that we've exported to an XML file | |
# Seed Friends & Followers | |
$tweetersinput = Import-Clixml -Path $downloadDirectory"\TwitterMAUsersInput.xml" | |
ForEach($tweeter in $tweetersinput) | |
{ | |
#Only bring in tweeters we have an anchor for (which should be every identity anyway) | |
if ($tweeter.id_str) | |
{ | |
$obj = @{} | |
$obj.Add("ID",$tweeter.id_str) | |
$obj.Add("objectClass", "user") | |
$obj.Add("DisplayName",$tweeter.name) | |
$obj.Add("ScreenName",'@'+$tweeter.screen_name) | |
$obj.Add("Location",$tweeter.Location) | |
$obj.Add("Description",$tweeter.Description) | |
$obj.Add("entities",$tweeter.entities) | |
$obj.Add("Protected",$tweeter.Protected) | |
$obj.Add("FollowersCount",$tweeter.Followers_Count) | |
$obj.Add("FriendsCount",$tweeter.Friends_Count) | |
$obj.Add("ListedCount",$tweeter.Listed_Count) | |
$obj.Add("CreatedDate",$tweeter.created_at) | |
$obj.Add("FavouritesCount",$tweeter.favourites_count) | |
$obj.Add("UTCOffset",$tweeter.UTC_Offset) | |
$obj.Add("Timezone",$tweeter.time_zone) | |
$obj.Add("GeoEnabled",$tweeter.Geo_Enabled) | |
$obj.Add("Verified",$tweeter.Verified) | |
$obj.Add("StatusCount",$tweeter.Statuses_Count) | |
$obj.Add("Language|",$tweeter.lang) | |
$obj.Add("Status",$tweeter.Status.text) | |
$obj.Add("following",$tweeter.following) | |
# Pass the object to the MA | |
$tweeter.screen_name | Out-File $DebugFile -Append | |
$obj | |
} | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment