Thursday, July 6, 2023
HomeSoftware TestingMastering SharePoint PowerShell: A Complete Information

Mastering SharePoint PowerShell: A Complete Information


On this article, we delve into the world of SharePoint PowerShell, exploring its capabilities for environment friendly administration, automation, and customization. Be a part of us as we unlock the total potential of SharePoint by the ability of PowerShell, empowering you to successfully handle and optimize your SharePoint surroundings.

How one can Set up the SharePoint PowerShell On-line Module?

To put in the PowerShell SharePoint On-line module, you possibly can comply with these steps:

  • Open a PowerShell session with administrative privileges.
  • Run the next command to put in the SharePoint On-line Administration Shell module:
Set up-Module -Title Microsoft.On-line.SharePoint.PowerShell
Mastering SharePoint Management with PowerShell: A Comprehensive Guide
  • If prompted to put in from an untrusted repository, you possibly can proceed by typing “Y” and urgent Enter.
  • Look forward to the module to be downloaded and put in in your system.
  • As soon as the set up is full, you possibly can import the module utilizing the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
How to Install the PowerShell SharePoint Online Module?
  • This can make the SharePoint On-line cmdlets accessible to be used in your PowerShell session.

After putting in and importing the module, you possibly can connect with SharePoint On-line utilizing the Join-SPOService cmdlet and begin managing your SharePoint On-line surroundings by PowerShell.

How one can Join with PowerShell SharePoint On-line?

Administrator Account with out MFA

To connect with SharePoint On-line utilizing PowerShell with an administrator account that doesn’t have multi-factor authentication (MFA) enabled, you possibly can comply with these steps:

  • Open a PowerShell session with administrative privileges.
  • Import the SharePoint On-line Administration Shell module by operating the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
Administrator Account without MFA
  • Connect with SharePoint On-line by operating the next command:
Join-SPOService -Url "https://your-domain-admin.sharepoint.com" -Credential (Get-Credential)
Administrator Account without MFA
  • Change the area URL abovea with the URL of your SharePoint On-line administration web site.
  • When prompted, enter the credentials of the administrator account that doesn’t have MFA enabled. This can set up a connection to SharePoint On-line.

After efficiently connecting, you need to use the SharePoint On-line cmdlets to handle your SharePoint surroundings utilizing PowerShell.

Administrator Account with MFA

  • Open a brand new PowerShell session.
  • Run the next instructions to connect with SharePoint On-line:
# Import the required modules 
Import-Module -Title SharePointPnPPowerShellOnline 

# Connect with SharePoint On-line 
Join-PnPOnline -Url "https://your-domain.sharepoint.com/websites/your-site" -UseWebLogin
Administrator Account with MFA
  • Change the area identify with the URL of your SharePoint On-line web site.
  • An indication-in dialog field will seem, prompting you to authenticate together with your administrator account. Comply with the prompts to finish the authentication course of, together with any MFA verification steps.

PowerShell SharePoint Module Administration

Making a New SharePoint Website

To create a brand new SharePoint web site utilizing PowerShell and the SharePoint On-line Administration Shell, you possibly can comply with these steps:

  • Open PowerShell with administrative privileges.
  • Import the SharePoint On-line Administration Shell module by operating the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
Making a New SharePoint Site
  • Connect with your SharePoint On-line surroundings by operating the next command:
Join-SPOService -Url https://your-domain-admin.sharepoint.com
Making a New SharePoint Site
  • Change the instance area above with the URL of your SharePoint On-line admin web site.
  • Create a brand new SharePoint web site utilizing the New-SPOSite cmdlet. Specify the required parameters for the brand new web site, such because the title, URL, template, and storage quota. Right here’s an instance command:
New-SPOSite -Title "New Website" -Url https://your-domain.sharepoint.com/websites/newsite -Template "STS#0" -StorageQuota 1000
Making a New SharePoint Site
  • Change the instance area given above with the specified URL to your new web site. You can too customise the opposite parameters as per your necessities.
  • PowerShell will immediate you to supply your SharePoint On-line administrator credentials. Enter the username and password to your administrator account.
  • As soon as the command executes efficiently, the brand new SharePoint web site might be created.

Website Group Technology

To generate web site teams utilizing PowerShell and the SharePoint On-line Administration Shell, you possibly can comply with these steps:

  • Open PowerShell with administrative privileges.
  • Import the SharePoint On-line Administration Shell module by operating the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
Site Group Generation
  • Connect with your SharePoint On-line surroundings by operating the next command:
Join-SPOService -Url https://your-domain-admin.sharepoint.com 
Site Group Generation
  • Change the instance area given above with the URL of your SharePoint On-line admin web site.
  • Retrieve the SharePoint web site the place you need to generate the teams by operating the next command:
$web site = Get-SPOSite -Identification https://your-domain.sharepoint.com/websites/yoursite 
Site Group Generation
  • Change the instance area given above with the URL of the goal SharePoint web site.
  • Generate a brand new SharePoint group utilizing the New-SPOSiteGroup cmdlet. Specify the required parameters for the group, such because the identify, proprietor, and permissions. Right here’s an instance command:
