Tag Info

New answers tagged

0

Display security permissions for site collection, subsites, and lists/libraries in each site. To use it, you must modify the $site variable to point to your site collection. Syntax: <script name>.ps1 | out-file c:\permissions.txt Here is script #Add SharePoint PowerShell SnapIn if not already added if ((Get-PSSnapin ...


0

You can use below script as a starting point $webApps = Get-SPWebApplication foreach($webApp in $webApps) { foreach($site in $webApp.Sites) { foreach($web in $site.AllWebs) { foreach($assignment in $web.RoleAssignments) { if(-not [string]::IsNullOrEmpty($assignment.Member.Xml)) ...


0

Out of the box you can use more or out-host. In both cases we won't be able to set number of items to be displayed. In your case you can try storing the items in an Array object and then iterate it based on your page length.


0

Not sure how you are getting subwebs. It should be foreach($web in $websites.Webs). That aside you could try using the AssociatedGroups property. In theory Groups should only return groups that have security roles assigned while AssociatedGroups will return all groups whether they have roles assigned or not. Edit: When I tested this with two sites a and b. ...


0

Is it that your user does not have permission to the site because it's not in any of the groups. As a test add the user that is running the powershell script as site collection admin, just to see if you can then see the groups ok.


0

Setting this ShowField can be a bit confusing because the drop down is filled with display values of these columns and not with the internal names that you have to use in your Visual Studio solution. Here is a good overview of these values. If you look into the column on the right side you can see that "Name" is what the front-end shows as "Account". If ...


1

If you have a look at this link you'll find a way to identify all content types which contain your column. Key to remove a column from a content type is to delete the FieldLink: $content.FieldLinks.Delete("YourField"); $content.Update($true); Update($true) will propagate all changes to the list content types (if there are any). In the end you'll have to ...


0

If you can access Central Administration you can backup your list in Backup and Restore - Export a site or list (Granular Backup section). Hope this will help you.


0

Not only the SharePoint versions but also the SQL server need to be the same. Please make sure the DB servers also have the same CU and SP's. For a quick check run the following command in your SQL Management Studio. SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition') Let me know if you still see any ...


1

You should change default view property like: $web = Get-SPWeb "http://test.com" $doclib = $web.Lists["Shared Documents"] $view = $doclib.Views["All Documents"] $view.Scope = [Microsoft.SharePoint.SPViewScope]::Recursive $view.Update() Where "http://test.com" - site URL, "Shared Documents" - name of list/library, "All Documents" - default view name.


1

There is an XML type in PowerShell. Exploring XML Document by Using the [XML] Type Accelerator Define $a as [XML]$a = $item["XMLField"]; Now you would be able to lookup set the value of NodeImLookingFor as $a.NodeImLookingFor = "New Value"; Regards


0

Make sure you are using correct ListName and it exists in the Site. Try below $webUrl = "http://site.fr/" $w = get-spweb $webUrl $listName = "Qualified Information" $l = $w.Lists[$listName] write-host $l.Title


0

I know its quite late for an answer, but following is the PowerShell code which can be helpful to remove ITEM content type from custom list. Add-PSSnapin "Microsoft.SharePoint.PowerShell" $web = Get-SPWeb "UrlOfYourSite" $list = $web.Lists["YourListName"] $ctToRemove = $list.ContentTypes["Item"] if($ctToRemove) { Write-Host ...


0

For uploading file to a particular folder you need to initialize it as $folderName = "FolderToUpload"; $folder = $spSourceList.getfolder($spSourceWeb.Url + "/" + $libraryName + "/" + $folderName) For file check in you can use $spFile.CheckIn("Comments", 1) To Approve File you can use $spFile.Approve("Comments")


0

It should be $w.Lists and not w.Lists It seems you missed the $ sign.


0

This Script will get all the security groups listed in your groups at web level,similarly you can get if principal is Distribution list or a user or a Sharepoint Group POWERSHELL if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } Write-Output "Starting ...


1

I resolved my problem : $webUrl = "http://site.fr/" $library = "librarieName" $spSite = new-object Microsoft.SharePoint.SPSite($webUrl) $w = $spSite.OpenWeb() $l = $w.Lists[$library] $resultHashtable = @{} foreach ($listItem in $l.Items) { Write-Host " Content: " $listItem.ID foreach ($attachment in $listItem.Attachments) { ...


0

try the below code: $sitecol = get-spsite “http://lmbsrhzwsp” $deletions = new-object system.guid("fcfdc7d3-ef59-4988-b3e9-0ae7184c6c4f") $sitecol.recyclebin.delete($guid) Clean Recycle Bin through Powershell in High Turnover Sharepoint Site


0

You can use start-transcript, which records Powershell activity to a text file. Something like this: # Store the executing directory $thisDir = Split-Path -Parent $MyInvocation.MyCommand.Path # Set log file to script name + '.log' $logFile = '{0}.log' -f $MyInvocation.MyCommand # Start logging Start-Transcript -Path $thisDir\$logFile Write-Host This text ...


0

I wonder if you're creating your guid in the correct manner? Try this: $a = [System.Guid]"fcfdc7d3-ef59-4988-b3e9-0ae7184c6c4f"


2

You can also do the same using $ext = [System.IO.Path]::GetExtension($link.url) if($ext -eq '.doc' or $ext -eq '.docx' or $ext -eq '.pdf') { #file found }


1

You're missing * in all the file extension tests


3

Wouldn't you need to make this: ($link.url -like '.doc' -or $link.url -like '.docx' -or $link.url -like '.pdf') like this: ($link.url -like '*.doc' -or $link.url -like '*.docx' -or $link.url -like '*.pdf')


2

Replace Write-Host $file.name $link.url with "$($file.name) $($link.url)" | Tee-Object test.txt -Append This will output the text to both the screen and test.txt (remember to clear this first)


1

Run the following code to get in txt file Add-PSSnapin Microsoft.SharePoint.Powershell -ea 0; $output="" $web = get-spweb 'http://tvstg01/kb/customerservice/' $list = $web.lists['Customer Service']; foreach($file in $list.items){ $links = $file.ForwardLinks; foreach($link in $links){ ...


3

You can use Custom Objects and use Export-CSV as below. This approach will give you more flexibility like opening in Excel and Sort, Filter etc. Also you can easily add additional fields to output. Add-PSSnapin Microsoft.SharePoint.Powershell -ea 0; $web = get-spweb 'http://tvstg01/kb/customerservice/' $list = $web.lists['Customer Service']; ...


0

My suggestion is using Event Receiver in two list with code behind in the ItemAdded and ItemUpdated funtion. The below is the concept of ItemUpdated, this will update A column's value of item which has same ID in sync list. public override void ItemUpdated(SPItemEventProperties properties) { base.ItemAdded(properties); using (SPSite site = new ...


0

Did you create a column or a content type in the content type hub? If it is a column, did you add it to the Document Library content type? If that is the case, you can either wait for propagation of the change or you can choose Republish option under Content type>>Manage publishing for this content type If you have created a new content type, that content ...


0

I resolved this problem by editing regionalsetng.aspx in the LAYOUTS folder. Adding disabled="disabled" to asp:CheckBox id="ChkFollowWebRegionalSettings" has the desired effect.


1

You should be able to use this: Set-SPOUser -Site "https://oursp.sharepoint.com/sites/sitecoll" -IsSiteCollectionAdmin $true -LoginName "c:0-.f|rolemanager|s-1-5-21-112313..."


0

Using PowerShell you can get it using $site = Get-SPSite http://siteurl $provider = [Microsoft.Office.DocumentManagement.DocumentId]::GetProvider($site) $result = $provider.GetDocumentUrlsById($site, "DocID-1-1")


0

it is unsupported to query SharePoint’s databases directly and should not be done in production without the direct involvement of a Microsoft support engineer.Every Content DB has a User info table which contains the user information. Groups are stored in the same content database where the site Collection reside.So, Once you get the site collection DB ...


0

You either open the Central Admin to find the Database Details. Or you can use below PowerShell script. Get-SPContentDatabase -site http://siteurl


1

You can use PowerShell to get this information Function GetFiles($folder) { Write-Host $folder.Name foreach($file in $folder.Files) { Write-Host $file.Name } foreach ($subFolder in $folder.SubFolders) { GetFiles($Subfolder) } } $web = Get-SPWeb http://weburl $list = $web.Lists["ListName"] ...


0

I don't have a MOSS box handy but this should mostly get you there: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $spSite = New-Object Microsoft.SharePoint.SPSite("http://url") $webApp = $spSite.WebApplication foreach ($site in $webApp.Sites) { foreach ($web in $site.AllWebs) { foreach ($list in $web.lists) { ...


0

Try below code add-pssnapin microsoft.sharepoint.powershell -ea continue $site = get-spsite "http://siteurl/site" $web = $site.rootweb $list = $web.lists["user information list"] $items = $list.items | where-object {$_["Account"] -like '*northp*'} $listItemsTotal = $items.Count; for($x=$listItemsTotal-1;$x -ge 0; $x--) { $item = ...


0

For the app to deploy in non dev sites you need to buy a version, if your are running using trial accounts , you cannot do it. Microsoft provides to test the apps only in dev sites.


0

try below code( complete details) function Get-SPUserEffectivePermissions( [object[]]$users, [Microsoft.SharePoint.SPSecurableObject]$InputObject) { begin { } process { $so = $InputObject if ($so -eq $null) { $so = $_ } if ($so -isnot [Microsoft.SharePoint.SPSecurableObject]) { throw "A valid SPWeb, ...


0

Try this Script. I use this for my sharepoint farm in my company. ############################ # # Author: Manish Oswal # Created: 2011-01-07 # Description: Retrieves the users and their permissions from a Site # ############################ # Clear the screen CLS # Stop on errors $ErrorActionPreference = "Stop" ...


0

You can use GetType() method $web.GetType().Name If it is web it gives you SPWeb otherwise SPSite Edit $currentSite = Get-SPSite -Identity $siteFollowed.Uri.AbsoluteUri if($currentSite.GetType().Name -eq "SPSite" ...


0

You can use GetType() method $web.GetType().Name If it is web it gives you SPWeb otherwise SPSite


1

Try this: $currentSite = Get-SPSite -Identity $siteFollowed.Uri.AbsoluteUri foreach($web in $currentSite.AllWebs){ $web.Url version is $web.UIVersion #4 or 15 } }


0

You can do $site.rootweb.ContentTypes to get all content types. Then for each one, use the SPBuiltInContentTypeId.Contains(ContentTypeId) method (MS reference) to check whether the content type is a built in one. If it is not, it must be a custom created one. Like so: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") Function ...


1

Since SharePoint 2013/Online supports a sets of APIs, CSOM or REST APIs could be consumed in PowerShell for that purpose. How to stop permissions inheritance for a List in SharePoint Online Prerequisites: SharePoint Online Client Components SDK The example below shows how to assign unique permissions for a list using CSOM API in PowerShell: ...


0

Unfortunately this can't be done with PowerShell (yet). You have to use Office 365 API for this action. Ref: Index of Windows PowerShell for SharePoint Online cmdlets


4

Please follow steps given below to ensure SharePoint Administration Services is available: Click on Start->Run->Services.msc. Search for "SharePoint 2010 Administration" service and make sure Status is Started. If it is not enabled, start the service and re-execute the command.


0

I think 1st thing to check the SharePoint shell access. If you do not have membership in the SharePoint_Shell_Access role or WSS_Admin_WPG local group, use the Add-SPShellAdmin cmdlet. When the Add-SPShellAdmin cmdlet is used, the user is added to the WSS_Admin_WPG group in all front-end Web servers and is added to the SharePoint_Shell_Access role. ...


1

From your command, looks like their is some error.You have to provide the complete path of PSConfig and also use -ArgumentList instead of ps-ArgumentList. Start-Process "path of file\PSConfig.exe" -ArgumentList "-cmd upgrade -inplace v2v -passphrase FarmPassPhrase -force -wait" -Wait If their is not such requirement then you can directly run the psconfig ...


1

Thanks to user19952 I was able to make the connection. Yes, it was true! Powershell was running under a different user account then the one I had logged on. This was because I am sharing my environment with other people and we are using the same account. So someone must have logged in on Powershell using a different account. From now on I will always ...


0

Open powershell ISE as admin and copy/paste script. Change names of list and column. Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue $listName = "My Contacts" # < Enter your list name $fieldName = "Help" # < Enter your field name $fieldCount =$Null foreach ($site in get-spsite){ foreach ($web in ...



Top 50 recent answers are included