Add new comment to the specified url using SharePoint 2010 web service in powershell

Steps Involved:
  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
 
##Add new comment to the specified url using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT/_vti_bin/SocialDataService.asmx?wsdl"
## $url is a string that contains the URL for which the comment has to be added by the specified user
$url="http://serverName:10736/sites/ECT/"
## $comment is a string that contains the contents of the social comment
$comment="New Comment"
## $isHighPriority - true to indicate the social comment has a high priority; otherwise, false. If this value is null, this method assumes false for this parameter.
$isHighPriority=$false
## $title is a string that contains the title of the social comment
$title="New Comment"
## Get the credential for which the new comment has to be added for the specified url $url
$credential=Get-Credential
## Web Service Reference - http://Site/_vti_bin/SocialDataService.asmx
$socialDataServiceWebServiceReference = New-WebServiceProxy -Uri $uri -Credential $credential
$comment=$socialDataServiceWebServiceReference.AddComment($url,$comment,$isHighPriority,$title)

## $SocialCommentDetail is of Type: [SocialDataService Web service].SocialCommentDetail()
##[SocialDataService Web service].SocialCommentDetail() - Refer http://msdn.microsoft.com/en-us/library/websvcsocialdataservice.socialcommentdetail_members.aspx



write-host -ForegroundColor Green "New Social Comment : " $comment.Comment " - is created successfully"
write-host -ForegroundColor White "-------------------------------------------------------------------"
## SocialCommentDetail.Comment property is used to get the body of the social comment.
write-host -ForegroundColor Yellow "Comment : " $comment.Comment
## SocialCommentDetail.IsHighPriority property is used to indicate the priority level of the social comment.
write-host -ForegroundColor Yellow "IsHighPriority : " $comment.IsHighPriority
## SocialCommentDetail.Url property is used to get the URL to the social data.
write-host -ForegroundColor Yellow "Url : " $comment.Url
## SocialCommentDetail.Owner property is used to get the user associated with the social data.
write-host -ForegroundColor Yellow "Owner : " $comment.Owner
## SocialCommentDetail.LastModifiedTime property is used to get date and time when the social data was last modified.
write-host -ForegroundColor Yellow "LastModifiedTime : " $comment.LastModifiedTime
## SocialCommentDetail.Title property is used to get the title of the social data.
write-host -ForegroundColor Yellow "Title : " $comment.Title