New-SPOSiteGroup -Website $web site -Group "New Group" -Proprietor "proprietor@your-domain.onmicrosoft.com" -PermissionLevels "Learn", "Contribute"
Site Group Generation
  • Change “New Group” with the specified identify to your group, and the instance mail deal with with the e-mail deal with of the group proprietor. You can too customise the permission ranges based mostly in your necessities.
  • Repeat the earlier step for every group you need to generate.

Making Website Customers Lists

To create web site consumer lists utilizing PowerShell and the SharePoint On-line Administration Shell, you possibly can comply with these steps:

  • Open PowerShell with administrative privileges.
  • Import the SharePoint On-line Administration Shell module by operating the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
Making Site Users Lists
  • Connect with your SharePoint On-line surroundings by operating the next command:
Join-SPOService -Url https://your-domain-admin.sharepoint.com
Making Site Users Lists
  • Change the instance URL with the URL of your SharePoint On-line admin web site.
  • Retrieve the SharePoint web site the place you need to create the consumer checklist by operating the next command:
$web site = Get-SPOSite -Identification https://your-domain.sharepoint.com/websites/yoursite
Making Site Users Lists
  • Change the area identify with the URL of the goal SharePoint web site.
  • Create a brand new SharePoint checklist utilizing the New-SPOList cmdlet. Specify the required parameters for the checklist, such because the title and template sort. Right here’s an instance command to create a customized checklist:
New-SPOList -Website $web site -Title "Person Checklist" -Template "Customized Checklist"
Making Site Users Lists
  • Change “Person Checklist” with the specified title to your checklist and “Customized Checklist” with the suitable template sort.

Blacklist Customers from Website Teams

To blacklist customers from SharePoint web site teams utilizing PowerShell and the SharePoint On-line Administration Shell, you possibly can comply with these steps:

  • Open PowerShell with administrative privileges.
  • Import the SharePoint On-line Administration Shell module by operating the next command:
Import-Module -Title Microsoft.On-line.SharePoint.PowerShell
Blacklist Users from Site Groups
  • Connect with your SharePoint On-line surroundings by operating the next command:
Join-SPOService -Url https://your-domain-admin.sharepoint.com
Blacklist Users from Site Groups
  • Change “https://your-domain-admin.sharepoint.com” with the URL of your SharePoint On-line admin web site.
  • Retrieve the SharePoint web site the place the location group exists by operating the next command:
$web site = Get-SPOSite -Identification https://your-domain.sharepoint.com/websites/yoursite
Blacklist Users from Site Groups
  • Change the instance hyperlink with the URL of the goal SharePoint web site.
  • Retrieve the location group from which you need to blacklist customers by operating the next command:
$group = Get-SPOSiteGroup -Website $web site -Identification "Group Title"
Blacklist Users from Site Groups
  • Change “Group Title” with the identify of the location group.
  • Retrieve the consumer(s) that you just need to blacklist from the location group by operating the next command:
$consumer = Get-SPOUser -Website $web site -LoginName "consumer@area.com"
Blacklist Users from Site Groups
  • Change the instance electronic mail deal with with the login identify of the consumer you need to blacklist.
  • Add the consumer(s) to thwe blacklist of the location group by operating the next command:
Set-SPOSiteGroup -Website $web site -Group $group -DenyAddAndCustomizePages -AddUserOnly -AddUser $consumer 
Blacklist Users from Site Groups
  • This command provides the consumer(s) to the location group blacklist, stopping them from including or customizing pages within the web site.

PowerShell SharePoint On-line Automation

PowerShell SharePoint On-line automation refers to using PowerShell scripting to automate duties and operations in SharePoint On-line, which is a part of the Microsoft 365 suite. PowerShell offers a strong and environment friendly option to handle and administer SharePoint On-line, permitting you to carry out varied actions programmatically.

PowerShell SharePoint On-line automation helps you save time, improve effectivity, and preserve consistency in managing your SharePoint On-line surroundings. It’s notably helpful for organizations with complicated or large-scale SharePoint deployments that require frequent administration and upkeep duties.

With PowerShell SharePoint On-line automation, you possibly can streamline and expedite frequent administrative duties, carry out bulk operations, implement governance insurance policies, and obtain constant configurations throughout your SharePoint On-line surroundings. Listed below are some examples of what you possibly can automate:

  1. Website provisioning
  2. Checklist and library administration
  3. Person and group administration
  4. Content material migration
  5. Website customization
  6. Workflow automation
  7. Reporting and monitoring

To carry out SharePoint On-line automation utilizing PowerShell, you must set up the SharePoint On-line Administration Shell module and set up a connection to your SharePoint On-line surroundings utilizing the Join-SPOService cmdlet. As soon as related, you need to use varied SharePoint On-line cmdlets to work together with websites, lists, customers, permissions, and extra.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments