Office Web Apps Shared Service Discovery Provider
Microsoft.SharePoint.Server.2010.SPSharedService.DiscoveryProvider.WAC (DataSourceModuleType)
This is the discovery provider for populating Office Web Apps shared service instances running on SharePoint servers.
Element properties: Member Modules:
Overrideable Parameters:
Source Code: <DataSourceModuleType ID="Microsoft.SharePoint.Server.2010.SPSharedService.DiscoveryProvider.WAC" Accessibility="Internal" RunAs="WSS!Microsoft.SharePoint.Foundation.2010.AdminAccount">
<Configuration>
<xsd:element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SyncTime" type="xsd:string"/>
<xsd:element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DebugTrace" type="xsd:boolean"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="DebugTrace" Selector="$Config/DebugTrace$" ParameterType="bool"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="WSS!Microsoft.SharePoint.Foundation.2010.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
<ApplicationName/>
<WorkingDirectory/>
<CommandLine>powershell.exe -Version "2.0" -NoLogo -NoProfile -Noninteractive "& '$file/WACSharedServiceDiscovery.ps1$' '$MPElement$' '$Target/Id$' '$Config/ComputerName$' '$Config/DebugTrace$'"</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>WACStrings.ps1</Name>
<Contents><Script> $global:EventLog_Fail_Create_Discovery_Package = "Failed to create Discovery transmission package.";
$global:EventLog_Fail_Return_Discovery_Package = "Failed to return Discovery transmission package.";
$global:EventLog_Fail_Create_Discovery_ScriptAPI = "Failed to initiate MOM.ScriptAPI object.";
$global:EventLog_Fail_Create_Class = "Failed to create {0} class instance.";
$global:EventLog_Fail_Create_Relationship = "Failed to create {0} relationship instance.";
$global:EventLog_Fail_LoadBalancer_Operation = "Addresses for this application may not have been fetched yet.";
$global:EventLog_Exit_On_NonExist = "This machine does not have SharePoint installed."
$global:EventLog_Fail_On_Error = "{0} Discovery/Monitoring script continues under this error! ";
$global:EventLog_Exit_On_Error = "{0} Discovery/Monitoring script was terminated! ";
$global:EventLog_Format = @"
Current User: {0}
Current PID: {1}
InvocationInfo.MyCommand: {2}
InvocationInfo.ScriptLineNumber: {3}
InvocationInfo.OffsetInLine: {4}
InvocationInfo.ScriptName: {5}
InvocationInfo.Line: {6}
InvocationInfo.PositionMessage: {7}
InvocationInfo.InvocationName: {8}
InvocationInfo.PipelineLength: {9}
InvocationInfo.PipelinePosition: {10}
"@;
$global:EventLog_Template = "[{0} in Discovery/Monitoring script] {1} {2}";
$global:EventLog_Debug_StartedArgs = "[Debug] {0} Started. Args[]={1}, {2}, {3}, {4}.";
$global:EventLog_Debug_MajorServer = "[Debug] This is the major server detected by {0}.";
$global:EventLog_Fail_Retrieve_RegistryKey = "Failed to retrieve registry key {0}.";
$global:DisplayName_SiteCollection = "Site Collection";
$global:DisplayName_Excel_Page = "Excel Services Application Page";
$global:DisplayName_WordViewer_Page = "Word Web Frontend";
$global:DisplayName_PPTViewer_Page = "PowerPoint Web Frontend";
$global:DisplayName_OneNoteEditor_Page = "One Note Editor Page";
</Script> </Contents>
</File>
<File>
<Name>WACDiscoveryLibrary.ps1</Name>
<Contents><Script> $error.Clear();
$ErrorActionPreference = "SilentlyContinue";
$global:EventObject = New-Object Diagnostics.EventLog
$global:EventObject.Source = "Operations Manager"
function global:Write-Event ([string] $LogContent, $LogType = [Diagnostics.EventLogEntryType]::Information)
{
if ($error)
{
$error.Clear()
$LogType = [Diagnostics.EventLogEntryType]::Error
}
$EventObject.WriteEntry($LogContent, $LogType)
}
function global:LogScriptTime($InvocationObj)
{
$dtEnd = [DateTime]::Now
$msg = @"
[Debug] {0} ended.
Current User: {1}
Current PID: {2}
start time: {3}
stop time: {4}
time taken: {5}
"@ -f $InvocationObj.MyCommand,
[Environment]::UserName,
$pid,
$dtStart,
$dtEnd,
(New-TimeSpan $dtStart $dtEnd).TotalMilliseconds
Write-Event $msg
}
.\WACStrings.ps1
$global:Arguments = $Args;
$global:Farm = $null;
$global:LocalServer = $null;
$global:DiscData = $null;
$global:Port = "_port";
$global:Http = "_http";
function global:Get-Farm()
{
if ($global:Farm -eq $null)
{
$global:Farm = [Microsoft.SharePoint.Administration.SPFarm]::Local;
}
}
function global:Get-LocalServer()
{
if ($global:LocalServer -eq $null)
{
$global:LocalServer = [Microsoft.SharePoint.Administration.SPServer]::Local;
}
}
function global:Get-ServiceProxy([string] $ClassType)
{
Get-Farm;
foreach ($ServiceProxy in $global:Farm.ServiceProxies)
{
if ($ClassType.ToLower() -eq $ServiceProxy.GetType().FullName.ToLower())
{
return $ServiceProxy;
}
}
return $null;
}
function global:Get-Service([string] $ClassType)
{
Get-Farm;
foreach ($Service in $global:Farm.Services)
{
if ($ClassType.ToLower() -eq $Service.GetType().FullName.ToLower())
{
return $Service;
}
}
return $null;
}
function global:Get-ServiceEx([string] $ClassType, [string] $Name)
{
Get-Farm;
foreach ($Service in $global:Farm.Services)
{
if ($ClassType.ToLower() -eq $ServiceInstance.GetType().FullName.ToLower())
{
if ($Name.ToLower() -eq $ServiceInstance.Name.ToLower())
{
return $ServiceInstance;
}
}
}
return $null;
}
function global:Get-ServiceInstance([string] $ClassType)
{
Get-LocalServer;
if (! $ClassType.EndsWith("Instance"))
{
$ClassType += "Instance";
}
foreach ($ServiceInstance in $global:LocalServer.ServiceInstances)
{
if ($ClassType.ToLower() -eq $ServiceInstance.GetType().FullName.ToLower())
{
return $ServiceInstance;
}
}
return $null;
}
function global:Get-ServiceInstanceEx([string] $ClassType, [string] $Name)
{
Get-LocalServer;
if (! $ClassType.EndsWith("Instance"))
{
$ClassType += "Instance";
}
foreach ($ServiceInstance in $global:LocalServer.ServiceInstances)
{
if ($ClassType.ToLower() -eq $ServiceInstance.GetType().FullName.ToLower())
{
if ($Name.ToLower() -eq $ServiceInstance.Name.ToLower())
{
return $ServiceInstance;
}
}
}
return $null;
}
function global:Create-DiscoveryData()
{
if ($global:DiscData -eq $null)
{
$global:DiscData = $global:MomScriptAPIObject.CreateDiscoveryData(0, $global:Arguments[0], $global:Arguments[1]);
Handle-Errors($global:EventLog_Fail_Create_Discovery_Package, $true, $false);
$global:HealthSvc = $global:DiscData.CreateClassInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthService']$");
$global:HealthSvc.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
Handle-Errors($global:EventLog_Fail_Create_Class -f "Microsoft.SystemCenter.HealthService");
}
return $global:DiscData;
}
function global:Deliver-DiscoveryData([Object] $DiscData)
{
$global:MomScriptAPIObject.Return($DiscData);
Handle-Errors($global:EventLog_Fail_Return_Discovery_Package, $true, $false);
$DiscData = $null;
}
function global:IsMainServer([System.Boolean] $UseLastServer)
{
$Servers = $global:Farm.Servers;
if ($UseLastServer)
{
$Count = $Servers.Count;
$ServerArray = new-object string[][] $Count,2;
$Index = 0;
foreach ($Server in $Servers)
{
$ServerArray[$Index][0] = $Server.Name;
$ServerArray[$Index++][1] = $Server.Role.ToString();
}
for ($Index--; $Index -ge 0; $Index--)
{
if ($ServerArray[$Index][1] -ne "Invalid")
{
return ($ServerArray[$Index][0] -eq $global:LocalServer.Name);
}
}
}
else
{
foreach ($Server in $Servers)
{
if ($Server.Role -ne "Invalid")
{
return ($Server.Name -eq $global:LocalServer.Name);
}
}
}
return $false;
}
function global:Release-Resources()
{
$global:HashData = $null;
$global:DiscData = $null;
$global:HealthSvc = $null;
$global:MomScriptAPIObject = $null;
$global:WSSAssembly = $null;
$global:EventObject = $null;
$global:EventAssembly = $null;
}
function global:Handle-Errors([System.Object] $Arguments)
{
if (! $error)
{
return;
}
$ErrMsg = "";
$IsExit = $true;
$IsReturn = $true;
$IsLog = $true;
if ("System.String" -eq $Arguments.GetType().FullName)
{
$ErrMsg = $Arguments;
}
else
{
$ErrMsg = $Arguments[0];
$IsExit = $Arguments[1];
if ($Arguments.Count -gt 2)
{
$IsReturn = $Arguments[2];
}
if ("" -eq $ErrMsg)
{
$IsLog = $false;
}
}
if ($IsLog.Equals($true))
{
$ErrorString = "";
if ($IsExit.Equals($false))
{
$ErrorString = $global:EventLog_Fail_On_Error -f $ErrMsg;
}
else
{
$ErrorString = $global:EventLog_Exit_On_Error -f $ErrMsg;
}
$Exception = $error[$error.Count - 1];
if ($Exception.InvocationInfo -ne $null)
{
$ErrorString += ($global:EventLog_Format -f [Environment]::UserName, $pid, $Exception.InvocationInfo.MyCommand,
$Exception.InvocationInfo.ScriptLineNumber, $Exception.InvocationInfo.OffsetInLine, $Exception.InvocationInfo.ScriptName,
$Exception.InvocationInfo.Line, $Exception.InvocationInfo.PositionMessage, $Exception.InvocationInfo.InvocationName,
$Exception.InvocationInfo.PipelineLength, $Exception.InvocationInfo.PipelinePosition);
}
if ($null -ne $Exception.Exception)
{
$Exception = $Exception.Exception;
}
$InnerException = $Exception;
if ($null -ne $Exception.InnerException)
{
$InnerException = $Exception.InnerException;
}
$global:EventObject.WriteEntry(($global:EventLog_Template -f $InnerException.GetType().FullName, $ErrorString, $Exception.Message), [System.Diagnostics.EventLogEntryType]::Error);
}
if ($IsExit.Equals($true))
{
if ($IsReturn.Equals($true))
{
Deliver-DiscoveryData($global:DiscData);
}
Release-Resources;
break;
}
$error.Clear();
}
function global:GetDebugSetting($DebugTrace)
{
if ($DebugTrace.ToUpper() -eq "TRUE")
{
$global:Debug = $True;
}
else
{
$global:Debug = $False;
}
}
$global:MomScriptAPIObject = new-object -comObject "MOM.ScriptAPI";
Handle-Errors($global:EventLog_Fail_Create_Discovery_ScriptAPI, $true, $false);
$global:WSSAssembly = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
if ($null -eq $global:WSSAssembly)
{
throw $global:EventLog_Exit_On_NonExist;
}
Handle-Errors("", $true, $false);
if ($WSSAssembly.GetName().Version.Major -ne 14)
{
Release-Resources;
break;
}
function global:Get-SharePointExtensionsLocation()
{
$Location = "";
$LM = [Microsoft.Win32.Registry]::LocalMachine;
$Key = $LM.OpenSubKey("SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0");
if ($null -eq $Key)
{
Write-Event(($global:EventLog_Fail_Retrieve_RegistryKey -f "SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0"), [System.Diagnostics.EventLogEntryType]::Error);
}
else
{
$Location = $Key.GetValue("Location", "");
if ("" -eq $Location)
{
Write-Event(($global:EventLog_Fail_Retrieve_RegistryKey -f "SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Location"), [System.Diagnostics.EventLogEntryType]::Error);
}
}
return $Location;
}
function global:IsServingAsWebServer()
{
if (([Microsoft.SharePoint.Administration.SPServerRole]::SingleServer -eq $global:LocalServer.Role) -or ([Microsoft.SharePoint.Administration.SPServerRole]::WebFrontEnd -eq $global:LocalServer.Role))
{
return $true;
}
elseif ([Microsoft.SharePoint.Administration.SPServerRole]::Application -eq $global:LocalServer.Role)
{
$WebServiceInstance = [Microsoft.SharePoint.Administration.SPWebServiceInstance]::LocalContent;
if (($null -ne $WebServiceInstance) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $WebServiceInstance.Status))
{
return $true;
}
}
return $false;
}
function global:Get-ServiceTimerJobs([string] $ServiceTypeName)
{
$Service = Get-Service($ServiceTypeName);
if ($null -eq $Service)
{
return $null;
}
return $Service.JobDefinitions;
}
function global:IsLocalTimerServiceRunning()
{
$ServiceInstance = Get-ServiceInstance($global:SPTimer);
if (($null -ne $ServiceInstance) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $ServiceInstance.Status))
{
return $true;
}
return $false;
}
function global:Create-SiteCollectionEx([Object] $WebApp)
{
$DefaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]::Default;
$AppPath = $WebApp.IisSettings[$DefaultZone].Path.ToString();
$Uri = $WebApp.GetResponseUri($DefaultZone).AbsoluteUri;
$Authentication = $WebApp.IisSettings[$DefaultZone].AuthenticationMode.ToString();
$WebAppName = $WebApp.DisplayName;
$SiteCollection = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSiteCollection']$");
$SiteCollection.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $global:DisplayName_SiteCollection);
$SiteCollection.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSiteCollection']/FarmID$", $global:FarmID);
$SiteCollection.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSiteCollection']/AppPath$", $AppPath);
$global:DiscData.AddInstance($SiteCollection);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPWebApplication.SPSiteCollection"), $false);
$WebApplication = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']$");
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/FarmID$", $global:FarmID);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/AppPath$", $AppPath);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/ResponseUri$", $Uri);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/Name$", $WebAppName);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/Authentication$", $Authentication);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/AppPool$", $WebApp.ApplicationPool.Name);
$WebApplication.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication']/AppUser$", $WebApp.ApplicationPool.Username);
$global:DiscData.AddInstance($WebApplication);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPWebApplication"), $false);
$WebAppSiteCollRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.Contains.SPSiteCollection']$");
$WebAppSiteCollRel.Source = $WebApplication;
$WebAppSiteCollRel.Target = $SiteCollection;
$global:DiscData.AddInstance($WebAppSiteCollRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPWebApplication.Contains.SPSiteCollection"), $false);
return $SiteCollection;
}
$global:SSWordViewer = "Microsoft.Office.Web.Environment.Sharepoint.ConversionService";
$global:SSPPTViewer = "Microsoft.Office.Server.PowerPoint.SharePoint.Administration.PowerPointWebService";
$global:SSExcel = "Microsoft.Office.Excel.Server.MossHost.ExcelServerWebService";
$global:SSVisio = "Microsoft.Office.Visio.Server.Administration.VisioGraphicsService";
$global:PathExcelPage = "template\layouts\xlviewer.aspx";
$global:PHWordViewer = "template\layouts\wordviewer.aspx";
$global:PHPPTViewer = "template\layouts\powerpoint.aspx";
$global:PHOneNoteEditor = "template\layouts\onenote.aspx";
$global:PHBroadcaster = "isapi\PowerPointBroadcastHost.asmx";
$global:BroadcastPath = "/_vti_bin/PowerPointBroadcastHost.asmx";
$global:BroadcastTemplate = "POWERPOINTBROADCAST";
</Script> </Contents>
</File>
<File>
<Name>WACSharedServiceDiscovery.ps1</Name>
<Contents><Script> .\WACDiscoveryLibrary.ps1 $Args[0] $Args[1]
GetDebugSetting $Args[3]
if ($global:Debug) { $global:dtStart = [DateTime]::Now }
if ($global:Debug) { Write-Event($global:EventLog_Debug_StartedArgs -f $MyInvocation.MyCommand, $Args[0], $Args[1], $Args[2], $Args[3]) }
.\WACSharedServiceStandard.ps1
$global:FarmID = "";
$global:ComputerName = $Args[2];
$global:DiscData = Create-DiscoveryData;
Get-Farm;
Get-LocalServer;
if ($null -ne $global:Farm)
{
$global:HostServer = $global:LocalServer.Name;
$global:FarmID = $global:LocalServer.Farm.Id.ToString();
$global:WebExtensionsPath = Get-SharePointExtensionsLocation;
$global:IsWebServer = IsServingAsWebServer;
$MainWebServer = IsMainServer($true);
Create-WACStandardSharedServiceInstance;
Create-ExcelSharedServiceInstance;
Create-ExcelPageComponentInstance;
if ($MainWebServer)
{
if ($global:Debug) { $global:EventLog_Debug_MajorServer -f $MyInvocation.MyCommand }
Create-WACStandardSharedService;
Create-ExcelSharedService;
}
}
Deliver-DiscoveryData($global:DiscData);
if ($global:Debug) { LogScriptTime($MyInvocation) }
Release-Resources;
</Script> </Contents>
</File>
<File>
<Name>WACSharedServiceStandard.ps1</Name>
<Contents><Script> function global:Create-ExcelPageComponentInstance()
{
if (("" -ne $global:WebExtensionsPath) -and ($global:IsWebServer))
{
$FullPath = $global:WebExtensionsPath + $global:PathExcelPage;
if ([System.IO.File]::Exists($FullPath))
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ComponentInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPComponentInstance.ExcelPage']$");
$ComponentInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $global:DisplayName_Excel_Page);
$ComponentInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/FarmID$", $global:FarmID);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/HostServer$", $global:HostServer);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/ComponentPath$", $FullPath);
$global:DiscData.AddInstance($ComponentInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPComponentInstance.ExcelPage"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPComponentInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ComponentInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPComponentInstance"), $false);
}
}
}
function global:Create-ExcelSharedService()
{
$Service = Get-Service($global:SSExcel);
if (($null -ne $Service) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $Service.Status))
{
$ServiceApps = $Service.Applications;
if (0 -lt $ServiceApps.Count)
{
$SSGroup = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']$");
$SSGroup.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']/FarmID$", $global:FarmID);
$SService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedService.Excel']$");
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/FarmID$", $global:FarmID);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/ServiceID$", $Service.Id.ToString());
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/TypeName$", $Service.GetType().FullName);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/NotShared$", "False");
$SService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $Service.TypeName);
$global:DiscData.AddInstance($SService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedService.Excel"), $false);
$SSGroupServiceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup.Contains.SPSharedService']$");
$SSGroupServiceRel.Source = $SSGroup;
$SSGroupServiceRel.Target = $SService;
$global:DiscData.AddInstance($SSGroupServiceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceGroup.Contains.SPSharedService"), $false);
foreach ($App in $ServiceApps)
{
if ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $App.Status)
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedServiceApplication.Excel"), $false);
$ServiceApplicationRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedService.Contains.SPSharedServiceApplication']$");
$ServiceApplicationRel.Source = $SService;
$ServiceApplicationRel.Target = $AppService;
$global:DiscData.AddInstance($ServiceApplicationRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedService.Contains.SPSharedServiceApplication"), $false);
}
}
}
}
}
function global:Create-ExcelSharedServiceInstance()
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ServiceInstance = Get-ServiceInstance($global:SSExcel);
if (($null -ne $ServiceInstance) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $ServiceInstance.Status))
{
$ServiceInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPServiceInstance.Excel']$");
$ServiceInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $ServiceInstance.TypeName);
$ServiceInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/FarmID$", $global:FarmID);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/HostServer$", $global:HostServer);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/TypeName$", $ServiceInstance.GetType().FullName);
$global:DiscData.AddInstance($ServiceInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPService.Excel"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPServiceInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPServiceInstance"), $false);
foreach ($App in $ServiceInstance.Service.Applications)
{
foreach ($Instance in $App.ServiceInstances)
{
if ($ServiceInstance.Id.ToString() -eq $Instance.Id.ToString())
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.Excel']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
$ApplicationServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication.Contains.SPServiceInstance']$");
$ApplicationServiceInstanceRel.Source = $AppService;
$ApplicationServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ApplicationServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceApplication.Contains.SPServiceInstance"), $false);
}
}
}
}
}
function global:Create-PPTViewerSharedService()
{
$Service = Get-Service($global:SSPPTViewer);
if (($null -ne $Service) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $Service.Status))
{
$ServiceApps = $Service.Applications;
if (0 -lt $ServiceApps.Count)
{
$SSGroup = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']$");
$SSGroup.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']/FarmID$", $global:FarmID);
$SService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedService.PPTViewer']$");
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/FarmID$", $global:FarmID);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/ServiceID$", $Service.Id.ToString());
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/TypeName$", $Service.GetType().FullName);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/NotShared$", "False");
$SService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $Service.TypeName);
$global:DiscData.AddInstance($SService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedService.PPTViewer"), $false);
$SSGroupServiceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup.Contains.SPSharedService']$");
$SSGroupServiceRel.Source = $SSGroup;
$SSGroupServiceRel.Target = $SService;
$global:DiscData.AddInstance($SSGroupServiceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceGroup.Contains.SPSharedService"), $false);
foreach ($App in $ServiceApps)
{
if ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $App.Status)
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedServiceApplication.PPTViewer"), $false);
$ServiceApplicationRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedService.Contains.SPSharedServiceApplication']$");
$ServiceApplicationRel.Source = $SService;
$ServiceApplicationRel.Target = $AppService;
$global:DiscData.AddInstance($ServiceApplicationRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedService.Contains.SPSharedServiceApplication"), $false);
}
}
}
}
}
function global:Create-WordViewerSharedService()
{
$Service = Get-Service($global:SSWordViewer);
if (($null -ne $Service) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $Service.Status))
{
$ServiceApps = $Service.Applications;
if (0 -lt $ServiceApps.Count)
{
$SSGroup = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']$");
$SSGroup.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup']/FarmID$", $global:FarmID);
$SService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedService.WordViewer']$");
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/FarmID$", $global:FarmID);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/ServiceID$", $Service.Id.ToString());
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/TypeName$", $Service.GetType().FullName);
$SService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPService']/NotShared$", "False");
$SService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $Service.TypeName);
$global:DiscData.AddInstance($SService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedService.WordViewer"), $false);
$SSGroupServiceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceGroup.Contains.SPSharedService']$");
$SSGroupServiceRel.Source = $SSGroup;
$SSGroupServiceRel.Target = $SService;
$global:DiscData.AddInstance($SSGroupServiceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceGroup.Contains.SPSharedService"), $false);
foreach ($App in $ServiceApps)
{
if ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $App.Status)
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedServiceApplication.WordViewer"), $false);
$ServiceApplicationRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedService.Contains.SPSharedServiceApplication']$");
$ServiceApplicationRel.Source = $SService;
$ServiceApplicationRel.Target = $AppService;
$global:DiscData.AddInstance($ServiceApplicationRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedService.Contains.SPSharedServiceApplication"), $false);
}
}
}
}
}
function global:Create-WordViewerComponentInstance()
{
$FullPath = $global:WebExtensionsPath + $global:PHWordViewer;
if ([System.IO.File]::Exists($FullPath))
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ComponentInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPComponentInstance.WordViewer']$");
$ComponentInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $global:DisplayName_WordViewer_Page);
$ComponentInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/FarmID$", $global:FarmID);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/HostServer$", $global:HostServer);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/ComponentPath$", $FullPath);
$global:DiscData.AddInstance($ComponentInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPComponentInstance.WordViewer"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPComponentInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ComponentInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPComponentInstance"), $false);
}
}
function global:Create-PPTViewerComponentInstance()
{
$FullPath = $global:WebExtensionsPath + $global:PHPPTViewer;
if ([System.IO.File]::Exists($FullPath))
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ComponentInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPComponentInstance.PPTViewer']$");
$ComponentInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $global:DisplayName_PPTViewer_Page);
$ComponentInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/FarmID$", $global:FarmID);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/HostServer$", $global:HostServer);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/ComponentPath$", $FullPath);
$global:DiscData.AddInstance($ComponentInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPComponentInstance.PPTViewer"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPComponentInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ComponentInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPComponentInstance"), $false);
}
}
function global:Create-OneNoteEditorComponentInstance()
{
$FullPath = $global:WebExtensionsPath + $global:PHOneNoteEditor;
if ([System.IO.File]::Exists($FullPath))
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ComponentInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPComponentInstance.OneNoteEditor']$");
$ComponentInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $global:DisplayName_OneNoteEditor_Page);
$ComponentInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/FarmID$", $global:FarmID);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/HostServer$", $global:HostServer);
$ComponentInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPComponentInstance']/ComponentPath$", $FullPath);
$global:DiscData.AddInstance($ComponentInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPComponentInstance.OneNoteEditor"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPComponentInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ComponentInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPComponentInstance"), $false);
}
}
function global:Create-WordViewerSharedServiceInstance()
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ServiceInstance = Get-ServiceInstance($global:SSWordViewer);
if (($null -ne $ServiceInstance) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $ServiceInstance.Status))
{
$ServiceInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPServiceInstance.WordViewer']$");
$ServiceInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $ServiceInstance.TypeName);
$ServiceInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/FarmID$", $global:FarmID);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/HostServer$", $global:HostServer);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/TypeName$", $ServiceInstance.GetType().FullName);
$global:DiscData.AddInstance($ServiceInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPService.WordViewer"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPServiceInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPServiceInstance"), $false);
foreach ($App in $ServiceInstance.Service.Applications)
{
foreach ($Instance in $App.ServiceInstances)
{
if ($ServiceInstance.Id.ToString() -eq $Instance.Id.ToString())
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.WordViewer']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedServiceApplication.WordViewer"), $false);
$ApplicationServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication.Contains.SPServiceInstance']$");
$ApplicationServiceInstanceRel.Source = $AppService;
$ApplicationServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ApplicationServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceApplication.Contains.SPServiceInstance"), $false);
}
}
}
}
}
function global:Create-PPTViewerSharedServiceInstance()
{
$ServerInst = $global:DiscData.CreateClassInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']$");
$ServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/ComputerID$", $global:ComputerName);
$ServerInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer']/FarmID$", $global:FarmID);
$ServiceInstance = Get-ServiceInstance($global:SSPPTViewer);
if (($null -ne $ServiceInstance) -and ([Microsoft.SharePoint.Administration.SPObjectStatus]::Online -eq $ServiceInstance.Status))
{
$ServiceInst = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPServiceInstance.PPTViewer']$");
$ServiceInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $ServiceInstance.TypeName);
$ServiceInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $global:ComputerName);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/FarmID$", $global:FarmID);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/HostServer$", $global:HostServer);
$ServiceInst.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServiceInstance']/TypeName$", $ServiceInstance.GetType().FullName);
$global:DiscData.AddInstance($ServiceInst);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPService.PPTViewer"), $false);
$ServerServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPServer.Contains.SPServiceInstance']$");
$ServerServiceInstanceRel.Source = $ServerInst;
$ServerServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ServerServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPServer.Contains.SPServiceInstance"), $false);
foreach ($App in $ServiceInstance.Service.Applications)
{
foreach ($Instance in $App.ServiceInstances)
{
if ($ServiceInstance.Id.ToString() -eq $Instance.Id.ToString())
{
$AppService = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']$");
$AppService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $App.Name);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/FarmID$", $global:FarmID);
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/ServiceApplicationID$", $App.Id.ToString());
$AppService.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication']/TypeName$", $App.GetType().FullName);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/ApplicationPool$", $App.ApplicationPool.Name);
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/ApplicationVersion$", $App.ApplicationVersion.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/IsShared$", $App.Shared.ToString());
$AppService.AddProperty("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSharedServiceApplication.PPTViewer']/Uri$", $App.Uri.ToString());
$global:DiscData.AddInstance($AppService);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SPSharedServiceApplication.PPTViewer"), $false);
$ApplicationServiceInstanceRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPSharedServiceApplication.Contains.SPServiceInstance']$");
$ApplicationServiceInstanceRel.Source = $AppService;
$ApplicationServiceInstanceRel.Target = $ServiceInst;
$global:DiscData.AddInstance($ApplicationServiceInstanceRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPSharedServiceApplication.Contains.SPServiceInstance"), $false);
}
}
}
}
}
function global:Create-BroadcastSiteCollection()
{
$ContentWeb = [Microsoft.SharePoint.Administration.SPWebService]::ContentService;
if (IsServingAsWebServer)
{
foreach ($WebApp in $ContentWeb.WebApplications)
{
$SiteCollection = $null;
foreach ($Site in $WebApp.Sites)
{
$RootWeb = $Site.RootWeb;
if ($null -ne $RootWeb)
{
if ($global:BroadcastTemplate -eq $RootWeb.WebTemplate)
{
if ($null -eq $SiteCollection)
{
$SiteCollection = Create-SiteCollectionEx($WebApp);
}
Create-BroadcastSite($Site, $SiteCollection);
}
}
$Site.Dispose();
}
}
}
}
function global:Create-BroadcastSite([Object] $Objects)
{
$Site = $Objects[0];
$SiteCollection = $Objects[1];
if ($null -ne $Site)
{
$RootWeb = $Site.RootWeb;
$BroadcastSite = $global:DiscData.CreateClassInstance("$MPElement[Name='Microsoft.SharePoint.Server.2010.SPSite.PPTBroadcast']$");
$BroadcastSite.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $RootWeb.Title);
$BroadcastSite.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSite']/FarmID$", $global:FarmID);
$BroadcastSite.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSite']/Url$", $RootWeb.Url + $global:BroadcastPath);
$BroadcastSite.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSite']/Title$", $RootWeb.Title);
$BroadcastSite.AddProperty("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSite']/Authentication$", $RootWeb.AuthenticationMode.ToString());
$global:DiscData.AddInstance($BroadcastSite);
Handle-Errors(($global:EventLog_Fail_Create_Class -f "SSPSite.PPTBroadcast"), $false);
$SiteCollectionBroadcastRel = $global:DiscData.CreateRelationshipInstance("$MPElement[Name='WSS!Microsoft.SharePoint.Foundation.2010.SPWebApplication.SPSiteCollection.Contains.SPSite']$");
$SiteCollectionBroadcastRel.Source = $SiteCollection;
$SiteCollectionBroadcastRel.Target = $BroadcastSite;
$global:DiscData.AddInstance($SiteCollectionBroadcastRel);
Handle-Errors(($global:EventLog_Fail_Create_Relationship -f "SPWebApplication.SPSiteCollection.Contains.SPSite"), $false);
}
}
function global:Create-WACStandardSharedService()
{
Create-WordViewerSharedService;
Create-PPTViewerSharedService;
}
function global:Create-WACStandardSharedServiceInstance()
{
Create-WordViewerSharedServiceInstance;
Create-PPTViewerSharedServiceInstance;
if (("" -ne $global:WebExtensionsPath) -and ($global:IsWebServer))
{
Create-WordViewerComponentInstance;
Create-PPTViewerComponentInstance;
Create-OneNoteEditorComponentInstance;
}
}
</Script> </Contents>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>