# Tag Info

0

http://khalidansari.com/2014/04/07/change-sharepoint-management-shell-default-folder/ You need to modify the Target field, not the Start in field. This is a pretty good blog on how to do this. It worked for me.

1

You create the object muser, but never initialize it. So, your comparison is always false. I would suggest inspecting the Groups property of the SPUser object. (The following is not tested since I don't have an environment handy.) $site = get-spite "{siteUrl}"$web = $site.RootWeb$user = $web.AllUsers["{domain\\user_alias}"] Foreach($group in ...

0

you can use piping to iterate through all results e.g. param( $webUrl = "http://yoursite",$groupTitle = "your group" ) clear-host function Send-Mail($to){ write-host "Sending email to$to..." $smtp = "SMTP server addresss"$from = "sharepoint@company.com" $subject = "This is a Test of HTML Email"$body = "Dear Users" ...

0

I finally realised the error message was because my admin account did not have enough rights to run the script. I've been told the clue was the "unauthorized operation..." part of the error message. When I logged in as the farm account, it worker perfectly.

1

I am not 100% sure what you are asking but just incase I am right This script will return a list of all sites, the groups and the permissions the groups have. Add-PSSnapin Microsoft.SharePoint.PowerShell $sites = get-spsite | get-spweb foreach($site in $sites) { write-host$site.URL -ForegroundColor Green $site.associatedgroups | select name, roles ... 0 I found the problem when i was using "Version"=$item.["_UIVersionString"] i got base-512 versions as Vaibhav has pointed in his answer But i am getting the correct version like 23.1 etc when i use "Version"= item["_UIVersionString"] (dot removed)

2

_UIVersionString “1” = version “0.1” _UIVersionString “2” = version “0.2” _UIVersionString “3” = version “0.3” _UIVersionString “512” = version “1.0” _UIVersionString “1024” = version “2.0” _UIVersionString “1025” = version “2.1” Example : If page version is 5.4 Then it will show 2564 5 * 512 + 4 = 2564 We call this a "base-512" counting system in ...

0

I think $item["ows__UIVersionString"] should give you what you want. 1 You need to Download SharePoint Online Management Shell and SharePoint Online Client Components SDK in order to work with SharePoint Online using PowerShell. Then you can write PowerShell code and execute it in SharePoint Online Management Shell. Following sample code creates a list (Document Library) in SharePoint online. #Import the required DLL ... 0 You can use the SharePoint Online Management Shell to efficiently manage users, sites, and organization. To run the SharePoint Online Management Shell cmdlets, you have to be a SharePoint Online global administrator. First you need to connect to SharePoint online using Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential ... 2 The method SPFieldCollection.Add (String, SPFieldType, Boolean, Boolean, StringCollection) has only five arguments. Whereas, in your code you are passing 6 parameters. Try changing the code to this:$newSiteColumn = $web.Fields.Add($name,[Microsoft.SharePoint.SPFieldType]::Choice, $false,$false, $stringColl) Source: ... 0 Following are the steps with powershell commands to update the webpart property Get the site Since we have to throughout the site collection, among all the web we will go through all the webs Now, we need to read welcome page of every web Once we got the welcome page, get the file and checkout it Now from welcome page we will get webpart manager Now we ... 1 i found 1 way$site = new-object Microsoft.SharePoint.SPSite("http://server/") $web =$site.OpenWeb("/") $resultsPath = "Paginas/default.aspx"$page = $web.GetFile($resultsPath) $page.CheckOut()$wpm = $web.GetLimitedWebPartManager($resultsPath, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) $wpm.WebParts | ft Title, StorageKey ... 0 You have to use AllProperties. Adding a new property bag:$web.AllProperties.Add("Key", "Value") $web.Update() Changing the property:$web.AllProperties["Key"] = "New Value" $web.Update() Retrieving the property:$value = $web.AllProperties["Key"] Hope this helps! ;) 1 Here is the script. It will get you primary administrators in an excel file for each site collection inside a web application. I am not able to get Secondary Owner Property though.$WebApplicationUrl = "https://peopletest.brookfield.com" $outputFile1 = "C:\TEMP\siteCollectionAdminsPrimary.csv"$outputFile2 = "C:\TEMP\siteCollectionAdminsSecondary.csv" ...

0

simple: Get-SpWebApplication http://www.contoso.com | Get-SPSite -Limit All | Select URL, ID, contentdatabase,Owner, SecondaryOwner | Export-CSV "f:\VLESites.csv" -NoTypeInformation

2

Try to use Owner instead of owneralias, and SecondaryContact instead of secondaryowneralias.

0

Yes. There is manual pagination available by select-object command as follows Get-SPUser -web <siteCollectionURL> | select-object -Index (0..10) This command will produce first 10 users in site collection (0..10) refers to range i.e. from index 0 to 10 Thus one can achieve manual pagination by playing with indices using -Index parameter.

0

You do not require any powershell to apply the site collection master page on all subsites. Go to Root site collection -- > Site settings--> Master Page (under Look and Feel). Select your masterpage. Check "Reset all subsites to inherit this site master page setting" . Click Ok. Now all your sub sites will inherit the masterpage of the root site.

0

Using csom PowerShell you can try below function to give a group your desired permissions it uses Microsoft.SharePoint.Client.RoleDefinitionBindingCollection and Microsoft.SharePoint.Client.RoleType to get role types. function Set-PermissionsOnList() { param( [Parameter(Mandatory=$true)][string]$url, ...

1

You should use microsoft.SharePoint.Client.RoleDefinitionBindingCollection instead of Microsoft.SharePoint.Client.RoleAssignment. Try below snippet (Not tested but will give you idea of what all steps are required): # Get the list by Title and load. $web =$ctx.Web $list =$web.Lists.GetByTitle("Quiz") $ctx.Load($list) # Load in list of groups on the ...

0

You would want to loop through all the subsites and then set the value of the masterpage for each with the following code. $web = Get-SPWeb http://sharepoint$web.CustomMasterUrl = "/_catalogs/masterpage/nightandday.master" $web.MasterUrl = "/_catalogs/masterpage/nightandday.master"$web.Update()

0

At times when Restore-SPSite PowerShell commands fail, the STSADM commands have worked for me occasionally. You could give it a shot. stsadm -o restore -url "siteurl" -filename "backupfilename" That being said, as rightly pointed out by Waqas, upgrading the environments to the right CU is the recommended option. If interested, you can check out few ...

0

I cannot explain why this is happening but I can provide a work around to stop it happening. Open your management shell and type $profile and press enter. A path will be shown. If the file / path does not exist create it. Open the file microsoft.powershell_profile.ps1 in a text editor In the document enter "sl c:\" without the quotes and save the document ... 1 Below script will upload file recursively from folder to document library if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq$null) { Add-PSSnapin Microsoft.SharePoint.PowerShell } Function UploadFiles($web,$path,$docLibrary) {$files = Get-ChildItem $path foreach ($file in $files) { if($file.GetType().Name -eq "DirectoryInfo") { ...

4

John Q: First you need to dig deeper into the field definition using SharePoint Manager 2013, and observe if property 'AllowGridEditing' exists? A: The property doesn't exist so give PowerShell a break ;) Why: In SharePoint 2013, client-side rendering (CSR) provides a way to control the output/design of your fields and set of controls by leveraging HTML ...

0

Also note, that when Set-SPUser fails it is a non-terminating error, so you will not hit your catch block. See http://stackoverflow.com/questions/1142211/try-catch-does-not-seem-to-have-an-effect Reproduced here: If you want try/catch to work for all errors (not just the terminating errors) you can manually make all errors terminating by setting the ...

0

I had the same problem and worked for me when I added my user as Site Collection Administrator.

0

Here I've found An SPListItem is not serializable I've tried to create a workaround - it could work but it loses an advantage of "parallel" jobs because start time and memory costs are greater than "serial" running $cmd = { param($url, $listName,$id) Add-PSSnapin Microsoft.SharePoint.PowerShell $web = get-spweb -identity "$url" $list = ... 0 This may help you. 1) Go to the AppInstallations table in the content DB. 2) Select the recode related to your app 3) Update the status to 5 4) Do IIS Reset 5) Navigate to Site content and go to the context menu of the Corrupted app 6) Click the “Remove” Link More details: http://sujeewa.com/2015/06/remove-corrupted-app-from-the-farm/ 0 It's very simple, you have to do it like this:$page = $SpSite.RootWeb.GetFile($resultsUrl); if ($page.FileExists) { } Please refer to this site. It only works if you used "GetFile" before. 0 If the PowerShell doesn't work check the following link http://sujeewa.com/2015/06/remove-corrupted-app-from-the-farm/ -1$site = Get-SPSite $centralAdmin is not necessary, just use$taxonomySite in TaxonmySession ... also last line should be Write-Output "Deleted $grpName" not$groupName ....

