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 ...

learn more… | top users | synonyms (1)

17
votes
5answers
30k views

Suddenly getting “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.”

This morning all the development machines at the company I work at, couldn't manage SharePoint through Powershell. We were all getting the annoying "The local farm is not accessible. Cmdlets with ...
13
votes
6answers
28k views

Powershell: cannot access the local farm

Yes, I am logged into the machine as an administrator, and my domain account id a farm admin as well. The site is running properly, and nothing seems wrong in SP Central Administration. But when I ...
12
votes
4answers
29k views

PowerShell: Script to check feature status (enabled/disabled) before activating

I am developing a script to refresh my custom features. Earlier i was just looping through the features and calling Disable-SPFeature and Enable-SPFeature on each items. The issue is when the ...
11
votes
4answers
12k views

Restore-SPSite to the same content database

I ran Restore-SPSite on my server from a backup. I then deleted the site collection and did it again but got the following error: Restore-SPSite : The operation that you are attempting to perform ...
11
votes
4answers
8k views

How to automate entry of external column data in BCS?

I have a document library, Resumes, that has a large number of resumes in it. There is a regular column on that library, called EmployeeID, that is already populated. I have an external content type ...
10
votes
4answers
8k views

How to log off user from SharePoint site, if the user has been inactive for 20 minutes

How to log off the SharePoint site, if the user is has been inactive for for 20 minutes? Do I need to redirect user to logout page? How would I count the idle time?
10
votes
2answers
13k views

How do I check if a site already exists from PowerShell? [duplicate]

I have a script that exports a site and restores it in another web application. I want to check if the target site already exists. Is there an easy way to tell if www.example.org/sites/asite/ is ...
9
votes
2answers
2k views

SPWeb being closed when getting list by powershell. What's wrong?

When I run this little piece of powershell code: $w = Get-SPWeb http://localhost $l = $w.List["some list"] I get Unexpected error message to my Sharepoint ULS log Detected use of SPRequest for ...
9
votes
1answer
6k views

All Authenticated Users claim

I'm adding items to my list by powershell script. I need to fine-grain user permissions to added items. Code I'm using now: $claim = New-SPClaimsPrincipal -ClaimValue $role -ClaimType $ROLE_CLAIM ...
9
votes
1answer
9k views

PowerShell - create list from list template in list template gallery

Using PowerShell on a SharePoint 2010 site, how can you create a new list from a list template found in the list template gallery?. I want to be able to add several lists at once (just in numerically ...
8
votes
4answers
6k views

Problem with HTTP Handler deployed on Sharepoint 2010

I've developed a Visual Web Part for Sharepoint 2010. I've used VS2010 to do that and tested the Webpart in a testing server using VS to do the deployment. But to deploy it on the production server I ...
7
votes
5answers
40k views

List all Site Collections in a Farm

I want to be able to see the number, names, url of all site collections there are in a given farm. Would there be a powershell command to do that?
7
votes
5answers
23k views

Editing property bag values using powershell

What is property bag in SharePoint 2010? How do I retrieve values from a property bag and get/set the values using powershell?
7
votes
2answers
5k views

PowerShell: Update People Picker Field with domain\Username

I'm trying to get this to work in PowerShell: $spListItem[$ppField] = "domain\username" $spListItem.Update() This gives me the following error: Exception calling "Update" with "0" ...
7
votes
4answers
6k views

Automatically add pssnapin Microsoft.Sharepoint.Powershell

I am developing in Sharepoint and I like more Windows Powershell than Sharepoint Management Shell. Every time I restart the development machine, I have to run Add-PSSnapin ...
7
votes
1answer
7k views

Remove a single user from all site collections in a web application using powershell

Is there a way I can choose to remove a single user from all site collections within a single web application using powershell. There are number of user profiles whose domain account has been blocked ...
7
votes
4answers
4k views

How can I schedule the User Profile Service to run a full sync weekly?

We are running SharePoint Server 2010 and have not yet applied SP1. User profile incremental sync is not picking up all of the group membership from AD. Starting a full sync seems to rectify the ...
6
votes
2answers
18k views

Powershell script to find permissions for a specific user

what am i doing wrong user.ps1 $user = "sp2010\systemsacct" $site = $gc | Get-SPSite sp2010 $site | Get-SPWeb -Limit All | Get-SPUserEffectivePermissions $user Out-GridView -Title "Web ...
6
votes
2answers
5k views

Powershell error when trying to hook into UserProfileConfigManager

I am making the following call new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext) And get the following error: New-Object : Exception calling ".ctor" with ...
6
votes
3answers
776 views

