Hot answers tagged

3

Yes, there is a way. You need to use an SPQuery object (based on your SPView). Use the following PowerShell commands: $web = Get-SPWeb $($webUrl); $list = $web.Lists.get_Item($listName); $view = $list.Views[$viewName]; $spQuery = New-Object Microsoft.SharePoint.SPQuery($view) $spQuery.RowLimit = 0 $items = $list.GetItems($spQuery);


2

Instead of removing and re-adding you may be able to just update their accounts. Move-SPUser -Identity "c:0-.f|atschoolroleprovider|parent" -NewAlias "c:0-.f|nhaschoolsauthroleprovider|parent" You can use the Get-SPUser to get all users and then loop over them to run across multiple accounts.


2

To add the certificate to the Central Admin trust is easy. You have to run the below command for each certificate. $cert = Get-PfxCertificate c:\CsAppTier.cer New-SPTrustedRootAuthority -Certificate $cert -Name CsAppTier c:\CsAppTier.cer is path & name of the certificate which you want an import. -Name CsAppTier, You can name whatever you want or ...


2

If you go to Site Settings > Search Settings > Send queries to a custom results page URL, you can send your results to the Search Center using the Search Center URL property, thus: {SearchCenterURL}/results.aspx EDIT I believe the properties are as follows: Site Collection Search Center = SRCH_ENH_FTR_URL Site Collection Search Dropdown Mode = ...


2

I ran into this same thing and was able to get this to work by replacing the commented out lines with the others. # Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client").location) # Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.runtime").location) ...


2

It's achievable through PnP PowerShell CmdLets, you need to install the msi before using it. SPOAppPackage -Path c:\files\demo.app -Force Refer to other switch parameters for more options. More details here


2

I would do this way( i am guessing you are developer). Create a List in SharePoint with all required column( Site collection name, url, Owners, Site template etc)as per your requirement.One special field which will indicate whether this request processed or not( true/false type). Now create PowerShell Script, which will read from List and create the site ...


2

The user object needs to exist in a UIL. That's the primary responsibility of stsadm/Move-SPUser: to migrate users within the UIL to the new identity. The User Profile Service can, in certain scenarios, automatically migrate a user when it has detected a change, but from the sounds of it, you don't need to do any work for this particular user.


2

If you do: $site = Get-SPSite https://sharepointsite/sitecollection/web/web and you get an error message that says: Get-SPSite : Cannot find an SPSite object with Id or Url: https://sharepointsite/sitecollection/web/web you know it's not a site collection. In PowerShell you can handle this error with a Try Catch block. Good article on error ...


2

Check that the powershell isn't running as a service account. Similar question answered here: Creating item in list using workflow doesn't trigger item created workflow


2

Get-SPWebApplication "http://MyServer/" | Get-SPSite -Limit All | Get-SPWeb -Limit All | % { $_.AlternateCssUrl = ($_.Site.Url + "/SiteAssets/DevColorChange.css");$_.Update() }


2

Source: http://www.sharepointrelated.com/2015/03/30/change-site-collection-url-sharepoint/ $site = Get-SPSite http://servername/customer/questions $site.Rename("http://servername/customer/generalquestions") And you have more detailed info in http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=573


1

First of all, there is no way to do this using the GUI, You have to rely on the PowerShell. there are 2 options in Powershell. use the Copy-Spsite Copy-SPSite http://contoso/sites/OldTeam -DestinationDatabase WSS_Content -TargetUrl http://contoso/sites/NewTeam Now Run the Remove-Spsite to remove the old site. Another option is Using the BackUp and ...


1

I'd try to apply the patches yourself, in order. Install on CA server first, one at a time for each server. Then run the psconfig on the CA server, one at a time, then each server after that. The patches being installed by non-SharePoint guys is a huge red-flag since it's a specific process to it. Was it done to all servers? Did they install and run psconfig ...


1

Complementing Kolten's answer: And if you really need to run it as a System Account, you can also start workflows with some powershell: Nice solution


1

