Thursday, April 3, 2014

How to Post on all of your FaceBook Groups Using Powershell ?

Powershell script saved as text here( Auth codes removed)


#1. This PowerShell script demonstrate how to use Facebook API's in PowerShell .
#2. How to load new framework dll . (Details How to load .Net 4 compiled dll in Powershell ? ) 
#3. How to generate Auth Access Token in facebook. (Details How to generate Facebook token ? )
#4. How to read online xml file which may be site map . (How to read online xml using PowerShell?  $onlineXMLSitemap = "http://sharepoint.asia/sitemap.xml" ;$doc = New-Object System.Xml.XmlDocument;$doc.Load($onlineXMLSitemap);
#5. How to run c# code from powershell directly . (Add-Type -ReferencedAssemblies $mAs -TypeDefinition $cSource -Language CSharp )
#6. How to solve overload function problem in Powershell ( Post method of facebook API has two overloads , one with Path , one without path . We are using 1st . That is why we called c# code from Powershell)
#7. How to select random entries in a collection . ($doc.urlset.url | Get-Random -count 1 | ForEach-Object )
#8. Business purpose resolved : Randomly post on Facebook in my all groups . This script picks one random url from provided Sitemap.XML and post it on 100 FB Groups and your own wall . You can reduce this number though .$Groups.data  | Get-Random -count 100| ForEach-Object {
#Related terms : Bulk Post on facebook , Post on All Groups ,  Use Facebook API is Powershell , Use Facebook API is c#


How to load .Net 4 compiled dll in Powershell ?

Do you get error like :

Exception calling "LoadFile" with "1" argument(s): "This assembly is built by a runtime
newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT:
0x8013101B)"

How to generate Facebook token ?


  • Do you have your app already on Facebook Developer site?

How to read online xml using PowerShell?

This post demonstrate how you could read an xml file and manipulate using PowerShell.
# I have taken this site's sitemap as sample xml

$onlineXMLSitemap = "https://hemantrohtak.blogspot.com/sitemap.xml" ;
$doc = New-Object System.Xml.XmlDocument;
$doc.Load($onlineXMLSitemap);

# you could manipulate this xml just like an ordinary xml in object model
#below mentioned: Print a random url from my sitemap

$doc.urlset.url | Get-Random -count 1 | ForEach-Object {

Write-Host $_.loc ;

}

Sample Code :

# I have taken this site's sitemap as sample xml
$onlineXMLSitemap = "https://hemantrohtak.blogspot.com/sitemap.xml" ;
$doc = New-Object System.Xml.XmlDocument;
$doc.Load($onlineXMLSitemap);
# you could manipulate this xml just like an ordinary xml in object model

Saturday, February 22, 2014

Can I stop my screen from locking due to inactivity?

Tonight I was watching movie on my TV being broadcasted via HDMI from my Laptop.

It was annoying to force my laptop from dying every now and then.  (Somehow I was not able to change power management settings to never sleep, don’t know why!!!)



So I quickly wrote this PowerShell script, to keep on clicking at random places on my screen:

Thursday, November 21, 2013

Do you want to spend on SharePoint only for MS Office DocumentCollaboration ?

First you should know How to collaborate with SharePoint 2013 :



Now Let's see what Google provides :

Sunday, September 1, 2013

List View Threshold

List View Threshold


Sometimes you might face a situation where you get this error:

9239 items (list view threshold is 5000)

The number of items in list exceeds the list view threshold, which is 5000 items.  Tasks that cause excessive server load (such as those involving all list items) are currently prohibited.

Even though it is recommended to use prescribed limits in your queries, but