Posted On July 24, 2020

Quick Script to Test SharePoint Online Credentials

kimconnect 0 comments
blog.KimConnect.com >> Codes >> Quick Script to Test SharePoint Online Credentials
$principle = "[email protected]"  
$password = 'PASSW0RT'  
$sharePointUrl = "https://SOMESHAREPOINT.COM/SitePages/Home.aspx"  

$credential=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $principle,$(ConvertTo-securestring $password -AsPlainText -Force)
$moduleName='Microsoft.Online.SharePoint.PowerShell'
if (!(get-module $moduleName -ea SilentlyContinue)){Install-Module -Name $moduleName -Force}
Connect-SPOService -Url $sharePointUrl -Credential $credential

Possible Errors:

# This error occurs if the SharePoint site has not automated login enabled

#Connect-SPOService : Cannot contact web site 'https://ORGNAME.sharepoint.com/' or the web site does not support
#SharePoint Online credentials. The response status code is 'Unauthorized'. The response headers are
#'X-SharePointHealthScore=3, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+f
#irst+browse+to+the+web+site+and+select+the+option+to+login+automatically.,
#SPRequestGuid=, request-id=,
#MS-CV=n2lJ3FpgAABhdghow6/LIg.0, Strict-Transport-Security=max-age=31536000, SPRequestDuration=15, SPIisLatency=0,
#MicrosoftSharePointTeamServices=16.0.0.20308, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly,
#Content-Length=0, Content-Type=text/plain; charset=utf-8, Date=30 Feb 2012 20:08:25 GMT, P3P=CP="ALL IND DSP COR
#ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI", Server=Microsoft-IIS/10.0,
#X-Powered-By=ASP.NET'.
#At line:1 char:1
#+ Connect-SPOService -Url $sharePointUrl -Credential $credential
#+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], NotSupportedException
#    + FullyQualifiedErrorId : System.NotSupportedException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOService

Related posting:

PowerShell: Create Mailbox Report on Office 365

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Get All Hyper-V Host Spectre Patch Versions

# getAllVmSpectrePatchVersions.ps1 function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 =…

How To Improve WordPress Website Rendering Speed

These are the recommended plug-ins to enable caching, database cleaning, image compressing, and minify codes…

Script to use WinRAR for backups

REM winrar_backup.batecho offSET FNAME=KIMCONNECTSET LOGFILE=\\FILESERVER01\backup\ads-02-backup.txtIF EXIST V:\ (NET USE V: /DELETE)net use v: \\FILESERVER01\backupIF %ERRORLEVEL%…