How to get site permissions using power shell ?

Hello,
I require to get list of granted permissions ( Group/users ) which we see from Site Actions > Site Permissions.
would you please let me know how can I fetch the same using power shell ?
Thanks and Regards,
Dipti Chhatrapati

Hello,
I have found the same using following script :
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { 
Add-PSSnapin "Microsoft.SharePoint.PowerShell" 
#Define variables 
$site = Get-SPSite "Site collection URL"
#Get all subsites for site collection 
$web = $site.AllWebs
#Loop through each subsite and write permissions
foreach ($web in $web) 
if (($web.permissions -ne $null) -and ($web.hasuniqueroleassignments -eq "True")) 
Write-Output "****************************************" 
Write-Output "Displaying site permissions for: $web" 
$web.permissions | fl member, basepermissions 
elseif ($web.hasuniqueroleassignments -ne "True") 
Write-Output "****************************************" 
Write-Output "Displaying site permissions for: $web" 
"$web inherits permissions from $site" 
Write-Host "Finished." 
$site.dispose() 
$web.dispose()
Hope it helps others !
Thanks and Regards,
Dipti
Dipti Chhatrapati

Similar Messages

  • Get the web part properties of documeny lib view web part using power shell

    Hi,
    Am looking to get the propeties of a list view web part - a document library's  list view web  part- using PowerShell
    Manually I am able to do the same: the steps followed by me is given below:
    1) I went to the
    http://srvr1:123/sites/enggtest/mydoclib1/forms/allitems.aspx
    2) Edit the page
    3) Edit the  mydoclib1 view web part
    4) go to the peroperties
    5) Check the Server Render checkbox
    is there   anyway i can do this using power shell.

    The code below assumes that the webpart is at index 0:
    $SiteUrl = "http://aissp2013/sites/TestSite/"
    $pageURL = "http://aissp2013/sites/TestSite/Lists/MyList/AllItems.aspx"
    $web = Get-SPWeb $SiteUrl
    $wpm = $web.GetLimitedWebPartManager($pageURL, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    $wp = $wpm.WebParts[0]
    $wp.ServerRender = $true
    $wpm.SaveChanges($wp)
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Using Power shell script how to hidden SharePoint existing features.

    Hi Firends,
    Using Power shell script how to hidden SharePoint existing features.
    Please help me.
    Thanks,
    Tiru
    Tiru

    The Hidden property is set within the solution, so you would need access to the source code in order to set it.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Programmatically create SPGroups using power shell

    hi,
     I wanna create sp groups  programmatically using power shell,
    can anyone pls point me in the right direction.
    i have gone through this code:
    $GroupName = "mygrp1"
    $owner =""
    $member =""
    $Description =""
     $SPWeb.SiteGroups.Add($GroupName, "", "","")
     $SPGroup = $SPWeb.SiteGroups[$GroupName]
     $SPWeb.RoleAssignments.Add($SPGroup)
     $SPWeb.Dispose() 
    just wanted to know whether should i add few code  related with sproleassignments/ sproeldefintions etc we used to do in SP OM through c#
    help is appreciated!

    There are two parts.
    1. Adding a group to the site collection.
    2. assigning permissions to the group.
    The PS script given below first ensures if the group exists or not and then executes the logic. If the group already exists, then it will not add group the site. I would recommed to test it in Dev environment and then use in Prod.
    $site=Get-SPSite $siteCollectionUrl
    $rootSite=$site.RootWeb
    $member=$rootSite.Users["User_Name"]
    $user=$rootSite.Users["Other_User_Name"]
    try
    $grp=$rootSite.SiteGroups["Group Name"]
    catch
    if($grp -eq $null)
    $rootSite.SiteGroups.Add("Group Name",$member, $user, "Group Description")
    $grp=$rootSite.SiteGroups["Group Name"]
    $roleDef=$rootSite.RoleDefinitions.GetByType([Microsoft.SharePoint.SPRoleType]::Contributor)
    $roleAssigns=New-Object -TypeName Microsoft.SharePoint.SpRoleAssignment -ArgumentList $grp
    $roleAssigns.RoleDefinitionBindings.Add($roleDef)
    $rootSite.RoleAssignments.Add($roleAssigns)
    $rootSite.Update()
    Pradip T. ------------- MCTS(SharePoint 2010/Web)|MCPD(Web Development) https://www.mcpvirtualbusinesscard.com/VBCServer/paddytakate/profile

  • How to get all records using Invoke-webrequest?/Why Invoke-webrequest returns only first 2000 Records?

    invoke-webrequest content returning only 2000 records though it has around 4000 records in web api.
    The same url if I give in excel oData Data feed I am getting all the records.
    See the below script
    Script:
    $QueryResult= (Invoke-WebRequest -Uri $ODataURI -UseDefaultCredentials)
    [xml]$xmlResult=$QueryResult.content
    foreach($obj in $xmlResult.feed.entry.content.properties)
    $Name=$obj.Name;
    $IsAvail=$obj.isAvail.'#text';
    $PGroup=$obj.PGroup
    I am exporting the above result as a CSV file and my CSV file contains only 2000 records. 
    But,  $xmlResult.feed.Count --> it Shows 4000 Records.
    The same Odata url if I give in excel oData Data feed I am getting all the 4000 records.
    So Please help me how can I get all the records using power shell.
    Thanks
    A Pathfinder..
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Hi Jo Swa(K.P.Elayaraja)-MCP,
    Would you please also post code which is used to export the records?
    In addition, to use the cmdlet invoke-RestMethod to work on ODate feeds, please refer to this article:
    Interacting with TechEd NA 2012 Schedule using PowerShell v3
    I hope this helps.

  • Create & Start UPS Service Using Power-Shell in SharePoint 2013

    I want to know that is there a way to create a User Profile Synchronization Service using Power-Shell in a SharePoint 2013 Enterprise site? If so then how am I supposed to do that and start the User Profile Synchronization Service using the Power-Shell.
    I'm seeking this help because the UPS service is stuck in Starting and both FIM Services are also not started but they are in Automatic start mode.
    Could someone try to solve this matter.
    Thanks,
    regards,
    Chiranthaka

    start it from powershell will not help you resolve the issue.
    Try below articles:
    http://myspexp.com/2011/04/28/user-profile-synchronization-servicehangs-on-starting-i-fixed-it/
    troubleshoot this issue:http://www.harbar.net/articles/sp2010ups2.aspx
    http://www.sharepointdiary.com/2012/09/user-profile-synchronization-service-stuck-at-starting.html#ixzz2aXArH7zX

  • Deploy wsp through Power Shell- start stop SP admin service and run execadmsvcjobs command using power shell

    Hi,
     Can anyone pls point me any link/ src code  for  deplyoing wsp using power shell. I know I can deploy it through Add-spsolution and install-spsolution, the issue is that, it will give   "status - stuck in deploying scheduled..."
    and i need to restart the sharepoint services - services.msc --> SP administration and timer services - and then i need to run the exceadmsvcjobs command to deploy / update the wsp  successfully in solution store.
    i mean, whats the power shell equivalent of these tasks. or anyone has already scripted these.
    if i elaborate little bit, would like to know how to automatically Retract, Remove, Add and Deploy SharePoint 2010 WSP Solution Files with PowerShell

    ok, i have found  the same :
     here its : hope this will help someone.
    function wait4timer($solutionName)
    $solutionName ="TestingWSP.wsp"
    $solution = Get-SPSolution | where-object {$_.Name -eq $solutionName}
    if ($solution -ne $null)
    Write-Host "Waiting to finish soultion timer job" -ForegroundColor Green
    while ($solution.JobExists -eq $true )
    Write-Host "Please wait...Either a Retraction/Deployment is happening" -ForegroundColor DarkYellow
    sleep 5
    Write-Host "Finished the solution timer job" -ForegroundColor Green
    try
    # Get the WebApplicationURL
    $MyWebApplicationUrl = "http://srvr:21778/";
    # Get the Solution Name
    $MywspName = "TestingWSP.wsp"
    # Get the Path of the Solution
    $MywspFullPath = "D:\myWorkspace\TestingWSP.wsp"
    # Try to get the Installed Solutions on the Farm.
    $MyInstalledSolution = Get-SPSolution | Where-Object Name -eq $MywspName
    # Verify whether the Solution is installed on the Target Web Application
    if($MyInstalledSolution -ne $null)
    if($MyInstalledSolution.DeployedWebApplications.Count -gt 0)
    wait4timer($MywspName)
    # Solution is installed in atleast one WebApplication. Hence, uninstall from all the web applications.
    # We need to unInstall from all the WebApplicaiton. If not, it will throw error while Removing the solution
    Uninstall-SPSolution $MywspName -AllWebApplications:$true -confirm:$false
    # Wait till the Timer jobs to Complete
    wait4timer($MywspName)
    Write-Host "Remove the Solution from the Farm" -ForegroundColor Green
    # Remove the Solution from the Farm
    Remove-SPSolution $MywspName -Confirm:$false
    sleep 5
    else
    wait4timer($MywspName)
    # Solution not deployed on any of the Web Application. Go ahead and Remove the Solution from the Farm
    Remove-SPSolution $MywspName -Confirm:$false
    sleep 3
    wait4timer($MywspName)
    # Add Solution to the Farm
    Add-SPSolution -LiteralPath "$MywspFullPath"
    # Install Solution to the WebApplication
    #Install-SPSolution -Identity <SolutionName> -WebApplication <URLName> [-GACDeployment] [-CASPolicies]
    install-spsolution -Identity $MywspName -WebApplication $MyWebApplicationUrl -GACDeployment #-FullTrustBinDeployment:$true -GACDeployment:$false -Force:$true
    # Let the Timer Jobs get finishes
    wait4timer($MywspName)
    Write-Host "Successfully Deployed to the WebApplication" -ForegroundColor Green
    catch
    Write-Host "Exception Occuerd on DeployWSP : " $Error[0].Exception.Message -ForegroundColor Red
    ref :
    http://www.sharepointpals.com/post/How-to-Deploy-a-SharePoint-2013-Solution-(WSP)-in-the-Farm-using-PowerShell

  • Activate design manager (sandbox) solution using power shell - SP2013

    Hi All,
    I have a  design manager (sandbox) solution and deployed in site collection. I am trying to upload the new version using power shell.
    Uninstall-SPUserSolution , Remove-SPUserSolution, Add-SPUserSolution and finally doing Install-SPUserSolution on that time i am getting the following error " Install-SPUserSolution : This file may not be moved, deleted,
    renamed, or otherwise edited." kindly help me for this issue.
    Regards,
    Santhosh

    Can you please provide more details on your solution package? Did you use SharePoint Design Manager to create design package? If that is the case then if you read the following article it reads and 
    "In SharePoint 2013 you cannot uninstall an imported design package, and you should never attempt to deactivate a design package through the solution gallery." 
    I think if you read the article it might be helpful.
    http://msdn.microsoft.com/en-us/library/jj862342.aspx
    Amit

  • Add or delete the summary links web part's[deployed as a VS solution] link using power shell

    hi,
     i am having a visual studio custom solution having page layouts implemented. In that solution i am having 1  summary links web part and in that i have hard coded few links and this is  deployed on ion dev and staging env.
    Now, the issue is : yesterday, customer came to me and asking me to change the links from http://abc to
    http://xyz/ in this summary links. can anyone pls throw some light,such that i can change this link using a power shell script. i know  if i go the VS solution and change the link and redeploy [ update-spsolution
    command] will work.
    but if the links are changing regularly , chnaging the vs solution and redeploying is not a good practice.
    if i elaborate li'l bit,  i am adding the screen shot : i need to get the summary link column's value and  need to update[ delete xisting one and  add new ones ]
    is there any way , i can change the links using power shell script?
    i tried the belwo power shells cript to get the page in the page layouts :
    $web = get-spweb
    "http://siteurl"
    $pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $pagesListName = $pubWeb.PagesListName
    $defaultAspxFile = $pubWeb.GetPublishingPage("$pagesListName/mycustomhome.aspx")
    $summaryLinkFieldValue = New-Object
    Microsoft.SharePoint.Publishing.Fields.SummaryLinkFieldValue
    // here am getting the NULL VALUE
    can i get the  summary links field correctly and  delete / modify the same?
    help is appreciated!
    ##$groupLink = New-Object
    Microsoft.SharePoint.Publishing.SummaryLink("My group")
    #$groupLink.IsGroupHeader = $true $summaryLinkFieldValue.SummaryLinks.Add($groupLink)

    Hi Shabeaut,
    Could you tell us why do you want to add a link web part to the master page for all pages?
    I tested that Summary Links web part (and other types of web parts) added in the master page under Quick Launch couldn't be edited when I edit the pages inherited from v4.master page, it looks by design.
    Have you tried using the Quick Launch to add the link instead if you want to show links in all pages.
    Thanks
    Daniel Yang
    TechNet Community Support

  • New-CMGlobalCondition unable to create New script Condition using Power Shell

    I am using config Manger 2012 and trying to use power shell cmdlet to create a new Global Condition using PowerShell but its not working for me using this
    Do not understand how to use that command any idea.
    New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 -Name test -ScriptLanguage PowerShell
    Error comes as 
    New-CMGlobalCondition : No object corresponds to the specified parameters.
    At line:1 char:1
    + New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 - ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Confi...onditionCommand:NewGlobalConditionCommand) [New-CMGlobalCondition], I 
       temNotFoundException
        + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.AppModel.Commands.NewGlobalConditionCommand

    Hi,
    What's your version of SCCM? I ran this command line on SCCM 2012 R2 CU2.
    It seems SCCM 2012 R2 CU2 fixed New-CMGlobalCondition cmdlet issue.
    "The New-CMGlobalCondition cmdlet incorrectly requires use of the
    -WhereClause parameter."
    Description of Windows PowerShell changes in Cumulative Update 2 for System Center 2012 R2 Configuration Manager
    Best Regards,
    Joyce

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to get iccid by using imei?i had lost my iphone and i want to find it back.

    how to get iccid by using imei?i had lost my iphone and i want to find it back.

    Ocean20 wrote:
    Not sure about ICCID but you can get your IMEI by going to the computer you normally sync to and open iTunes there click on edit then preferences then on the devices tab and then hover mouse over your backup and the IMEI and other info on your phone will appear
    Interesting. Yet another of the many Easter eggs dispersed throughout the system.

  • How to get the workcentres used in the routing out of 2 alternate routings

    Dear All,
    I would like to know how to get the workcentres used in the routing out of 2 alternate routings.
    I referred PLKO got the Task List Type (PLNTY), Group(PLNNR), Group Counter(PLNAL), Plant(werks).
    I passed this in to PLPO, The problem in PLPO is we don’t have the distinguishing field Group Counter(PLNAL), so I am getting all the ARBID including both alternates.
    How to get the ARBID with respect to Groupcounter 1 alone.
    If a get the ARBID , I can get the ARBPL from CRHD.

    HI,
    Use PLAS Table also.  you have to use PLKO> PLAS> PLPO.
    Pass PLNNR & PLNAL in PLAS and get PLNNR & PLNKN.
    Then pass these into PLPO.
    work centers from CRHD
    Regards,
    Krishna Mohan
    Edited by: Krishna Mohan N on Jan 31, 2008 12:28 PM

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • How to get last column used in report sorting?

    hi,
    how to get last column used in report sorting?
    simon

    How to identifiy which column was sorted having different reports on page?
    just use:
    'YOUR_STATIC_REGION_NAME' instead of p_static_id,
    :APP_ID for p_app_id,
    :APP_PAGE_ID for p_page_id
    :APP_USER_ID for p_app_user.
    and dont forget to grant SELECT on #OWNER# to APEX_030200.WWV_FLOW_PREFERENCES$
    good luck and thank you Juergen.Schuster
    Simon

Maybe you are looking for

  • Error in Loading a clob via external table (Oracle 10.2.0.3 On Solaris 8)

    Hi, I am trying to insert a csv file as a single record as a CLOB (one row for entire csv file) and trying to do that via external table. But unalbe to do so. Following is the syntax I tried with: create table testext_tab2   ( file_data clob   organi

  • Problem with the Screen me80fn

    Dear Team, i have opened the PO in me23n. later in thye same screen, i have typed /nme80fn, trhen i went to me80fn tcode. The user sees the Plant code , PO number being defaulted. He did not want this to happen . Plz help me regarding this issue .

  • Macbook Pro 13" + Dell US2410

    Hello fellas, bought a dell 2410 2 weeks ago and find that when i edit stuffs on lightroom 3, it kind of lags as compared to when i am running LR3 on my macbook itself without using the external monitor. would like to ask if the graphic card on board

  • 2 users with same user id in OIM!

    hi, can you please help me with this production environment issue! there are 2 users with same userid, same first name and last name in OIM but are only one is present in all of the target resources. i just dont know how to delete such user, as the t

  • Error while tryong to create JCo destination

    Hi Experts    I am geting null pointer exception . When i am clicking on create Jco destnation button. Although i have done all configuration in SLD.      Kindly help me with pdf or your valuable suggestion.