bulk accessrights setup

Welcome Forums General PowerShell Q&A bulk accessrights setup

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 3 months ago.

  • Author
    Posts
  • #73709

    Participant
    Points: 0
    Rank: Member

    Dear people i have the follow script

    # om welke gebruiker gaat het waar rechten om verleent moet worden?
    $useridentity = Read-Host "usermailbox"
    
    # welke gebruiker moet rechten krijgen
    $username = read-host "full mailaccountname"
    
    #welke rechten krijgt de gebruiker? 
    $accessrights = Read-Host "given access"
    
    set-MailboxFolderPermission -Identity $useridentity -User $username -AccessRights $accessrights
    

    i know it is possible to have the variable to get the data from an excel file.
    But i dont know how, can anybody support me with this one?

  • #73717

    Participant
    Points: 8
    Rank: Member

    We cannot teach you how to use Powershell. You should take a little time and learn the basics of Powershell at least.
    Some good starting points you can find here: Beginner Sites and Tutorials

  • #73726

    Participant
    Points: 0
    Rank: Member

    Start with this.

    $var = import-csv -path "c:\somepath\data.csv"
    

    Help files within PowerShell are excellent. Getting familiar with them will be a big help.

    Get-Help CSV

    Shows you a list of commands that have "CSV" in them.

    Get-Help Import-CSV -ShowWindow

    Shows you the details of that one command.

    Good luck!

  • #73817

    Participant
    Points: 0
    Rank: Member

    @ Olaf Syok,

    I know the basics of Powershell but the problem was it doesnt take the built of 3 different fields.

    becouse from one collum it needs to take the username of the mailbox that i want to see who have access
    one collum is the user that needs access to the mailbox
    and the third collum is for the access rights

    so any help with that?

  • #73819

    Participant
    Points: 8
    Rank: Member

    I know the basics of Powershell but ....

    hmmm ...are you really sure? 😉 ... usually my next question would be "What did you try so far? Show your code and the errors you get". 😉

    It's slightly easier to get the data you need from a csv file than from an Excel sheet. You can use Import-CSV and loop over all the contained data sets. If you have 3 columns with the header Mailbox, account and access you could start with this:

    Import-Csv -Path YourCSVFileIncludingPath.csv -Delimiter ',' | ForEach-Object {
        #
        # here you place your code with whatever you want to do
        # you can access the single properties with "subexpressions" 
        # to the Pipeline variable
        $_.Mailbox
        $_.Account
        $_.Access
    }

The topic ‘bulk accessrights setup’ is closed to new replies.