Add new tag with the specified keyword to the specified url using SharePoint 2010 web service in powershell

Steps Involved
  • Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  • Run the following script.
Powershell Script
##Add new tag with the specified keyword 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/"
## $keyword is a string that contains the contents of the social tag
$keyword="My New Tag"
## $isHighPriority -true to indicate the social tag is private; otherwise, false. If this value is null, this method assumes false for this parameter.
$isPrivate=$false
## $title is a string that contains the title of the social tag
$title="My New Tag"
## Get the credential for which the new tag 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
$tag=$socialDataServiceWebServiceReference.AddTagByKeyword($url,$keyword,$title,$isPrivate)
## $tag is of Type: [SocialDataService Web service].SocialTagDetail()
##[SocialDataService Web service].SocialTagDetail() - Refer http://msdn.microsoft.com/en-us/library/websvcsocialdataservice.socialcommentdetail_members.aspx