ACL rights assignment in new user script

I've been tasked with converting an old new-user script that runs at least once a day written in VB to PowerShell. This script takes as input a CSV file we get from HR that has all necessary info and creates a user, adds them to specific groups based on
the info in the CSV, enables their Exchange mailbox, and creates their home directory. I'm having a bit of trouble planning out the rights assignment part on the user home directory; I need to be able to add the specific user (set by variable at the beginning
of the script) and three static groups. What is the best way to do that? I can easily grab outside modules if needed (a section of my script checks for and if necessary installs modules and adds snap-ins), but I'd rather keep this 100% PowerShell - no icacls
or outside commands.
Any suggestions?
Thank you in advance.
[email protected]

Here's what I came up with for the File System Stuff:
foreach ($user in $userlist)
$samaccountname = $user.empid
$FQN = "domain\" + $samaccountname
$homedirpath = "\\fileserver\users\$samaccountname"
new-item -ItemType directory -path $homedirpath -force
#Set ACLs for user and required groups
$homedir_acl = get-acl $homedirpath
$acl_access1 = 'domain\HomeDirectory Admins'
$acl_access2 = "domain\$samaccountname"
$fullrights = "Fullcontrol"
$modifyrights = "Modify"
$inheritrights = "ContainerInherit,ObjectInherit"
$rule1 = new-object system.security.accesscontrol.filesystemaccessrule ($acl_access1, $fullrights, $inheritrights, "none", "Allow")
$rule2 = new-object system.security.accesscontrol.filesystemaccessrule ($acl_access2, $modifyrights, $inheritrights, "none", "Allow")
$homedir_acl.addAccessRule($rule1)
set-acl $homedirpath $homedir_acl
$homedir_acl.addAccessRule($rule2)
set-acl $homedirpath $homedir_acl
#Set owner on home directory
$owner = New-Object System.Security.Principal.NTAccount($FQN)
$homedir_acl.setowner($owner)
set-acl $homedirpath $homedir_acl
[email protected]

