Msinger
Msinger

Reputation: 59

connecting PowerShell to SharePoint 365 online

I'm trying to connect to SharePoint 365 online through PowerShell and I keep getting this error:enter image description here

this is what I entered, I need to be able to write scripts on SharePoint.

$adminUPN="***@***.com"
$orgName="****"
$userCredential = Get-Credential -UserName $adminUPN -Message "*******"
Connect-SPOService -Url https://******** -Credential $userCredential

Upvotes: 0

Views: 656

Answers (2)

tinamou
tinamou

Reputation: 2292

For improving your productivity with SharePoint Online PowerShell scripts use: SharePointPnP.PowerShel

Install:

If you main OS is Windows 10, or if you have PowerShellGet installed, you can run the following commands to install the PowerShell cmdlets:

Install-Module SharePointPnPPowerShellOnline

Usage:

Connect:

Connect-PnPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)

Create list:

New-PnPList -Title "Demo List" -Url "DemoList" -Template Announcements

Commands Documentation

All commands documentation

Upvotes: 0

andresm53
andresm53

Reputation: 2083

Before you get started using PowerShell to manage SharePoint Online, make sure that the SharePoint Online Management Shell is installed. Install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell setup. To open the SharePoint Online Management Shell command prompt, from the Start screen, type sharepoint, and then click SharePoint Online Management Shell.

Upvotes: 2

Related Questions