How to create a site collection

I need to create a site collection so that url looks like http://hr.mycompany.com instead of http://portal.mycompany.com/hr. How do I do that?
6
votes
4answers
11k views

Sharepoint 2010 powershell add-spsolution access denied

I'm trying to do a test deployment to a client server. The site collection backup completed without error. When trying to add a spsolution I get an 'Access Denied' error. I'm adding it with the ...
6
votes
3answers
11k views

Download and delete documents using Powershell

I'm looking to build a Powershell script that does the following to all documents in a SharePoint 2010 document library: Downloads the document to a network file share Deletes the original document ...
6
votes
2answers
577 views

Programatically determine who created a site collection

Is there a way, preferrably with Powershell, to determine who created a site collection? I'm not interested in who the site collection admins are, but who the actual creator of the site collection ...
6
votes
2answers
1k views

How to reproduce Visual Studio “Deploy” action?

It seems like whenever I am developing a web part and I "Deploy" it from Visual Studio, everything gets deployed and works exactly as I would expect. When I take my WSP and try to install it to a ...
6
votes
6answers
2k views

Restore sitecollection from backup is not working

I have a problem while restoring a backup file on another server. Servers build versions are the same. I'm executing the Restore powershell command. And it is giving me the following error: ...
6
votes
2answers
6k views