Similar Messages

  • Granting infoview rights to a new user

    Hello,
    Can anyone tell how can i grant infoview rights to a new user so he can deploy his reports.
    Pls explain me step by step , I am new to BO

    Hi
    go in the administration console (CMC) and click on Applications. Navigate there to InfoView->Rights and assign theView access to your users (Group Everyone).
    Please check the administrator guide for more information.
    http://help.sap.com/businessobject/product_guides/boexir2/en/xir2_bip_Admin_en.pdf
    Regards,
    Stratos

  • Automatic system assignement to new users

    Hi all,
    I'm managing users with the CUA. This CUA sync with our MS Active Directory. I would like to know if new users coming from the AD and created in the CUA can be automatically created in a child system (without any role or profile assignement).
    Thanks for your help,
    Fred

    Welcome to the Apple Community.
    It's only the icloud sync services and iTunes Match that doesn't seem to be accepting any new subscritions at this time, everything else should be working as expected. All you can do is to try every couple of days to see if they are allowing new subscriptions.

  • Create New User Script and Change Home Dir

    I am working on creating a portable user for my usb flash drive so that I can take my desktop anywhere. I was wondering if there was a way that I could make a shell script to:
    1. Create a user account named acnt with the password pswd
    2. Change the NetInfo link of the accounts home directory to /Volumes/Users/User/acount
    I know how to do this in gui, but I would like a more stream lined aproach to doing this. Thank you.

    Dear Dominic,
    There are a number of ways to do this deppending on exactly what you want to do.
    The easy way is to create a file called .profile. .profile will change directories when you login. But this only works as far as terminal login is concerned. To do this type.
    cat>.profile
    cd /Volumes/Users/User/account
    <control D>
    Another way to do this is to use netinfo to adjust the values in the netinfor equivalent of /etc/password. You just set the home directory to where ever you want to login. But as I understand it, This has problems if you try to use Micro$oft software. I have NOT tried this, I just recall seeing a message to this effect in this fine forum.
    I am on the road, so I do NOT have my library and note books. If you need more details on how to use netinfo, just post more questions. Someone else will figure out the details or I will see them when I return to my notes and library.
    Your humble unix geek,
    Kurt

  • Apple configurator leaves app data on iPad when assigning to new user

    I set up a supervised iPad and created a base image which I backed up before configuring anything personal. then assigned the iPad to a user and set up some apps, such as Imo which is a jabber compatible messaging app.
    When I check the ipad back in, the user account for Imo is still on there even though it is set to restore the device back to the base backup that I created?

    the problem with this is it wipes the actual app not just the app data, meaning users would have to redownload all their apps everytime they want to use the iPad

  • How can I Import CA Certificate into a new user profile when it's created

    I need to deploy a CA Root Certificate to new firefox user profile when it is created in windows. I Seen somewhere that you could place a working copy of cert8.db in %programfiles%\firefox-installation-folder\defaults\profile and this would get added when a new firefox profile is created. However, the profile directory doesn't exist in the defaults folder and when I created it this method still didn't work.
    Is there a way to get firefox to create new profiles with preconfigured Certificates?
    Right now when new users open firefox for first time it is unable to connect to any SSL sites through our proxy server until the user adds the proxies ca certificate or it gets added later via logon script (at next user logon).

    Update... For anyone looking for a similar solution:
    I ended up adding more to my logon script I have it check for a user's mozilla profile first and if not found it will use command line "firefox.exe -createprofile default" to make one. After that I just copy a working cert8.db to that new profile. Then when the user opens firefox for first time, it will detect this new profile, and it will load it along with the correct CA Certs intact...
    Also, for existing profiles my script just uses nss certutil to add my proxy CA Certificate to the users profile cert8db.

  • Problem in Accessing list of users while Provisioning New User in SS

    Hi Experts!!
    I am working on Hyperion Planning applications (Hyperion 9.3.1) & we have externalized user authentication in Shared services. During the process of provisioning new user in Shared Services, the problem occurs when I try to set the application access type as “Essbase & Planning” for the new user.
    To assign the new user as “Essbase & Planning” user type, I need to select the new user from the list of available users which gets displayed on selecting global Analytic Server located under Project directory in Shared Services. However when I click on the analytic server, it shows *“loading”* on the right side screen & hour glass icon can also be seen on the screen. But the list of available users does NOT appear despite waiting for quite some time.
    While I am not able to access it even if I logon to the shared Services directly from the Server using remote access, my USA team can access the list of available users locally from their machine as well as from the server & are able to perform the step. Our server is located in USA & I access it from India. What could be the reason for this difference? Any suggestions/ input from you would be a great help for me in solving this issue.
    Thanks in advance

    Hi Rinku/John ,
    Thanks for your reply. My US team has tried this particular step from their local machine as well as directly from the Server. They were able to see the listbox containig the list of available users & could set the application access type as "Essbase & Planning" for the new user. When I remotely log into the server (using mstsc) I use the IE installed on the server to acess Shared Services. My US team also use the same IE when they log into SS directly from the server & are able to performing this step. Hence there should not be any issue with the browser ,port or firewall.
    I agree this is very weird problem because I get stuck only at this step where I have to set the application access type as 'essbase & Planning" for the new user. Rest every thing else is accessable in SS.
    Any suggestion / input would be great help.

  • How to Define Workbook / Business Ares Security Correctly for new Users

    Hi All,
    Please could you help me understand the Security Model for Workbooks and business Areas as I believe I am very close to understanding it, but missing something important.
    Background Information:
    We are using the predefined Oracle Business Areas (Payables, Receivables, Purchasing & General Ledger) to build our reports on. These are the steps I am taking to try and assign a new user & responsibility access to the existing report.
    1. I create the Report in Discoverer Desktop under the ‘General Ledger Responsibility’ logged in as myself – assume report name = ‘Report_1’.
    2. I create a new Responsibility in Oracle Apps called ‘Discoverer Resource Coordinators’.
    3. I create a new User in Oracle Apps called ‘Joe Bloggs’ and assign the responsibility ‘Discoverer Resource Coordinators’ to the Joe.
    4. Logged in as myself in Discoverer Desktop, Responsibility ‘General Ledger’ I Share the Report (Report_1) to the new Responsibility I just created ‘Discoverer Resource Coordinators’.
    5. In Discoverer Administration, Security, I assign the new Responsibility ‘Discoverer Resource Coordinators’ to the predefined Oracle Business Areas (Payables, Receivables, Purchasing & General Ledger).
    6. In Discoverer Administration I set privileges so that the Responsibility ‘Discoverer Resource Coordinators’ can do all tasks, query data, administer. .etc. etc..
    7. I therefore believe everything has been done and attempt to Login and run the report under Joe Bloggs, but am unable to retrieve any data.
    Help… what am I missing!
    Thanks,
    Lance
    Message was edited by:
    Lance

    Dear All,
    This has now been adjusted according to your recommendations but to no avail.
    Myself and Lance have ensured that this new responsibility has unlimited access to all the existing Business areas to eliminate joins within folders not being recognised, we have also ensured that the workbooks that have been created are shared with the correct responsibility.
    I have thoroughly tested this set up by logging in as this new responsibility within Disco. Client to try and retrieve data in a new Workbook, but even for the simplest of queries this fails.
    It seems that there may be a problem with the Responsibility linking to the EUL, could this be due to the new responsibility being created after the Current EUL was set up?
    Does anyone have any information or knowledge where this could happen?
    Regards
    Si

  • Repalce old user ID with new user ID in Org Plan

    Hi,
    I have a requirement. In our company, we have different type of user IDs for permanent employees and contractors.
    Whenever the contractors postion gets confirmed we will create a new user ID for that person.
    Now this new user ID has to be updated in the SRM org plan.
    As the user's old user ID is already assigned in the org plan and at the same time user have created lot of shopping carts, we want to replace his old user ID with the new one so that all the shopping carts will not get deleted.
    Basically I want to know, how to unassign the user ID from business partner and assign a new user ID.
    Is it possible to replace like that? Please advise.
    Thanks,
    SS
    Edited by: SRM Stranger on Apr 10, 2009 1:26 AM

    Hi,
    I noticed a feature in txn: BP --> Relationship
    In the relationship category, I could see two categories: Replaced by, Is replacing. Not sure what is the exact functionality of that.
    Do any one knows about that feature? Could you please advise me on that field?
    Also, Is it possible to change the validity period of BP or user assignment ?
    Will the above two resolve my issue?
    Since user has created many shopping carts and user needs access to those SC with his new users ID, I would like to confirm with you before taking any risk.
    Please help.
    Thanks,
    SS
    Edited by: SRM Stranger on Apr 10, 2009 4:32 PM

  • Creating the new User in Dashboard

    How to create the new user BI Presentation services. Right now we have only Administration user available.

    You have to create the new user in RPD. From the manage Menu Select Security.
    Security Manager window will open.
    Select user from the left pane.
    In the right pane of the window Right Click & select New User.
    A User window will open. Here you can give username,Description & password.
    You can also give the Privileges to the Group membership also.
    Hope this will clear.

  • LDAP ACL Rights

    Hi all,
    The LDAP ACL Rights are visible or only available in the Directory Server but it is not reflected when connected to the portal.  And the Roles are mainly reflected from the portal. More specifically when admin rights are assigned in the portal, that overrides the acl rights provided in the Directory server.  Can anyone clarify this how and why admin rights assigned in portal overrides the acl rights assigned in the directory server?
    Thanks in advance.
    Vijay

    hi
    please go through this link
    http://help.sap.com/saphelp_nw04/helpdata/en/eb/00954081efb90ee10000000a155106/content.htm
    please don,t forget to give points
    with regards
    subrato kundu

  • How to create a new IView with a new User assigned to it?

    Hi All,
    I have a Web Dynpro application and I want that to use in Portal.
    I am creating a IView..and  a Role and assigning  it to a created User.
    But when I am logging in with the new User I am getting an error. The Error is some Desktop.
    Can any provide me the steps for the creation of the same.
    Regards
    DK

    Hi,
    Here is the step-by-step procedure to create a web dynpro iView in portal:
    1. Logon to portal.
    2. Content Administration->Portal Content.
    3. Right Click on the folder 'Portal Content'.
    4. Select 'iView' ->'New'
    5. In the Template Selection, select 'SAP Web Dynpro iView' and click 'Next'
    6. In the 2nd step, Give iView Name and iView ID and a prefix. Next.
    7. Select application variant, say, 'Java' in the 3rd step. Next.
    8. In the 4th step, select the System (Your WAS System), give the project name of your webdynpro, like, local/ABC_Project in the WebDynproNameSpace. In the Application Name, enter the application name of your Web Dynpro Application, say ABC_App. Next.
    9. Finish.
    10. In the left panel, now you will see an iView has been created.
    11. Create necessary role/workset and assign this iView for an user.
    Regards,
    Vijayakhanna Raman

  • How would you assign passwords in a script for a user

    How would i assign a password in script??

    the only way to "automate" password/user additions is to use expect - to allow you to input some meaningful password - stdin doesn't work too well as you've probably seen
    Alternatively you can find the crypted value for some password and use that in a cut and paste fashion into the /etc/shadow file (as root obviously) but there are some limitations...
    i.e.
    echo "${newuserid}:x:${uid}:${gid}:${GCOS}:${homedir}:${usershell}" >> /etc/passwd
    echo "${newuserid}:${cryptedpasswd}:0:7:90::::" >> /etc/shadow
    this means that you have basically one password you're assigning to each new user, which may or may not be what you're digging after.
    If you can figure out how to crypt the password (with the appropriate salt) so it fits into the /etc/shadow crypted format, you'd have your problem solved.

  • Missing user rights assignment entries for many security policies in list exported via secedit

    Hello,
    First of all, I posted this same question on The Official Scripting Guys Forum! but didn't get the answer to this exact question (even though I received a lot of useful relevant info). That is why I am posting here. This is a more appropriate
    forum for the question. (Also posted on Windows Server 2012 General two days ago and didn't get a response at all).
    OK, question time:
    I want to modify the user rights assignment for a local security policy. In the GUI, find User Rights Assignment as follows: Win+R -> Enter "secpol.msc" -> Go to Local Policies -> Go to User Rights Assignment.
    So, to modify a particular use rights assignment via a script, I need to export the INF file using secedit, modify it and then configure using the modified file using secedit. To export the INF file, I am using:
    secedit /export /db C:\Windows\security\database\secedit.sdb /mergedpolicy /cfg SecPolicy
    Now, the problem is that the INF file exported doesn't have all the user rights assignments that I see in the GUI. For example, the policy "Restore files and directories" has users/groups in its settings but it doesn't show up in the INF file.
    In fact, most don't. Only five do and all these five have a different symbol next to them in the GUI. How are these policies different? What do I need to do to export all the policies?
    EDIT: Adding screenshot of what I see:
    Thanks!
    -Rohan.

    On Fri, 11 Apr 2014 18:26:50 +0000, Rohan PN wrote:
    Now, the problem is that the INF file exported doesn't have all the user rights assignments that I see in the GUI. For example, the policy "Restore files and directories" has users/groups in its settings but it doesn't show up in the INF
    file. In fact, most don't. Only five do and all these five have a different symbol next to them in the GUI. How are these policies different? What do I need to do to export all the policies?
    Can you post a screen shot? My guess is that what you're seeing is that
    secpol is only exporting the local settings and not ones that are set by a
    GPO in AD and that will also be the difference between the icons.
    Paul Adare - FIM CM MVP
    Although the Buddhists will tell you that desire is the root of suffering,
    my personal experience leads me to point the finger at system
    administration.
    -- Philip Greenspun

  • How can i create a new user with only read rights ?

    How can i create a new user with only read rights ?

    You are asking about a Database User I hope.
    You can look into the Oracle 8i Documentation and find various privillages listed.
    In particular, you may find:
    Chapter 27 Privileges, Roles, and Security Policies
    an intresting chapter.
    You may want to do this with the various tools included with 8i - including the
    Oracle DBA Studio - expand the Security node and you can create USERS and ROLES.
    Or use SQL*Plus. To create a
    user / password named John / Smith, you would login to SQL*Plus as System/manager (or other) and type in:
    Create user John identified by Smith;
    Grant CONNECT to John;
    Grant SELECT ANY TABLE to John;
    commit;
    There is much more you can do
    depending on your needs.
    Please read the documentation.
    -John
    null

Maybe you are looking for