SharePoint 2013 LogAnalyticsApp – PowerShell script to register the Event

Sathish Nadarajan
 
Solution Architect
July 29, 2013
 
Rate this article
 
Views
10453

In one of my previous post I have explained about SharePoint 2013 LogAnalytics app event.  Now let us see, how we can register the event with a corresponding GUID, which will be used for Log Analytics.

The script is self-explanatory and for any clarifications, please post your comments.

 cls
 Add-PSSnapin "Microsoft.SharePoint.PowerShell"
 
 # To get a site at the root site collection level:
  $Site = Get-SPSite "https://c4968397007.dc07.loc:9470/sites/ADFSTest"
 
 # To create a custom usage event type:
 $SSP = Get-SPEnterpriseSearchServiceApplicationProxy
 
 # Creating a new GUID
 $EventGuid = [Guid]::NewGuid();
 
 # Name of the EVENT
 $EventName = "Item Checkout from ProductCatalog ADFSTest";
 $tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty);#
 $newEventType = $tenantConfig.RegisterEventType($EventGuid, $EventName, "ADFSTest-31May2013")
 $tenantConfig.Update($SSP)
 
 # Writing the GUID.  This should be noted down.
 Write-Host $EventGuid 
 

To verify and the get the list of events registered, execute the below command.

 #To verify the Registered Events.
  cls
  Add-PSSnapin "Microsoft.SharePoint.PowerShell"
 
 $SSP = Get-SPEnterpriseSearchServiceApplicationProxy
 $SSP.GetAnalyticsEventTypeDefinitions([Guid]::Empty, 3) | ft

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment