2. Administrative Access to the computer running
Windows PowerShell
The Facebook PowerShell API at
http://facebookpsmodule.codeplex.com/
Windows PowerShell
A Facebook Account
3. Download the Facebook PowerShell API from
http://facebookpsmodule.codeplex.com/
This is an alpha version code
4. Download and extract the Facebook PowerShell
Scripts to any directory:
In this case I am using the download directory on the
computer I am using.
5. Run the file named FacebookPSModule Alpha -
.6.4.msi
6.
7. C:UsersdmorrillDocumentsWindowsPowerShell
ModulesFacebook
It should install in a directory much like this one
Note this directory
It is where you will find the scripts you need to run this
program
Remember to be the administrator of your PC when you
do this
Start up Windows PowerShell ISE to run this program
Start up Windows PowerShell on the side – you might
want it
8. In regular PowerShell -
Go to the directory where you installed the Facebook
API and scripts in:
9. Before running this you need to set your execution
policy
Set-executionPolicy unrestricted
It will prompt are you sure you want to do this
Answer yes (Y)
10.
11. New-FBConnection: This command sets up the
initial Facebook connection which you will need to use
most other commands. You will only need to do this
once, after that the connection will be cached in your
Windows profile.
Get-FBFriend: This command retrieves the list of
friends of the specified user. Note that default
Facebook permissions do not permit Facebook
applications to retrieve “friends of friends” lists, even
though these are available from the Facebook GUI.
This is a limitation of the Facebook API, not of
FacebookPSModule.
12. Get-FBAlbum, Get-FBFeed, Get-FBGroup, Get-
FBPhoto, Get-FBPost: These commands similarly retrieve
other classes of information.
Get-FBEvent: This command retrieves the list of events of
the specified user or group. Only “future” events will be
retrieved, and only if the user has not explicitly responded
“will not attend”.
Get-FBMember: Retrieves the list of members of a group.
Get-FBAssociation: This is a worker function for Get-
FBFriends, Events and Feed, but it also provides access to
other “Connections” offered by the Facebook Graph API for
which specific commands are not yet available.
13. Get-FBObjectData: This retrieves data on a specific object. The
object can be of any type. The –Fields parameter specifies the
data to retrieve; if you do not specify this, Facebook will choose a
default set of fields depending on the object type. Get-
FBObjectData returns a single object with parameters
corresponding to the requested fields. Individual fields may not
be present on the return object if they are not specified for the
Facebook object, or if you do not have permission to retrieve
them. Note that most Get-FB* commands have a -Fields
parameter; it is generally more efficient to retrieve them up front
rather than make multiple calls to Get-FBObjectData.
Add-FBBulkPhotos: Copy multiple photos to a Facebook album
*Read-FBBulkPhotos: Copy all the photos in a Facebook album
to files, or all the photos in all Facebook albums
14. Add-FBBulkPhotos: Copy multiple photos to a Facebook album
*Read-FBBulkPhotos: Copy all the photos in a Facebook album
to files, or all the photos in all Facebook albums.
New-FBPost: Creates a new post in the user or page feed.
New-FBEvent: This command creates a new Facebook event for
the current user.
New-FBEventInvite: Invites users to an existing event.
New-FBPhoto: Upload a photo from your computer to a
Facebook album.
Show-FBMessageDialog: This command helps send bulk
Facebook messages. Facebook does not permit sending messages
to be completely automated, but you can use this command to
send messages with just a few clicks for each group of 50
recipients.
15. Backup-FBFriends: This reads your current friends list
and backs it up to c:temp$timestring.csv. You can analyze
this file in Excel, or use import-csv and compare-object to
monitor changes to your friends list over time (de-
friendings etc).
Get-FBEventsFromFeed: This reads all the events from
the feed for a specific owner. I use this for finding events
belonging to a specific group.
Write-FBRSVPs: Read all the RSVPs for the specified
event, and write them to different CSV files. Put this in a
repeating Scheduled Task, and you’ll always have RSVP lists
at your fingertips! This was an important scenario for my
lead customer.
23. New-FBFeed –message “this is a test, this is only a test
of using Facebook at the command line”
You should see back the following if it worked right
28. Get a list of Facebook Friends and export to CSV
Create a post on Facebook saying Hi to your friends via
the command line
Get-FBAlbum and download a pictures list – export to
CSV
Hint get-FBAlbum | export-csv
“c:usersadministratormy documentsalbum.csv”
Get-Fbassociations
Hint get-FBAssociation | export….
It will ask you for a kind of association, enter friend
29. Get a list of all the events that a person is going to and
export it as a CSV file
Hint: get-FBEvent
Get a list of Events from the Facebook Feed and export
it as a CSV file
Hint: get-FBEventsFromFeed
Back up all your friends and save it as a CSV file
Hint: backup-FBFriends