2025-11-28 00:35:46 +09:00

34 lines
1.5 KiB
PowerShell

###############################################################################
# Configures Management OData web service endpoint using the Basic plugins
# sample
###############################################################################
# Test for presence of Microsoft.Samples.Management.OData.BasicPlugins.dll
$assemblyName = ".\Microsoft.Samples.Management.OData.BasicPlugins.dll"
$customPluginAssembly = $assemblyName
if (!(Test-Path $customPluginAssembly))
{
$customPluginAssembly = "..\bin\Debug\$assemblyName"
if (!(Test-Path $customPluginAssembly))
{
$customPluginAssembly = "..\bin\Release\$assemblyName"
if (!(Test-Path $customPluginAssembly))
{
throw "ERROR: Custom plugin assembly $assemblyName not found. Please either put it in the current folder or build the sample (so that it can be picked from bin folder)";
}
}
}
# Installing Management OData optional component
Write-Host "Installing Management OData Service..."
.\installModata.ps1
# Setting up web service endpoint
Write-Host "Setting up web service endpoint..."
.\SetupIISConfig.ps1 -site MODataSvc -path $env:HOMEDRIVE\inetpub\wwwroot\Modata -cfgfile .\Web.config -port 7000 -app MODataSvc -svc .\Microsoft.Management.Odata.svc -schema .\Schema.mof -dispatchXml .\Schema.xml -customPluginAssembly $customPluginAssembly
Write-Host "Web Service endpoint is setup. The source root URI is http://localhost:7000/MODataSvc/Microsoft.Management.Odata.svc"