Had a need to run CRM powershell on an On-premise CRM Server.
I’ve had this same issue before where any powershell command you run against the Microsoft.Crm.PowerShell provider fails with authentication errors.
In this example, i was trying to run this and it barfed on Get-CrmSetting ….
Add-PSSnapin Microsoft.Crm.PowerShell $ClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings $ClaimsSettings.Enabled = $true Set-CrmSetting -Setting $ClaimsSettings
Turned out to fix it, i needed to add a registry key. After i did this it worked straight away (no need to reboot or reopen the PS window).
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] "DisableLoopbackCheck"=dword:00000001
Method 2 in this article: