Questions tagged [powershell]
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.[except from WikiPedia]
4,151 questions
0
votes
0
answers
53
views
How to get a permissions matrix re[port of all SharePoint sites and document libraries in the tenant
I'm trying to get the below powershell script to work but getting this error :
The term 'Get-PnPRoleAssignment' is not recognized as a name of a cmdlet
It seems this command does not exist and if not ...
0
votes
1
answer
73
views
Get list of all Owners in SharePoint Tenant
My company has roughly 200 SP sites (SharePoint Online only) in its Tenant, and many have users as Owners - who shouldn't be in that group. I need to query the entire Tenant and generate a report of ...
0
votes
1
answer
97
views
import export list from two different SharePoint Online sites using PnP Powershell
I'm looking for a way to import a sharepoint list of a sharepoint site and export it into another destination.
I looked at this Powershell PnP commands
I don't want the CopyList as i need to have the ...
0
votes
0
answers
35
views
error "the data area passed to a system call is too small - (When using SharePoint Designer to login into SharePoint Online)
I know this issue is not common.
But has anyone tried to login in into SharePoint Online using SharePoint Designer.
The site is still using the classic layout and pages.
When i try 'm getting the ...
0
votes
0
answers
13
views
SharePoint External Links audit
0
Good afternoon!
I have a task to create a PowerShell code to check all shared links from our SharePoint site, regardless of when they were created. The current limit is 180 days. Is it possible to ...
0
votes
1
answer
464
views
How i can get all the retension policies applied to a SharePoint Online site, either inside list, list content type or site content type
I am a SharePoint office 365 admin inside a tenant, and i am working on 2 communication sites. now i want to review all the retention polices applied to the sites either inside :-
List or Library
...
0
votes
0
answers
123
views
How do I export the Crawl log using PowerShell of a SharePoint Subscription on-prem setup?
I'm trying to export the crawler log as shown in the CrawlLogURLExplorer-section in the Search Service Application - Diagnostics - Crawl Log from our productions system for our developers to use for ...
0
votes
0
answers
75
views
How do I use PnP to move large amounts of files without breaking sharing links and permissions?
I'm trying to find an archiving solution for my company that's easier than using the GUI and scrolling through large amounts of files and folders and manually using the Move To button. I have written ...
2
votes
1
answer
409
views
How do I find out what kind of access a user has to a SharePoint Online site using PNP PowerShell?
In Powershell, after running the Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/xyz -UseWebLogin and Get-PnPUser -WithRightsAssigned commands, I can get the list of all users that have ...
0
votes
1
answer
175
views
Set-PnPSiteVersionPolicy for thousands of sites in SharePoint Online - Cannot call this API with an app-only principal
We have 5000+ SharePoint Online sites in our tenant where i have to change the Site Version setting to automatic for all existing document libraries.
I am using the below to connect using an Azure App ...
1
vote
0
answers
117
views
remove Everyone and Everyone Except External Users from all places in an SPO Sites
Requirement:
One of our Clients is working on correcting permissions on there tenant and thus needs to remove "Everyone" and "Everyone except external users" from identified places ...
0
votes
1
answer
63
views
Read the site collection URLs in CSV file and replace/add the Email ID.in the "Allow access requests" settings
I want to read CSV file which consist of Site collection URLs and replace the "Allow access requests" email ID.
In CSV file, I have data like below.
SiteURL - ColumnName
https://example.com/...
1
vote
0
answers
107
views
Map SharePoint libraries in different tenants and copy files between them
I’m trying to accomplish a task regarding file copy from one Sharepoint document library within a site in one tenant (Sharepoint On-premisses) to a document library within another sharepoint site in ...
0
votes
1
answer
102
views
View search results impersonating another user in SharePoint Subscription Edition
I am looking for a way to (even programmatically) impersonate users in my SharePoint Subscription Edition farm, and view search results on their behalf with their permissions, not my own elevated ...
2
votes
2
answers
551
views
New site title is not propagating to group or team name if renamed programmatically
When I programmatically change the title of a group-based site using PowerShell, the site gets the new name, but the associated Microsoft 365 group does not. Furthermore, when you log in to the site, ...
0
votes
1
answer
47
views
How to count documents inheriting permissions on site, library and folder level by powershell?
How to count the documents inheriting from a specific level like the site, document library or folder by powershell?
For example, I have a site with 100 documents total seperated over multiple ...
0
votes
2
answers
263
views
How to count all files recursive inside a specific folder programmatically in powershell?
How can I count all files recursive inside a specific folder in a document library by powershell? So he needs to count also the files inside the subfolders recursive.
1
vote
1
answer
154
views
Download SharePoint Custom Form (Power Apps)
I want to download a SPO custom form via Powershell.
I´ve tried command below but get an error message, which says there is no canvas app in this enviroment which is the default enviroment. A download ...
0
votes
2
answers
520
views
Import custom data from excel to sharepoint List in powershell
I come from sharepoint 2019 and i try to import data from excel to a list
It's working fine for date and text datas
But i don't understand about unique choice, checkbox or People picker fields.
my ...
0
votes
0
answers
560
views
Error : The remote server returned an error : (404) Not found when using Copy-PnPFolder powershell
I have been using the Copy-PnPFolder to copy files between sharepoint sites.
But just suddenly i started receiding this error
: The remote server returned an error : (404) Not found
This is how i ...
0
votes
1
answer
494
views
Can I use the Copy-PnPFolder to copy local files to SharePoint?
I'm trying to use the command below to copy local files to SharePoint.
Copy-PnPFolder -LocalPath "C:\Projects\BS\Banner.zip" -TargetUrl "https://Demo.sharepoint.com/sites/Demo/Documents&...
0
votes
1
answer
3k
views
PnP Powershell Connection with ClientId and ClientSecre return error "The app principal does not exist"
I'm trying to run my Powershell PnP script using ClientId and ClientSecret instead of UseWebLogin.
I already created an Azure Application ID using this tutorial (but skipping the certificate part for ...
0
votes
1
answer
576
views
Find large files and folders exceeding 400 characters limits
We have a large file server with files and folders that we need to migrate to SharePoint Online. In SharePoint Online, we have a limitation of 400 characters URL limit and a large number of our ...
0
votes
2
answers
903
views
Script to empty 1st & 2nd stage recycling bins from all sites in SharePoint
I'm looking for a way to automate emptying the recycling bins (1st & 2nd stage) from all sites in our SharePoint (Online) collection.
From searching, I've found solutions that no longer work (...
1
vote
2
answers
691
views
PowerShell script to overwrite copy folder and all folders and files inside SharePoint library
This is the first PowerShell-script I ever wrote.
I want to keep digging into the folder 10 times. Is there a better way to do this than my way to keep repeating?
Here is the script:
# Connect
Connect-...
1
vote
1
answer
555
views
Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation
I need your help. I am trying to create an assets library and always get the following error:
Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation.
I am already registered as ...
0
votes
0
answers
251
views
Power Automate Trigger Condition Action rate limit is exceeded;
I have a column named "Tracking Number" in my SharePoint library, and I want to run a flow only when the Tracking Number contains a semicolon.
The issue is that I built a flow to replace ...
1
vote
1
answer
556
views
Restrict PnPSearchQuery to just site and subsites not all tenant sites
I had a request from some co-workers to build them a PowerShell to search sites for instances of text that is not accessible so they can replace it. Specifically NA or N/A.
I have a PowerShell working ...
0
votes
0
answers
331
views
PnP PowerShell - Update list fields from CSV file
I have the following code and it has been working. Now our company merged and my computer is with the new company domain. New company don't have access to our SharePoint and it seems like it also want ...
1
vote
1
answer
2k
views
what's the best way to get all Teams owners and members
Is there a way from admin center to export all teams owners and members to a CSV file?
I can't run the following code b/c I think it depends on graph api and it might be blocked.
# PowerShell script ...
0
votes
1
answer
337
views
Programmatically get shareable link to updated folder (PowerShell)
My goal is to upload approximately 10,000 folders to a SharePoint library (call it T2) and create a list in SharePoint (say T1) that lists these folders along with other details and their ...
1
vote
2
answers
2k
views
How can I use PnP Powershell to enable custom script in a subsite?
My problem is enabling custom script with DenyAddAndCustomizePages.
A two-line script can describe my problem.
Background: I was using Set-SPOSite to enable it like this:
Set-SPOSite $SiteURL -...
0
votes
1
answer
120
views
Copy site root libraries and sub libraries with all permission using Get-PnPSiteTemplate
Our SharePoint sites have yearly structure like 2024->subfolders. When I use below PowerShell code to copy existing site template to new site then I am getting only root folders created. Each root ...
1
vote
0
answers
25
views
How to reference mapping file in SharePoint to sgus [closed]
In ShareGate, anyone knows how to map users to a file instead of writing out each user mapping in the PowerShell script?
Found the answer. pls delete.
0
votes
1
answer
60
views
SharePoint online default templates
I created 50 pages using the SharePoint online template called Blank. This has a header / title webpart at the top which we do not want.
Does anyone know of a way to remove this webpart from all the ...
0
votes
1
answer
371
views
how to upload a file to a document library using OData in PowerShell with curl or Invoke-RestMethod
As I cannot use Pnp.PowerShell with a SharePoint-2019 on premise, AFAIK, I've been trying workd with OData instead, using curl (or PowerShell Invoke-RestMethod or falling back to JavaScript fetch if ...
0
votes
0
answers
83
views
How to Restrict Default User Permissions for New Public Sites in SharePoint Online?
SharePoint Online admin here. In our organization there are several thousand users and even more SPO sites. We are trying to tackle challenges with site permissions that potentially expose us to risks ...
0
votes
1
answer
318
views
Is it possible to remove/hide/remove the "Stock Images" in SharePoint Online webpart?
I have a requirement to hide or not show "Stock Images" and "Web Search" etc when selecting an image to a web part. Is it possible to do that using PowerShell or some command?
I ...
1
vote
1
answer
109
views
How to recognise the differance between a "News Post" and a "Page" programmatically with PowerShell?
I have an intranet and try to get the statistics of News Posts. I have now this PowerShell script below where I do a search query and get some metadata.
Is there some attribute where I can recognize ...
0
votes
0
answers
246
views
Import and overwrite SharePoint list with Powershell
I'm using Export-SPWeb to export list from one Sharepoint site collection and
Import-SPWeb to import this list to another site collection.
I need to do it regularly and that the list and all data in ...
1
vote
1
answer
881
views
Issue Creating Org Assets Library (CDN)
I'm attempting to create an organizational assets library for use with company branded templates and copilot features.
I have successfully run this code on my development tenant, but when attempting ...
1
vote
1
answer
222
views
Add-PnPView group by secondary field
I have created a script to create number of views in SharePoint, but I am unable to work out the CAML to group by more than one field if it's possible.
1 field being:
<GroupBy Collapse="TRUE&...
0
votes
1
answer
216
views
Get-PnPProperty -ClientObject with "invalid ID"
After I successfully call $f=Get-PnpFile -Url $Url if I invoke Get-PnPProperty -ClientObject $f -Property Versions I get an error that the object ID is invalid.
Any clue?
0
votes
1
answer
575
views
How to disable Social media bar for site collection without global admin rights?
A. Context of Access
I do not have acces to the central sharepoint admin center but I am the owner of a site collection and I am site collection administrator:
I am able to connect to my site ...
0
votes
1
answer
58
views
How to add site template into Organizations template library with lists and data?
I am trying to build a site template which will contains few lists and data within the list.
I am aware that I can create site script and add all lists and libraries, but that site scripts doesn't ...
0
votes
2
answers
222
views
SharePoint Online List Form PowerApp zip file difference between PS5 and PS7
We have several SharePoint Online List form Power Apps. We export and import them to different site collections in our tenant [DEV/TEST/ACCEPTANCE/PROD]. This requires to change the datasources.json ...
0
votes
0
answers
240
views
Apply Site Policy to Multiple Site Collections with PnP Powershell
Over time, a lot of SPO site collections have accumulated in my tenant. Therefore, I want to use Site Collection Feature called Site Policy to automatically close and delete sites after a defined ...
0
votes
0
answers
244
views
Add-PnPPageWebPart: Object reference not set to an instance of an object
I'm trying to add Quick Links to my SharePoint site using the PnP Module. However, when trying to run the command:
Add-PnPPageWebPart -Page $page -DefaultWebPartType "QuickLinks" -Section 2 -...
0
votes
1
answer
261
views
Get-PnPAzureACSPrincipal - is this cmdlet deprecated?
Is Get-PnPAzureACSPrincipal cmdlet deprecated?
I was able to use this cmdlet successfully 3 months before, but now ,running this cmdlet displays error that's this is not available.
when I run Get-...
0
votes
1
answer
411
views
Listing groups with the users in them using PowerShell - SharePoint Online
Is it possible to list all groups on the SPO website along with the users who belong to a given group and export the results to Excel?
I would like to add that 2FA is enabled on the website.
Unless ...