Move files between document libraries in the same Site Collection (#2)

Quick note: First and foremost - this is somewhat in line with a previous post of mine found here: Move files between document libraries in the same Site Collection however I've opened a new question ...
6
votes
2answers
5k views

How to return all user profiles

I need to query the entire user profile store and do multiple operations such as filtering based on one user profile property, sorting by another, and grouping on yet another. Is this possible using ...
6
votes
1answer
1k views

Obtain Default Content Access Account via PowerShell

As part of farm configuration audit, I need to obtain the current content access account. While I've found several resources for setting the default content access account for search using PowerShell, ...
6
votes
4answers
12k views

How to fix credential issue?

I tried both default credential and user/pass but keep getting 401 unauthorized error. What's the fix? Here is the error I am getting .... New-WebServiceProxy : The request failed with HTTP status ...
6
votes
3answers
2k views

How can I modify a file stored in SharePoint via PowerShell?

I have some files in SP 2010 that are simply HTML, and I need to modify the contents of those files in a systematic manner. Is there a good way to do this using powershell? Imagine that I want to ...
6
votes
1answer
2k views

Problem installing web part using Powershell

We've developed a custom Visual Web Part using Visual Studio 2010 for Sharepoint 2010 Server. The webpart gets deployed when executed from VS (F5), so we can add it wherever we want using Sharepoint ...
6
votes
2answers
1k views

How to turn off MDS on all site collections and sites?

We have got a web application with 400 site collections and multiple sites, is there a way to turn off the MDS feature for entire web application?
6
votes
2answers
507 views

SharePoint 2013 Variations Using Powershell

I am using powershell to manage the creation of some site variations following this tutorial: http://www.sharepointeurope.com/blog/2013/7/23/automate-variations-in-sharepoint-2013-using-powershell-c ...
6
votes
2answers
682 views

SharePoint 2010 Documentor

Is there already existing a tool , I think "documentor" can be his name for Sharepoint 2010 that can output a form of documentation with a description of all db, web application , sites, sub sites , ...
6
votes
1answer
2k views

Script to find all items that do not inherit permissions

I would like a SP 2010 Powershell script which searches all folders in a library and finds the ones that do not inherit permissions from their parent. Does anyone have one handy? I'm new to the ...
6
votes
2answers
559 views

Script to automatically import documents from a network share on a regular schedule

I am new to SharePoint development. I am trying automate the task of: Uploading documents from a network share to a SharePoint document library. The related metadata for each of the files also need ...
6
votes
3answers
3k views

Problem with SP2013 solution scope: WebApplication vs GAC

I have a SP2013 solution that contains a custom WCF service, custom Timer Job and a Feature Event Reciever. Because of these the solution Assembly Deploying Target is set to GlobalAssemblyCache. The ...
6
votes
1answer
2k views

Extracting Comments from Version History in Powershell

So I am trying to extract version history from a document library in Powershell. I have found the commands/scripts to do this. However I cannot seem to get the comments. From my script I can get ...
6
votes
2answers
171 views

What is a good way to build/install/provision a full web application?

I have a fairly simple SharePoint web application, with a publishing front end, an extranet for customers and an intranet portal. I want this web app to be easily redeployable -- pretty much a ...
6
votes
1answer
1k views

Adding a list item with PowerShell doesn't trigger event receiver

I have a simple list with an event receiver for the following events: ItemAdded ItemUpdating ItemDeleting I confirmed that the event receiver fires when adding/updating/deleting an item from the ...
5
votes
9answers
15k views

How to delete all items in a List using PowerShell

I am using following PowerShell script to delete all items of the List. It's working fine but take too long for huge lists. Is there any efficient way of clearing list items, something like truncate ...
5
votes
5answers
17k views

List of databases used for a sharepoint 2010 farm?

How to find the list of databases are used by a SharePoint 2010 Farm, including content databases, service application databases and configuration database.
5
votes
4answers
8k views

Update-SPSolution does not Deploy Solution

I am trying to deploy or update a WSP solution to SharePoint in a script using Update-SPSolution. The problem I have is that if this is the initial install I need to use Add-SPSolution and then ...
5
votes
3answers
8k views

Add group to Library permissions using powershell

I have written a script that created a document library called "Audit Logs" for every site collection in our environment. I then wanted to ensure that only Site Collection administrators and the ...
5
votes
6answers
17k views

Error - Get-SPWeb in Powershell

I am running this simple command from powershell under a user context, who has db_owner and SharePoint_shell rights to the SharePoint_config database. I get the following error: PS ...
5
votes
3answers
126 views

can not modify AllowGridEditing using powershell

I wrote the following script :- Get-SPWeb http://vstg01/CustomerPortal/with/ $list = $web.Lists["Meeting"] $field = $list.Fields["Item Number"] $field.ShowInNewForm = $False $field.ShowInEditForm = ...
5
votes
3answers
8k views

SPSite.allwebs returns error

First of all sorry if this is an obvious question, I searched a lot but can't find the solution. When I open an spsite in powershell like this: $spsite = Get-SPSite "https://adress" And then I ...
5
votes
1answer
8k views

Adding a site column and add it to a content type from PowerShell issue

Within a PS script, I'm trying to add a site column and add this column to a custom content type. Here is my script : add-pssnapin Microsoft.SharePoint.PowerShell -EA 0 function ...
5
votes
5answers
10k views

SharePoint 2010 - Backup Term Store as CSV

Is there any PowerShell Script to export the Term Store? I have not found any OOTB solution, only import as csv, but no export as csv. Is there a script which can export the Term Store as csv? (So ...
5
votes
3answers
7k views

Use Powershell to iterate through all UserProfile properties

The following script spits out all UserProfile properties for users on Sharepoint 2007: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") ...