0

I have been tasked with creating a report on our current SharePoint 2010 server (on prem). In this report I need to have the user/group permissions on every site and sub sites. Now I believe I have found a script that will do this for me, but this will be the first time I am running PowerShell Script ever...so I am afraid of messing anything up since it will be run on a live server.

so My question is what are the dangers of running a script on a live server and are there any pit falls I should be aware of before running the script?

link to the script I found: http://johanmeyer.ukuvuma.co.za/2013/02/22/export-all-user-permissions-from-a-sharepoint-2010-site-to-csv/

my background: IT Intern (but not really an intern?) New to scripting but have some background in Java/code in general Being groomed for SharePoint administration

thanks in advance!

1
  • 1
    First of all i would never run a script that i'm not 100% sure of what it does, for the second you should always try it out in a test or dev environment before running it in production. Jun 18, 2014 at 15:35

3 Answers 3

0

Running the script on live farm is not a big deal. If you tested it thoroughly in your test / lower farm 1st.

We ran the script in our SharePoint everyday i.e migrate user, restore site collections, create site collections etc. But we tested these before in our test farm.

Another things, how big is your farm? May be you need to schedule it after hours(non-peek hours). Just to avoid any performance issue.

5
  • our farm isn't to large, but I was planning on doing this afterhours regardless just in case something did go wrong, giving us time to fix anything. But thanks for you input! Jun 18, 2014 at 15:45
  • 1
    do you have any non-production farm? i highly recommend it to test it 1st, you can't blindly use the script which you found on internet.
    – Waqas Sarwar MVP
    Jun 18, 2014 at 15:50
  • @Wawas Sarwar MCSE unfortunately, that is another issue I am faced with, not test server available for me to work on...which is another reason I wanted to make sure I am aware of everything that can go wrong before I tried this. Jun 18, 2014 at 15:53
  • Only thing, i can see is performance hit, but off hours will take this out from pictures. Again, try to get a development machine for future.
    – Waqas Sarwar MVP
    Jun 18, 2014 at 16:00
  • thanks for the tips, I am actually setting up a 2013 farm lab on my home computer, so in the future Ill be using that as a test lab. marked your answer as correct <3 Jun 18, 2014 at 16:08
0

As you are only reading data from Sharepoint, i don't think there is any harm. You should test the script on a test server to check the results.

0

I downloaded the script and ran it in one of my dev VM's, and it worked pretty well. (Sp 2010).

But in the end of the script you need to add -global parameter to Stop-SPAssignment.

I would recommend that if you decide to run it, open PowerShell ISE as administrator, type Add-pssnapin Microsoft.SharePoint.Powershell to load the SharePoint cmdlts.

Add The script in the script panel ( View > Show Script Panel ) and change the following in the bottom of the script (Marked with *):

$site = $gc | Get-SPSite  *http://YourSiteCollectionUrlHere/*
$groups = $site.RootWeb.sitegroups

 foreach ($grp in $groups) {
    foreach ($user in $grp.users) 
        {
            $user = $user.LoginName
            $webPermissions = $site | Get-SPWeb –Limit All | Get-SPUserEffectivePermissions $user
            $listPermissions = $site | Get-SPWeb –Limit All | %{$_.Lists | Get-SPUserEffectivePermissions $user}
            ($webPermissions + $listPermissions) | ConvertTo-Csv -NoTypeInformation | Add-Content -Path c:\perms.csv 
        } 
        Add-Content -Path c:\perms.csv -Value $justData -Encoding UTF8
}
$site.Dispose()

$gc | Stop-SPAssignment *-global*

After the script have successfully executed, you should find your excel file under c:\perms.csv, but you can of course change the path to anything of your choice.

Remember that you are still doing it in your production so reconsider one last time before you run the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.