Now that we have seen the theory, let's go
to the lab and look at how to get the
SharePoint Online PnP PowerShell module,
as well as how to connect to SharePoint
Online using this PnP module. We are now
in the live environment so let me open up
the browser here, and I will search for
SharePoint Online and this time we will
pick the SharePoint PnP PowerShell Online.
Something to really be aware of is that
the PnP module also works for on-premises
SharePoint so if you search for SharePoint
PnP, you'll see SharePoint PnP Online,
PowerShell 2016 and 2013 so make sure that
if you want to connect to Online, you
connect to SharePoint PnP PowerShell
Online. Again, we have the PowerShell
cmdlet here needed to install. It makes it
super easy for us. I will just copy it and
I will paste it in the PowerShell as an
administrator. It seems like it didn't
like me the first time so let me copy and
paste again. Again, it might ask me if I
trust that repository; I'm just going to
say yes. It will take a few seconds, and
it will get installed. Awesome! It
finished installing, now let's connect. I
already have my credential variable from
the previous demo so I'm not going to go
through that step again. I'm only going to
run a Connect-PnPOnline, then I will give
it the URL, which first of all, let's
connect to the SharePoint Online admin
center here. So I will copy this one and
the credentials will be my cred variable.
It will take a few seconds; now I'm
connected. Then I can run things such as
Get-PnPSite for example, and it will show
me the site that I'm currently connected
to. Now if I want to connect to a site
collection, I can simply run a
disconnect-pnp online, and then I'll run
another Connect-PnPOnline, give it the
URL, and this time I just want to show you
that we can actually only connect to a
specific site collection. So I can type in
the URL of that site collection, give it
the credentials here, and it will also
work. So really, with PnP we don't always
connect to the tenant; we only connect to
the tenant if we want to, let's say,
manage all of the different sites if we
want to create site collections or things
like that. But if we only want to manage
content inside a site, we simply connect
to that site, and then I can do, for
example, Get-PnPList, which will show me
all of the different lists inside that
site collection. This is it for this demo.
We have looked at how to go to the partial
gallery, install the SharePoint Online PnP
PowerShell module, and how to connect to
SharePoint Online using this module to
both the admin center, as well as a
specific site collection. Remember that
this is only how to connect, and we're
going to cover a ton of different things
that we can do with both PowerShell
modules we have looked at in the following modules of this course.