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/
#Seed Account
$twitterScreenName = 'mytwitteraccount'
# Output directory for the MA Import File
$downloadDirectory = 'C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\MaData\Twitter'
# Import XML Files Path
$importFileDirectory = 'C:\Users\darren\Dropbox\Kloud\Powershell\Twitter\data'
$tweetersinput = import-Clixml -Path $importFileDirectory+'\' + $twitterScreenName +'FollowersDetails.xml'
$tweetersinput.Count
# Get the ID's to compare against from followers input file
$baseIDs = @()
foreach ($id in $tweetersinput) {
$baseIDs += $id.id_str
}
# Get the Friends File
$tweetersinput2 = Import-Clixml -Path $importFileDirectory+'\' + $twitterScreenName +'FriendsDetails.xml'
$tweetersinput2.Count
# Ignote the duplicates and store the uniques
foreach ($twit in $tweetersinput2){
if($baseIDs | select-object | Where-Object {$_ -eq $twit.id_str} ){
#duplicate so ignore
}
else
{
$tweetersinput += $twit
write-host "Added" $twit.id_str
}
}
$tweetersinput.count
$tweetersinput | Export-Clixml -Path $downloadDirectory"\TwitterMAUsersInput.xml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment