Powershell script for mailbox permissions

Hello,
Part of my tasks as an Exchange admin is to give access to shared mailboxes. The access usually are:
Send AS
Receive As
Send on Behalf Of
Full mailbox
Is there a powershell script out there that does all of the above?
thanks,
Alexis

Hi,
Probably not prewritten, but you can check the repository for starters:
http://gallery.technet.microsoft.com/scriptcenter
EDIT: I should mention - this isn't too hard to write, so this could be a good opportunity to learn how to get around in the EMS.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing)

Similar Messages

  • Powershell script for security groups and users for multiple share folders

    Hi scripting team,
    I need your help with powershell script for the below queries 
    1. List out the security groups for more than one server share path and output it to a file ( csv ) 
    For eg.
    If the are are two share paths 
    \\servername\foldermain\folder1
    \\servername\foldermain\folder2
    So I needs the list of security groups for each share path
    And the output needs to be under each any every path.
    2. Grab the users belongs to main security groups and it nested groups for more than one security group and listed the users under each and every group. No need to display nested groups. Just users belongs to main group and users under nested.
    Your teams help is much appreciated 
    Thank you.
    Thilochana kumararatne

    Hi Braham,
    Thanks for your quick reply.
    Are we able to do this on two stage method
    1. grab the security groups from the share paths
    if can grab the share path from a separate txt file than copying it to the <your path> location
    so i can modify the txt file
    once run the script
    if can the output like below to a CSV file
    \\servername\foldermain\folder1group 1group 2group 3\\servername\foldermain\folder2group 1group 2group 3then i know which groups belongs to which share paththen i can remove the duplicate groups and keep the common groups to grab the users belongs to itso with the second script same as the first copy the security groups to a txt file and the out put as below.what I needs is the users full name and the samaccount name ( user id )group 1user1user2user3
    group 2user1user2user3looking forward your help on thisThank you.Thilo

  • Executing a powershell script for checking duplicate users while creating a AD user throug ADUC console.

    Hi,
    I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
    that the user is already present in the text file.
    Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
    please provide me the approriate solutions.
    Thanks
    Prasanthi k

    Run the below Powershell Script for users are exist or not in AD. Later you can create the users.
    #Find Users exist in AD or Not?
    #Biswajit Biswas
    $users = get-content c:\users.txt
    foreach ($user in $users) {
    $User = Get-ADUser -Filter {(samaccountname -eq $user)}
    If ($user -eq $Null) {"User does not exist in AD ($user)" }
    Else {"User found in AD ($user)"}
    Active Directory Users attributes-Powershell
    http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
    Regards~Biswajit
    Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
    MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
    MY BLOG
    Domain Controllers inventory-Quest Powershell
    Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
    Generate a Report for installed Hotfix for Bulk Servers

  • Using Echo Command in PowerShell Script for Configuration Item

    Hello All,
    Before you tell me to post my PowerShell question to the PowerShell Forum, please know that the PowerShell portion of my task works just fine. It is the SCCM portion of my task that keeps failing, so that is why I am here. To give some background...
    There are two servers in our SCCM test environment. Both the SCCM server and SQL DB server are 2012, patched and updated.
    Test servers in my Device Collection being used for running Baselines and Reports against are 2008R2 and 2012, patched and updated.
    I have created a Configuration Item that checks to see if the FTP Server Role Feature has been installed on a 2008 or 2012 server. To do the check, I am using the following PowerShell script:
    (get-windowsfeature -Name Web-Ftp-Server).Installed
    When I log into my 2008R2 and 2012 test servers, and run this command directly on the server, it will return a "True" if the FTP Server Role Feature is installed on either server, and a "False" if it is not installed. Basically,
    it works as advertised.
    When I setup my Configuration Item and then deploy my Baseline, or run a report against my device collection of test servers, SCCM will return a correct response (True or False) for the 2012 test server, but throws the following error for the 2008R2
    server:
    0x87df00329 application requirement evaluation or detection failed
    Google searches for this have not been very helpful.
    Now, when I created the Configuration Item and referenced PowerShell, the configuration screen has the following note:
    "Specify the script to find and return the value to be assessed for compliance on client devices. Use the echo command to return the script value to Configuration Manager."
    Since I did not include an echo command in my PowerShell script above, I figured that was my problem, so I did the following:
    Logging onto both of my test servers (2008R2 & 2012) I was able to successfully run the following PowerShell commands and get the expected responses of True or False:
    (get-windowsfeature -Name Web-Ftp-Server).Installed | echo
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-output (http://technet.microsoft.com/en-us/library/hh849921.aspx)
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-host (http://technet.microsoft.com/en-us/library/ee177031.aspx)
    However, when I use any of these PowerShell commands in my Configuration Item, NEITHER of my test servers returns a response to the SCCM server.
    When I check the report, both servers show as "Unknown" and when I click on the number 2 (as in 2 servers unknown), the following report page (List of unknown assets for a configuration baseline) has absolutely no data/information at all.
    So...I am at a loss.
    SCCM tells me to use an echo command to return a script value to Configuration Manager. The PowerShell scripts above, with the various echo related commands, work just fine on the servers themselves, but they return no information when run via SCCM.
    What am I missing?
    Any help will be appreciated.
    Thanks in advance for your time.

    Sorry for my ignorance, but I don't understand. (I forgot to mention that I am new at both PowerShell and SCCM.)
    After I change the PowerShell script to add the echo/write-output/write-host cmdlet, I open the ConFig Item and "Clear" the PowerShell script and then re-add it. When I do that, it correctly shows the change in the ConFig Item.
    Next I open the Baseline, then open the ConFig Item within the Baseline to make sure the change is reflected there as well, which it is.
    I then deploy the Baseline to my Device Collection. After that, I run a report against the Baseline and Device Collection and it returns the "Unknown" result.
    If I open the PowerShell script and remove the echo/write-output/write-host cmdlet, then go through the rest of the process of updating and reporting, the result it returns changes, showing one server in compliance and the other server out of compliance,
    which leads me to think that all changes have taken correctly.
    Does that sound right? If I manually deploy the Baseline, is that the same as the client retrieving policies from the management point?
    Sorry to be so thick but I'm learning as I go.
    Thanks again for your help.

  • FIM Reporting ETLScript PowerShell Script for SCSM 2012?

    Hi,
    The FIM Reporting Deployment Guide is great, however on a few occasions it forgets to mention where you meant to execute things (http://technet.microsoft.com/en-us/library/jj133855(v=ws.10).aspx) .
    For example, if it wasn't for the screenshot in the article, we would not have known that we need to run the ETLScript from the FIM Service/Portal server.
    Everything until the ETLScript has thus far worked; and we have deployed the Service Manager 2012 console on the FIM Service/Portal server (since we are using SCSM 2012 for FIM Reporting).
    However, it appears that the ETLScript (in the deployment guide) has been written for SCSM 2010.
    So, has Microsoft or anyone published an updated SCSM 2012 ETLScript script?
    Thanks,
    SK

    Could this be it?
    http://gallery.technet.microsoft.com/PowerShell-Script-to-Run-a4a2081c

  • Powershell script for deleting sitecollection and its content db

     want to know whether any powershell script is avlble for deleting the sitecollection and its content db at oneshot!
    i have created sitecollection specific content db and i wanna delete the same.

    Hi,
    Below link will help to delete site collection
    http://technet.microsoft.com/en-us/library/cc262392(v=office.15).aspx
    Thanks
    Somnath Matere

  • Powershell script for removing some users from a particular Site Collection

    Hi,
    I am looking for a PowerShell script to delete a few users from a particular Site Collection. I am unable to delete them from/_catalogs/Users/simple.aspx page therefore need some other medium to
    delete users from the site collection.
    My ultimate aim is to have no user profile with "tp_deleted" field's value as 0 in the USERINFO table. Currently there are about 40 odd users with this field's value as 0 and this is affecting my crawling of this content database.

    Thanks for the reply Alex & eHaze,
    I have a content source of root site which crawls all the site collections under it. Out of the 9 site collections, only 8 are getting crawled and 1 doesn't get crawled at all. The error in the crawl logs is 
    The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: Value does not fall within the expected range. )
    I tried a lot of things, searched over the net and finally found
    this which helped me solve the same issue in my development environment. I deleted these users from userInfo table and ran a full crawl. And the issue was fixed.
    Now since I cannot delete the users from userInfo table directly from PROD environment, I used .../_catalogs/Users/simple.aspx list
    to delete users from this site collection. While some of the users I could delete, quite a few I could not. Clicking on the profile redirected me to the home page rather than the info page of the profile. 
    This
    is why I have to delete these users from the site collection.
    Alex - the link you shared, I guess it is for a web application level.
    eHaze - the script you shared throws this error:
    Get-SPSite : Cannot find an SPSite object with Id or Url: http://dev-apps/divisions/BT. At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:4 char:19
    + $site = get-spsite <<<< $siteURL
    + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite:
    SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
    You cannot call a method on a null-valued expression.
    At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:9 char:27
    + $site.SiteUsers.Remove <<<< ($LoginName)
    + CategoryInfo : InvalidOperation: (Remove:String) [], RuntimeExc
    eption
    + FullyQualifiedErrorId : InvokeMethodOnNull
    hope this info helps.

  • Powershell script for Use this termset for site navigation in tem store management tool in central admin

    can anyone pls point out whats the power shell script for "use this  termset for site navigation" in the termstore management tool in my central  admin';s manage serv appln-->managed metadata serv appln ->term styore mgmnt tool
    i would like to check this "checked" through powershell script
    help is appreciated!

    Hi,
    To check if the term set has been set to be used for site navigation, we need to check the
    NavigationTermSet.IsNavigationTermSet property for the term set.
    Here is the code example for using PowerShell to get the setting:
    $site=Get-SPSite "your site collection URL";
    $session = Get-SPTaxonomySession -Site "your site collection URL ";
    $termStore = $session.TermStores["Managed Metadata Service"];
    $Group = $termStore.Groups[“Group Name”];
    $TermSet = $Group.TermSets[“Term Set Name”];
    $navTermSet = [Microsoft.SharePoint.Publishing.Navigation.NavigationTermSet]::GetAsResolvedByWeb($termset, $site.RootWeb, "GlobalNavigationTaxonomyProvider");
    write-host $navTermSet.IsNavigationTermSet
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • PowerShell script to check permissions given to "NT Authority\All Authenticated Users" and..

    Hi there,
    On my SharePoint site - some places (Sites/Lists etc) have given permissions to "NT Authority\All Authenticated Users"
    We need to remove these permissions and instead give permissions to "Forest1\Domain Users" and "Forest1\Domain Users"
    PowerSHell script to do above will be appreciated.
    Thank you so much.

    Hello,
    In order to check whether "NT Authority\All Authenticated Users" are present in your site use this reference - Link
    Remove permission script reference - Link
    Finally grant permission script reference - link
    Kindly mark it as answer if it helps you.
    -Hatim

  • SharePoint 2010 Powershell scripting for user profile

    Please help to have a powershell script which will provide the details related to user profile service application like:
    Number of user profiles:
    Number of user properties
    Number of Organization properties
    Number of Organization profiles
    Number of Audiences
    Un compiled Audiences
    Audience Compilation status
    Last compilation time
    Synchronization schedule
    Santosh sethi

    Hi,
    If you're looking for prewritten scripts, you can check these two places:
    http://gallery.technet.microsoft.com/scriptcenter
    http://get-spscripts.com/
    You should read this too:
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • PowerShell script for AD name change

    I need to change all users logon name in AD to their first name.last name    Server 2003

    Here is my suggestion of a PowerShell V1 script to rename all users (sAMAccountName):
    # Filter on all users that have givenName and sn assigned.
    $searcher=[adsisearcher]'(&(objectCategory=person)(objectClass=user)(givenName=*)(sn=*))'
    [void]$searcher.PropertiesToLoad.Add('distinguishedName')
    [void]$searcher.PropertiesToLoad.Add('sAMAccountName')
    [void]$searcher.PropertiesToLoad.Add('givenName')
    [void]$searcher.PropertiesToLoad.Add('sn')
    $searcher.PageSize
    = 200
    $Results =
    $searcher.FindAll()
    ForEach ($Result
    In $Results)
        # Retrieve values.
        $DN
    = $Result.Properties.Item("distinguishedName")
        $NTName
    = $Result.Properties.Item("sAMAccountName")
        $First
    = $Result.Properties.Item("givenName")
        $Last
    = $Result.Properties.Item("sn")
        # Construct desired "pre-Windows 2000 logon" name.
        $NewName
    = "$First.Last"
        # Make sure new name 20 characters or less.
        If ($NewName.Length
    -gt 20)
            # I don't know how to trim $First in PowerShell to make $NewName 20 characters.
        # Check if name should be updated (case insensitive).
        If ($NTName
    -ine $NewName)
            # Trap possible error.
            Trap
                "Unable to rename user $DN to $NewName"
                "Error description: $_"
                Continue
            # Bind to user object in AD.
            $User
    = [ADSI]"LDAP://$DN"
            # Assign new name.
            $User.sAMAccountName
    = $NewName
            # Save the change to AD.
            $User.SetInfo()
    Test first, by commenting out the SetInfo() statement and echo $DN and $NewName for all  users. Note that the script could trim $First to limit $First.$Last to 20 characters, but I could not find a way to do this. Also, this script does nothing to prevent
    duplicate sAMAccountName values, but the possible error will echo to the screen.
    Richard Mueller - MVP Directory Services

  • PowerShell Script for Setting the Welcome Page View of a document set

    Hi,
    We are using document set in the document library and we have created the separate view in the document set and it will show only particular metadata columns. We need to change from default view to another view. For this, we need to write the power shell
    script and update the document set welcome page view link in the document set template. Please let me know how we can get this.
    Thanks,
    Mylsamy

    Hey Mylsamy,
    welcome page view is stored in $contenttype.XmlDocuments. Here is how you can change the view using powershell:
    $web = Get-SPWeb "WEBURL"
    $list = $web.Lists["LISTNAME"]
    $contenttype = $list.ContentTypes["CONTENTYPENAME"]
    $viewid = $list.Views["VIEWNAME"].Id
    $xmldocs = $contenttype.XmlDocuments
    foreach($xmldoc in $xmldocs)
    if($xmldoc.Contains("WelcomePageView"))
    Write-Host "XML contains WPV"
    $newview = [XML] @"
    <wpv:WelcomePageView xmlns:wpv="http://schemas.microsoft.com/office/documentsets/welcomepageview" ViewId="$viewid" />
    $xmldocs.Delete("http://schemas.microsoft.com/office/documentsets/welcomepageview")
    $xmldocs.Add($newview)
    break;
    $contenttype.Update($updateChildren, $false)
    Write-Host "Welcome Page View updated at " $list.Title
    Regards,
    Alexander 

  • Write-Progress in PowerShell script for installing Missing Updates

    Hi, I had a previous question here
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/88931488-3b2c-4c08-9ad3-6651ba9bbcef/action?threadDisplayName=progress-indicator-for-installing-missing-sccm-2012-r2-updates
    But that method is not working as expected.  The progress bar displays then continues to increment past 100 throwing an error each time.
    I'm thinking I could use a foreach loop for the missing updates but I'm just lost when it comes to Powershell syntax.
    For example:
    # Get the number of missing updates
    [System.Management.ManagementObject[]] $CMMissingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" -namespace "ROOT\ccm\ClientSDK") #End Get update count.
    $result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    #Install missing updates.
    #Begin example code, not tested.
    Foreach ($update in $CMMissingUpdates)
    $i++
    If ($CMMissingUpdates.count) {
    $CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
    Do {
    Start-Sleep -Seconds 15
    [array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
    #end my example code.
    #The code below is working to install updates but Write-Progress isn't.
    If ($CMMissingUpdates.count) {
    #$result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    $CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
    #Set the missing updates to variable for progress indicator.
    $updates = $CMMissingUpdates.Count
    $Increment = 100 / $updates
    $Percent = 0
    Do {
    Start-Sleep -Seconds 15
    [array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
    #Not 100% sure $result.UpdateCountBefore is needed below.
    $result.UpdateCountBefore = "The number of pending updates for installation is: $($CMInstallPendingUpdates.count)"
    Write-Progress -Activity "Updates are installing..." -PercentComplete $Percent -Status "Working..."
    $Percent = $Percent + $Increment
    } While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan -Start $StartTime -End $(Get-Date)) -lt "00:45:00"))
    Write-Progress -Activity "Updates Installed" -Status "Done" -Completed
    } ELSE {
    $result.UpdateCountAfter = "There are no missing updates."}
    $result

    The increment should be 100  / (max number of items)
    That will not exceed 100 through (max number of items ) iterations in a loop
    Mathematically that can be written as 
    100 / (Max Number of items) * (max number of items ) iterations in a loop
    = 100 * ( (Max Number of Item) / (Number Iterations in a loop) )
    = 100 * 1 = 100
    The (max number of items) and (Number of Iterations in a loop ) need to be based on the same number.
    In the script, it is not based on the same number.
    The maximum number of items is $CMMissingUpdates.Count
    The number of iterations in the loop  is based on the condition 
    ($CMInstallPendingUpdates.count -ne 0)
    Which causes the iterations of the loop to exceed $CMMissingUpdates.Count
    Assuming the $CMInstallPendingUpdates.count is going down (is decremented) through the loop, then
    $Increment = 100 /
    $CMInstallPendingUpdates.count

  • Powershell Script for Exchange- Storagelimitstatus wont return any data.

    I am trying to run the following script using PowerGUI and its working but one piece. The storagelimitstatus isn't returning any data. Any impute would great.
    Here is what I wrote. 
    If (-not (Get-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue))
    {   Try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction Stop }
        Catch { Write-Host "Unable to load Exchange tools because ""$($Error[0])""" -ForegroundColor Red ; Exit }
    Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,IssueWarningQuota, storagelimitstatus,ProhibitSendQuota,ProhibitSendReceiveQuota,@{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics
    $_).ItemCount}}, Database| Export-Csv "\\pc1417\c$\Scripts\UserMailboxSizes.csv" -NoTypeInformatio

    StorageLimitStatus is a property extracted by Get-MailboxStatistics and not Get-Mailbox.Try below and check if that works!
    Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,IssueWarningQuota,@{label="StorageLimitStatus";expression={(Get-MailboxStatistics $_).StorageLimitStatus}},ProhibitSendQuota,ProhibitSendReceiveQuota,@{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database| Export-Csv "\\pc1417\c$\Scripts\UserMailboxSizes.csv" -NoTypeInformation
    Pavan Maganti ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful&quot; if it really helps and &quot;Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your
    question. ~~ This Information is provided is &quot;AS IS&quot; and confers NO Rights!!

  • Powershell scripts for itunes

    howdy y'all,
    i've recently been learning windows powershell. it's part of every win7 install and i think it's included in vista. for xp, you hafta download it from ms.
    anyway, i have a script or two that i was playing with and wondered if someone else was interested the same. perhaps someone who really understands programming could improve my amateur coding. (grin)
    the next post has the 1st script.
    take care,
    lee

    howdy y'all,
    this one updates song ratings ...
    IF
    - rating is zero
    -- AND playedcount is greater than or equal to playedcount threshold
    OR
    - rating is zero
    -- AND skippedcount is greater than or equal to skippedcount threshold
    -- AND playedcount less than playedcount threshold
    i figure that if i've skipped a song more often than i have played it and i've skipped it at least a certain number of times, then i pro'ly don't care too much for it. (grin)
    since i can't find a way to correctly post CODE, i posted a link to the stored file. that's here ...
    http://dl.dropbox.com/u/5952017/Itunes_Set-Default-Rating.ps1
    there is a lot of extra stuff in there that can be removed. the "save log file to system temp folder" and the "what's happening now" stuff, for instance.
    other than the purely feedback-oriented, yes-something-really-is-happening stuff, can you see a way to make it work better?
    take care,
    lee

Maybe you are looking for