Archive for December 30, 2010

Powershell script for SharePoint to list all users in all groups

I needed a quick result without using any thirdparty applications to find all users in all groups of a SharePoint web application.

I found a great powershell script from this site that did just the trick for SharePoint 2007 and SharePoint 2010

http://techtrainingnotes.blogspot.com/2010/12/sharepoint-powershell-script-to-list.html

For both SharePoint 2007 or 2010 in any PowerShell:

<pre>[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = New-Object Microsoft.SharePoint.SPSite("http://yourservername/sites/yoursitecollection ")
$groups = $site.RootWeb.sitegroups
foreach ($grp in $groups) {"Group: " + $grp.name; foreach ($user in $grp.users) {"  User: " + $user.name} }
$site.Dispose()</pre>
<pre>

or for SharePoint 2010 in the SharePoint 2010 Management Shell:

<pre>$site = Get-SPSite http://yourservername/sites/yoursitecollection
$groups = $site.RootWeb.sitegroups
foreach ($grp in $groups) {"Group: " + $grp.name; foreach ($user in $grp.users) {"  User: " + $user.name} }
$site.Dispose()</pre>

Simply change the web application to point to your site and save the script to a ps1 file. To get the script to dump the info to a file do the following.

script.ps1 > File.txt

That should dump all the permissions to file.txt in the directory you are running script.ps1 from.

Post to Twitter

Changing SharePoint 2010 service account password

A cool new feature in SharePoint 2010 is the ability to change your service account passwords from within Central Administration and SharePoint does the rest. 

Go to Central Administration -> Security -> Configure Managed Accounts

Edit the account you would like to change the password to buy clicking the appropriate edit icon

Select the “Change password now” Set account password to new value Voila! And your done!

If you however run into the above “Access is Denied” error you will need to uncheck the accounts “User cannot change password” box from within AD

Post to Twitter

SharePoint drive mappings

SharePoint drive mappings can become pretty tricky at times, so this will be a guide to those of you who experience the same issues I came across.

Prerequisites for opening SharePoint in Explorer view or old fashioned command line NET USE or even RUN \sharepoint is WebClient service on the client machine.

 

To start this service RUN services.msc and right click on WebClient and click start.  If the service is disabled you will need to Right Click -> Properties -> Start-up Type -> Automatic -> Apply and then start.

So that’s the easy part.  Once this is completed you should be able to map a drive to SharePoint.

The following methods can be used.

Open with Explorer from within SharePoint

 

Open from RUN command and type \Sharepoint with the SharePoint address

 

Open CMD and run the following command NET USE H: http://sharepoint

 

Footnotes

  • When using a FQDN to map a drive you will be prompted for credentials.  To avoid this you can extend the SharePoint Web App to the server name only.  You cannot use AAM (Alternative Access Mappings) as this will cause very strange errors when trying to Check-In documents from Word as can be seen below.

 

Cannot perform this operation. The file is no longer checked out or has been deleted.

  • You are unable to map via HTTPS from SharePoint 2007, this functionality is possible with SharePoint 2010.  You will be able to extend the web application to HTTP to avoid this.

 

  • If WebDAV is enabled and activated on IIS7 you will run into issues mapping to SharePoint 2010, I would recommend removing WebDAV from IIS7 – http://sharepointinterface.com/2009/12/28/sharepoint-webdav-and-a-case-of-the-405-status-codes/

 

 

Post to Twitter

MySite Language pack issues

Recently we needed to setup SharePoint Multilingual User Interface (MUI) using zie German language pack on SharePoint 2007.  I ran into a few issues and thought I might share my findings with you.

  • You cannot install the language pack after the MySite installation, the Language pack needs to be setup beforehand.

  • After the installation ensure you click the check box to allow users to choose their languages

  • When creating a MySite you might come across the following errors.  I have listed the issues and solutions below. 

Problem 1

The site /personal/testuser could not be created.  The following exception occured: File or arguments not valid for site template ‘SPSPERS#0’..

Solution 1

The spspers#0 template is registered in webtempsps.xml. After you have installed  a new language template, you must then copy the webtempsps from source language to new language template. For instance, the folder of english xml file is : C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATE1033XML. if I want to install German language pack, after the setup, you have to copy that file into C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATE1031XML

Problem 2

Eine cachesichere URL für “styles/controls.css” kann nicht erstellt werden. Die Datei wurde nicht gefunden. Überprüfen Sie, ob die Daten im Verzeichnis ‘layouts’ vorhanden sind.

Solution 2

Luckily for me we have Google translate 🙂 The same issue as above copy the contents of C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS1033STYLES to the C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS1031STYLES without overwriting any of the existing files.

That should do the trick.  However if you do run into the problem that the site has already been created, just goto the sites settings and delete it. 

http://mysites/personal/testuser/_Layouts/settings.aspx

Post to Twitter