0

There is no "update" for that service, the setting is immediate. Your command should have been successful. You can confirm using the UI in central admin. I just confirmed on an installation I am working through that this works.

3

@john You can try setting ReadOnlyField property of the field to True $field.ReadOnlyField =$True

1

If you notice in both of your given code examples the Palette001 is without .spcolor extension. I suspect this could be the issue. Refer screen shot which show Palatte001 with extension. I have not tested this code but you can try using below improvements Improving your code with added .spcolor extension: ...

1

Try with Out-Null instead of $null or null or Empty String follow this link for more information http://sprider.org/2015/03/24/o365-sharepoint-online-apply-theme-csom-powershell/ 1 You can use the [Force][1] Paramter. Force = Specify to overwrite an existing backup file if it already exists. Your command should be looks like this Backup-SPSite -Identity http://xyz -Path D:\SP_BACKUPS\test.bak -force 4 Nico, I found a source that may help you immensely. The following link walks you through how to use a PowerShell script to import a list of users from Excel and create them for FBA. Importing and Exporting Data in Extranet Collaboration Manager (ExCM) 2010 You can also download the PowerShell source code from this link. It looks like the code creating ... 2 Microsoft.sharepoint.client.folder does not have property for "BreakRoleInheritance" You can use as below to break permission inheritance$RootFolder.ListItemAllFields.BreakRoleInheritance($true,$false) Hope it will help to you.

