Pages

Showing posts with label SharepointOnline Powershell. Show all posts
Showing posts with label SharepointOnline Powershell. Show all posts

Wednesday, June 26, 2024

Set-ExecutionPolicy

 The Set-ExecutionPolicy cmdlet change the user preference for the Windows PowerShell execution policy.


Set-ExecutionPolicy [-ExecutionPolicy*] {Unrestricted | RemoteSigned | AllSigned | Restricted | Default | Bypass |Undefined} [[-Scope] {Process | CurrentUser | LocalMachine | UserPolicy | MachinePolicy}] [-Confirm] [-Force][-WhatIf] [<CommonParameters>]


Examples

Set the shell execution policy:


PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned


The command uses the Force parameter to suppress the user prompt.


Set the scope for an execution policy:


PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned -Force

PS C:\> Get-ExecutionPolicy -List



Remove the execution policy for the current user:


PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Undefined

Other Issues:

When you run an .ps1 PowerShell script you will get the message saying “.ps1 is not digitally signed. The script will not execute on the system.”


To fix this issue you have to run the following command to run Set-ExecutionPolicy and change the Execution Policy setting.


Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass


Monday, August 16, 2021

Access denied to Style library on SharePoint Online while create new folder or uploading files

 

Issue Details

we faced an issue when trying to create fodler and Files

Cause


when futher investigating, The Modern Sites and scripting not allowing updating Site property bag.

Resolution


Run this scrip then you can create folder and upload files

1. Connect to the Site using SharePoint Management PowerShell as shown in the below command line.

Connect-SPOService -Url https://<tenantname>-admin.sharepoint.com




2. Run the below script to turn off NoScript on the modern site. After sucess, try to upload images to Style library and it should work fine.

Set-SPOSite -Identity https://<SiteUrl> -DenyAddAndCustomizePages 0



Thursday, February 22, 2018

Remove-SPODeletedSite - Sharepoint Online site from Recycle bin


1.Connect Sharepoint Online via SPO Service

Connect-SPOService -Url https://TenantName-admin.sharepoint.com/

Example:

Go to your Sharepoint Admin center and copy URL

Connect-SPOService -Url https://LiveSolution-admin.sharepoint.com/

2. Enter Login Credentials.

3.Execute this command and Enter Y

Remove-SPODeletedSite -Identity https://LiveSolution.sharepoint.com/sites/Testing

Site will be removed immediately from Recycle Bin.