You have to use the Get-SPAlternateURL, it will return url from all zone then you will be know if one you are requesting being used or not The Get-SPAlternateURL cmdlet returns all alternate URLs that match the scope given by either the optional Identity parameter or by a combination of the optional WebApplication, Zone, or Resource parameters. ...


1

As I can't stand my half answer in the comments.. I used TamperMonkey (the Chrome version of FireFox GreaseMonkey) to automate the manual proces. It detects the ViewEdit page, checks the darn checkbox, unchecks it if needed, and saves the View... But I misplaced the code :-( If you open those 300 Views in Tabs, Tampermonkey will fire on all and you ...


1

In the below line of code, you are trying to fetch the colorfile from the sub web but it's not in the sub web; it's in the root web, that's why it works fine in the root web, but fails in other webs. $colorfile = $SPWeb.GetFile($r) Try using the below code and logic, Add-PSSnapin Microsoft.SharePoint.PowerShell $themeName = "PaletteTheme" $SPSite = ...


1

The proper use of this cmdlet is: $user = Get-SPUser -Identity "i:0#.w|domain\janedoe" -Web http://webUrl Move-SPUser -Identity $user -NewAlias "domain\janesmith" -IgnoreSid The Get-SPUser example is using Windows Claims (drop the i:0#.w| if not using Windows Claims) and the -Web is a Site Collection where the user is present in the User Information List. ...


1

I think if you need to create a wizard with the user interaction, powershell is not the alternative. It is correct to use an application page. With C # code. Another alternative is that the sites are created in a list and trigger an event receiver with c# code to create the site collection. By using SSOM you have many tools for flexible solutions. Of ...


1

The correct and recommended way would be to use the Client Side Rendering feature of SharePoint 2013. You can refer to Item Link example here for achieving this. Client Side rendering is powerful alternative to XSLT modifications and is wonderfully explained by Andrei Markeev in the article linked above.


1

Try: Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0 $UserSPU = "domain\user" $site = Get-SPSite https://sharepoint.example.com $web = $site.OpenWeb() try { $user = $web.EnsureUser($UserSPR) } Catch { Write-Host 'User not found.' }


1

Maybe something like this? Essentially what this guy is doing is using the WinForms Report Builder dll to pull in the SSRS report and export it using code. You can upload the file once you have it through code that looks similar to this (referenced from Todd Klindt): $Web = Get-SPWeb $WebURL $List = $Web.GetFolder($DocLibName) $Files = $List.Files ...


1

It depends upon on your environment ( i.e number of the site collection, Size of data, Complexity of sites). As you know, there is no direct way of migration from SharePoint 2007 to 2013. The only way is to build a temporary SharePoint 2010 farm( btw 2010 also pass End of life) then Backup the content DB from 2007 and restore it 2010 after upgrade here then ...


1

to remove a user try this one ######################## Start Variables ######################## $LoginName = "domain\login" $siteURL = "http://SharePointSiteURL" #URL to any site in the web application. ######################## End Variables ######################## Clear-Host $siteCount = 0 ...


1

You can use below snippet Get-SPUser -Web http://server/sites/yoursite | Where { $_.IsDomainGroup } AD group is treated as a special user. So this can be find using the filter IsDomainGroup $SPWebApp = Get-SPWebApplication https://*******.com/ foreach ($SPSite in $SPWebApp.Sites) { write-host -foregroundcolor green "Working on Site ...


1

Should you not do UserCustomAction.Update() after you set the new script source? (also you may want to store the action in a variable: try{ $theAction = $customActions.GetById($Id) $theAction.ScriptSrc = $ScriptSrc $theAction.Update() $context.ExecuteQuery() Write-Host "CustomAction $Id updated" -ForegroundColor Green } catch{ ...


1

Don't know why user25328 has a downvote, the right click works well with me too. Copy from PowerShell: Highlight what you want (left click and drag), then right click anywhere on the console to copy the highlighted text. Paste to PowerShell: Simply right click anywhere on the console, it will paste it after the prompt. Alternatively: Alt + Space > E > P ...



Only top voted, non community-wiki answers of a minimum length are eligible