Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Microsoft Identity Manager PowerShell Management Agent for Twitter. Supporting blog post here https://blog.darrenjrobinson.com/a-twitter-management-agent-for-microsoft-identity-manager/
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
You can’t perform that action at this time.