1

I want to disable "Require Use Remote Interfaces permission" of web application using power shell script.

  • Are you looking to accomplish using the CSOM and remote management tooling i.e. PowershellOnline module? I've looked at the reflector and noticed that functionality is not exposed directly via any public interface, so your only option is to use Reflection if you can execute your script on the SharePoint server (obviously this only works for On-Prem). – Roman Nov 26 '15 at 7:10
2

I was not able to find any way to do that using the standard either PowerShell SnapIn or the CSOM/REST, so i looked under the covers. From tracing the code in the code-behind of that AuthenticationPage in the CA, here is a script that does decent job via Reflection.

Param( 
    [parameter(Mandatory=$true,ValueFromPipeline=$true)]
    [Microsoft.SharePoint.Administration.SPWebApplication] $webapp,

    [Parameter(Mandatory=$true)]
    [Microsoft.SharePoint.Administration.SPUrlZone] $zone,

    [Parameter(Mandatory=$true)]
    [bool] $RequiresUseRemoteAPIsPermission
)
[Microsoft.SharePoint.Administration.SPIisSettings] $newIisSettings = New-Object Microsoft.SharePoint.Administration.SPIisSettings

[Microsoft.SharePoint.Administration.SPIisSettings] $originalSettings = $webapp.IisSettings[$zone]

$nonPublicInstanceMethodBindingFlags = [Reflection.BindingFlags] "NonPublic,Instance"
$copyFromMethod = $newIisSettings.GetType().GetMethod("CopyFrom", $nonPublicInstanceMethodBindingFlags)
$copyFromMethod.Invoke($newIisSettings, $originalSettings)

$newIisSettings.ClientObjectModelRequiresUseRemoteAPIsPermission = $RequiresUseRemoteAPIsPermission

$UpdateAuthenticationSettingsMethod = $webapp.GetType().GetMethods($nonPublicInstanceMethodBindingFlags) |
    ?{ $_.Name -eq 'UpdateAuthenticationSettings' -and $_.GetParameters().Count -eq 2 }
$UpdateAuthenticationSettingsMethod.Invoke($webapp, @($zone, $newIisSettings));

This PowerShell script can only execute on the SharePoint server itself with Microsoft.SharePoint.PowerShell Snap-In running but it'll do the trick.

  • Just as I posted that last night, I did find a REST/CSOM call that can enable/disable the permission requirement at the Site Collection level. SP.Site.updateClientObjectModelUseRemoteAPIsPermissionSetting – Roman Nov 30 '15 at 18:13
  • This just saved my bacon. I had unchecked "Require Use Remote Interfaces permission" for the auth provider on central admin and I could no longer access central admin. Using the script above I was able to reset it. Then I had to do an IISRESET to get back in. Thanks!!! – Kirk Liemohn Oct 4 '16 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.