Using AMO to set Server Properties

  • It is easy to use AMO via Powershell or C# to get server properties but even though the docs say that there are also setters for these properties, they don't seem to do anything?

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") | Out-Null;
    [Microsoft.AnalysisServices.Server] $srv = New-Object Microsoft.AnalysisServices.Server;
    [string]$ServerName = "Server\Instance";
    $srv.Connect($ServerName);
    $srv.ServerProperties.Item("DSO\LocksDirectory").Value = "D:"
    $srv.ServerProperties.Item("DSO\LocksDirectory")
    $srv.Disconnect();

    This returns empty, nomatter what property I try to set and there are no changes if I look in SSMS either. Has anyone managed to ser properties? The user doing this is an Administrator on the server instance. Same problem in C#.

  • Answering my own question.

    It works if you use, after setting the property:

    $srv.Update()

    For some reason, this method, along with others like .Connect() is missing from the curent docs on the MS website for some reason.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply