Author Posts

May 30, 2016 at 3:25 pm

How would i make a script in powershell to see who unfriends me in facebook. would i use a webcrawler. i was given a bonus assignment for school. and i thought a web crawler would be the way to go. i do under stand html/css and some javascript but im new to powershell and not sure where to start. or maybe a webcrawler to report/show changes and have the report shown in a csv or something not sure any help is handy thanks

May 30, 2016 at 4:08 pm

Though you can try to do this with PowerShell, it wasn't created for this task.

Was PowerShell part of the assignment ?

PHP or C# with the facebook API might be a better tool for the job

https://www.script-tutorials.com/facebook-api-get-friends-list/

  • This reply was modified 2 years, 2 months ago by  Arie H.

May 30, 2016 at 4:14 pm

yes it need to be done in powershell i found this code

## The URI list to test
$URLListFile = "C:\url.txt"
$URLList = Get-Content $URLListFile -ErrorAction SilentlyContinue
$Result = @()

Foreach($Uri in $URLList) {
$time = try{
$request = $null
## Request the URI, and measure how long the response took.
$result1 = Measure-Command { $request = Invoke-WebRequest -Uri $uri }
$result1.TotalMilliseconds
}
catch
{

$request = $_.Exception.Response
$time = -1
}
$result += [PSCustomObject] @{
Time = Get-Date;
Uri = $uri;
StatusCode = [int] $request.StatusCode;
StatusDescription = $request.StatusDescription;
ResponseLength = $request.RawContentLength;
TimeTaken = $time;
}

}
#Prepare email body in HTML format
if($result -ne $null)
{
$Outputreport = "Website Availability Report Website Availability Report URLStatusCodeStatusDescriptionResponseLengthTimeTaken