0

Lots of ways to do this in PS but maybe the easiest is Out-File: "$webURL,$($user.LoginName),$($user.Name),$($role.Type.ToString()),$($group.name)" | Out-File$logFile -Append You could Create the file at the beginning of your script something like this (you may want to add a date stamp to the file name): $log = "C:\path\to\log.csv" if (!(Test-Path ... 2 You will have to write a recursive method for this. You can exclude Forms folder as all the List & Libraries in SharePoint has a default Forms folder where all the view/Add/Edit forms will be stored. function GetChildFolders($RootFolder) { $Context.Load($RootFolder) $Context.Load($RootFolder.Folders) $Context.ExecuteQuery() ... 0 I would perhaps create a WinForms application that contains WebBrowser control and logic to connect to SharePoint, and that iterates through all pages in the pages library rendering them in the WebBrowser control. You can print WebBrowser contents using WebBrowser.Print, and if you have PDF printer endpoint in the system, it would basically print the ... 0 This PowerShell script will export the list into a desired CSV file. Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null$url = "<site url>" $listName = "<list name>"$path ="c:\Columns.csv" $web = Get-SPWeb$url $list = ... 0 SPList.DisableGridEditing is the parameter. In schema.xml: <List ... DisableGridEditing="TRUE"> 1 You specified a wrong Id. Use Ribbon.Documents.New.NewDocument instead of Ribbon.Library.Actions.NewDocument. Your code should look like this:$CustomAction = $list.UserCustomActions.Add()$CustomAction.Title = "Hide New Document" $CustomAction.Location = "CommandUI.Ribbon"$CustomAction.commandUIExtension = " <CommandUIExtension> ...

0

I would try to couple of things to deleted the Proj service App. Reboot the server and try again. Make Sure SharePoint timer job and Admin job is running. if their is any timer job missing, run the below command to provision all OOTB jobs. $farm = Get-SPFarm$farm.TimerService.EnsureDefaultJobs() I would also check the ULS logs and event Log during that ...

2

Could be a language / culture issue. Try this script instead. It renames the list for all in SPWeb supported cultures. Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue $web = Get-SPWeb http://mysite ForEach($culture in $web.SupportedUICultures) { [System.Threading.Thread]::CurrentThread.CurrentUICulture=$culture; $list ... 0 I found a working solution. The ReportViewerWebPart needs an additional context. Can anyone tell me, where this is documented? Whatever, here is my working code:$webUrl = "https://sharepoint.de/websites/projekte" $pageUrl = "default.aspx"$web = Get-SPWeb \$webUrl ...

1

On the SharePoint server you can launch SharePoint 2013 Management Shell. It loads Microsoft.SharePoint.dll and other libraries, some command lets also. Here you can use whole Server Side object model. You also have helpfull cmdlets like get-spsite, get-spweb and others. Here are all documentation of them.

Top 50 recent answers are included