Powrshell to add Multiple security groups to shares

Um, are you adding the security groups to the share? That makes no sense. You should just add "everyone, full" to the share permissions and then use NTFS permissions to limit what people can actually do.
If you really need that I'll go look some more but I won't promise anythign as, again, this is not the way epople generally do this. This code is 1 possible way of managing the NTFS permissions, from some code I collected :)
Powershell

Hi People,IVe been using SW for sometime as a bit of a Lurk, Im scratching my head now at something that seems so basic but i cannot for the life of me figure it out, so any help would be great.ScernarioWe currently have a Powershell script that creates a list of folders on a Path that you give it, it will then proceed to add the security groups to the shares, this creating about 250 SG for the share - not too sure why this is used as its a pretty bad way to do thing.What i need to do is create a script that will ask for a list of security groups to add to a folder, I have already created the script to add the folders and add certain domain admin groups to the folders, the problem i am having is the name of the groupsSo for instance we have one call SG COMPANYNAME C - This is the change group allowing users to change files etc, we have...
This topic first appeared in the Spiceworks Community

Similar Messages

  • Add AD security group to collection

    Dear Exprt,
    i have added AD security group to collection via Add resource but nothing receive by client its user base group.
    how can i configure correctly.
    note: i dont want query base what i am try is add security DL to collection for software deployment
    [email protected]

    Sorry - this is the same for 2007. You cannot import distribution lists. You can create a security group in AD and nest the DL into. Then add the security group into the collection with a direct rule.
    Cheers
    Paul | sccmentor.wordpress.com

  • Add new Security Groups

    Hi Dear;
    is there a way to add new security groups in
    Document Numbering
    Price List
    Query Manager
    best regards;

    Hello Gordon;
    in the document numbering and the price list, you have to define a group, it's very clear
    it's a security group and you have to give authorization to the user
    is there a way to add more groups
    regards;

  • Trying to use a task sequence to add a computer to a security group

    I am using the following code to try to add a security group to a computer account when I am imaging using MDT 2012.  I get the following errors after the imaging process has completed.  
    Any help would be greatly appreciated.
    Thanks,
    Andy
    Exception calling "InvokeMember" with "5" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
    TaskSequencePSHost 03/24/2015 8:45:29 AM
    0 (0x0000)
    At \\AOTWDS01V\DeploymentShare$\Scripts\dagroup.ps1:26 char:2
    +     $UserDN = $SysInfo.GetType().InvokeMember("ComputerName", "GetProperty", $Null, ...
    +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TaskSequencePSHost 03/24/2015 8:45:29 AM
    0 (0x0000)
    NotSpecified: (:) [], MethodInvocationException
    TaskSequencePSHost 03/24/2015 8:45:29 AM
    0 (0x0000)
    The following exception occurred while retrieving member "Get": "The specified domain either does not exist or could not be contacted.
    " TaskSequencePSHost
    03/24/2015 8:45:31 AM 0 (0x0000)
    At \\AOTWDS01V\DeploymentShare$\Scripts\dagroup.ps1:30 char:2
    +     $strDomainPath = $ORoot.Get("defaultNamingContext")
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TaskSequencePSHost 03/24/2015 8:45:31 AM
    0 (0x0000)
    NotSpecified: (:) [], ExtendedTypeSystemException
    TaskSequencePSHost 03/24/2015 8:45:31 AM
    0 (0x0000)
    Exception calling "Execute" with "1" argument(s): "An invalid directory pathname was passed
    " TaskSequencePSHost
    03/24/2015 8:45:32 AM 0 (0x0000)
    At \\AOTWDS01V\DeploymentShare$\Scripts\dagroup.ps1:38 char:3
    +         $oRs = $oConnection.Execute("SELECT adspath FROM 'LDAP://$strDomainPath' WHERE ...
    +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TaskSequencePSHost 03/24/2015 8:45:32 AM
    0 (0x0000)
    NotSpecified: (:) [], MethodInvocationException
    TaskSequencePSHost 03/24/2015 8:45:32 AM
    0 (0x0000)
    Param(
    [string[]]$GroupNames,
    [String]$Admin,
    [String]$Password
    if($GroupNames)
    [int] $ADS_PROPERTY_APPEND = 3
    #Get the computer DN
    $SysInfo = New-Object -ComObject "ADSystemInfo"
    $UserDN = $SysInfo.GetType().InvokeMember("ComputerName", "GetProperty", $Null, $SysInfo, $Null)
    $ComputerDN = "LDAP://$UserDN"
    #Get the Domain DN
    $ORoot = [ADSI]"LDAP://rootDSE"
    $strDomainPath = $ORoot.Get("defaultNamingContext")
    #Create ADODB connection
    $oConnection = New-Object -ComObject "ADODB.Connection"
    $oConnection.Provider= "ADsDSOObject"
    $oConnection.Open("Active Directory Provider")
    foreach($groupname in $GroupNames)
    #Get the specefied group
    $oRs = $oConnection.Execute("SELECT adspath FROM 'LDAP://$strDomainPath' WHERE objectCategory='group' AND  Name='$groupname'")
    If (!$oRs.EOF)
    $strAdsPath = ($oRs.Fields |  Select value ).value
    If($strAdsPath)
    If($Admin -and $Password)
    $objGroup = New-Object DirectoryServices.DirectoryEntry($strAdsPath,$Admin,$Password)
    Else
    $objGroup = [ADSI]$strAdsPath
    $objComputer = [ADSI]$ComputerDN
    #verify if the computer is a member of the Group
    If ($objGroup.ismember($objComputer.adspath) -eq $false) 
    #Add the the computer to the specefied group
    $objGroup.PutEx($ADS_PROPERTY_APPEND,"member",@("$UserDN"))
    $objGroup.setinfo()

    If you are using UserID UserDomain UserPassword those variables are base64 encoded.  You could decode them via something similar to this:
    https://social.technet.microsoft.com/Forums/en-US/6c11827f-982d-4fa1-a76d-70a615912d62/mdt-2012-automation-example-of-how-to-use-userdomainuserid-userpassword-in-a-script-move-ou?forum=mdt
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Error while adding new security group in content server

    Hi,
    When i am trying to add new security group in UCM using User Admin applet i am getting following error:
    Event generated by user 'weblogic' at host 'vpunvfpctnsz-07.ad.infosys.com:16200'. Unable to execute service ADD_GROUP and function insertGroupRow.
    Unable to execute query 'IroleDefinition(INSERT INTO RoleDefinition (dGroupName, dRoleName, dPrivilege, dRoleDisplayName)
    values ('Test_111', 'admin', 0, ''))'. ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated
    java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated. [ Details ]
    An error has occurred. The stack trace below shows more information.
    !csUserEventMessage,weblogic,vpunvfpctnsz-07.ad.infosys.com:16200!$!csServiceDataException,ADD_GROUP,insertGroupRow!$!csDbUnableToExecuteQuery,IroleDefinition(INSERT INTO RoleDefinition (dGroupName\, dRoleName\, dPrivilege\, dRoleDisplayName)<br>          values ('Test_111'\, 'admin'\, 0\, ''))!$ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated<br>!syJavaExceptionWrapper,java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated<br>
    intradoc.common.ServiceException: !csServiceDataException,ADD_GROUP,insertGroupRow!$
    at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:2071)
    at intradoc.server.Service.buildServiceException(Service.java:2207)
    at intradoc.server.Service.createServiceExceptionEx(Service.java:2201)
    at intradoc.server.Service.createServiceException(Service.java:2196)
    at intradoc.server.ServiceRequestImplementor.handleActionException(ServiceRequestImplementor.java:1736)
    at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1691)
    at intradoc.server.Service.doAction(Service.java:476)
    at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1439)
    at intradoc.server.Service.doActions(Service.java:471)
    at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1371)
    at intradoc.server.Service.executeActions(Service.java:457)
    at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:723)
    at intradoc.server.Service.doRequest(Service.java:1865)
    at intradoc.server.ServiceManager.processCommand(ServiceManager.java:435)
    at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
    at intradoc.idcwls.IdcServletRequestUtils.doRequest(IdcServletRequestUtils.java:1332)
    at intradoc.idcwls.IdcServletRequestUtils.processFilterEvent(IdcServletRequestUtils.java:1678)
    at intradoc.idcwls.IdcIntegrateWrapper.processFilterEvent(IdcIntegrateWrapper.java:221)
    at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at idcservlet.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:87)
    at idcservlet.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:305)
    at idcservlet.common.ClassHelperUtils.executeMethodWithArgs(ClassHelperUtils.java:278)
    at idcservlet.ServletUtils.executeContentServerIntegrateMethodOnConfig(ServletUtils.java:1592)
    at idcservlet.IdcFilter.doFilter(IdcFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: intradoc.data.DataException: !csDbUnableToExecuteQuery,IroleDefinition(INSERT INTO RoleDefinition (dGroupName\, dRoleName\, dPrivilege\, dRoleDisplayName)
    *          values ('Test_111'\, 'admin'\, 0\, ''))!$ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated* at intradoc.jdbc.JdbcWorkspace.handleSQLException(JdbcWorkspace.java:2441)
    at intradoc.jdbc.JdbcWorkspace.execute(JdbcWorkspace.java:584)
    at intradoc.server.UserService.insertGroupRow(UserService.java:1201)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
    at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
    at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
    at intradoc.server.Service.doCodeEx(Service.java:549)
    at intradoc.server.Service.doCode(Service.java:504)
    at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1622)
    ... 39 more
    Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEV_OCS.PK_ROLEDEFINITION) violated
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:89)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:135)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:210)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:473)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:423)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1095)
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1028)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1379)
    at oracle.jdbc.driver.OracleStatement.doScrollExecuteCommon(OracleStatement.java:5846)
    at oracle.jdbc.driver.OracleStatement.doScrollStmtExecuteQuery(OracleStatement.java:5989)
    at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:2012)
    at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1958)
    at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:301)
    at weblogic.jdbc.wrapper.Statement.executeUpdate(Statement.java:503)
    at intradoc.jdbc.JdbcWorkspace.execute(JdbcWorkspace.java:564)
    ... 50 more
    I checked in database , the security group Test_111 is not present in ROLEDEFINITION table.
    What could be the issue?
    Regards,
    Minal

    1) Try importing CMU bundle with 'Overwrite Duplicates' option unchecked .
    2) In the CMU bundle, open file roles_guest.hda and see if 'guest' role has access to any group that start with special character or group you haven't created in the system..
    Eg: guest
    #AppsGroup
    0
    Also open securitygroups folder in CMU bundle, and see if you can find any groups that starts with special character or group you haven't created in the system.
    3) Identify that group and execute below query in the UCM database.
    select * from roledefinition where dgroupname= '#AppsGroup';
    Replace '#AppsGroup' with the groupname you identified.
    4) Solution would be to delete all the rows with dgroupname= '#AppsGroup' from the 'roledefinition' table.
    delete from roledefinition where dgroupname= '#AppsGroup';
    Replace '#AppsGroup' with the groupname you identified.

  • SCCM 2007 database query for AD security group for machines

    dear,
    I am had created security DL in AD for machine to deploy software  and trying to link in SCCM 2007 with collection but could not
    i have tried query base following below link but its does not help
    http://www.windows-noob.com/forums/index.php?/topic/892-deploy-software-through-ad-groups-linked-to-collections-in-sccm/
    type all query but could not find in table (SystemGroupName).
    [email protected]

    Go to properties of you collection and add a new membership rule to add the security group
    SCCM use discovery methods to get information from AD. Make sure AD system discovery and AD security group discovery are enabled for the SCCM site. Once you add machines to the security group, you need to wait till the next discovery cycle is completed.
    The discovery cycle runs on a schedule set by SCCM administrator.

  • How to Add multiple entry to the group policy security filtering

    How to Add multiple entry to the group policy security filtering
    Is there any way we can add multiple entry to the Domain group policy Security filtering tab.Currently its not allowing to add more then one entry at a time.
    Getting Error like "only one name can be entered,and the name cannot contain a semicolon.Enter a valid name"

    Hi
    Are you trying to add more users or groups through Group Policy Management Security Filtering tab?
    Try right clicking on the policy and then edit
    Then in Editor Right click on the name of the policy and Properties
    Security tab and add user or group from this tab. Just make sure if you are adding user or groups "Select this object type" has
    the correct option also "From this Location" is set to your entire directory not the local server.
    Update us with the above.
    Thanks

  • 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

  • Cannot add multiple members of a failover cluster to a DFSR replication group

    Server 2012 RTM. I have two physical servers, in two separate data centers 35 miles apart, with a GbE link over metro fibre between them. Both have a large (10TB+) local RAID storage arrays, but given the physical separation there is no physical shared storage.
    The hosts need to be in a Windows failover cluster (WSFC), so that I can run high-availability VMs and SQL Availability Groups across these two hosts for HA and DR. VM and SQL app data storage is using a SOFS (scale out file server) network share on separate
    servers.
    I need to be able to use DFSR to replicate multi-TB user data file folders between the two local storage arrays on these two hosts for HA and DR. But when I try to add the second server to a DFSR replication group, I get the error:
    The specified member is part of a failover cluster that is already a member of the replication group. You cannot add multiple members for the same cluster to a replication group.
    I'm not clear why this has to be a restriction. I need to be able to replicate files somehow for HA & DR of the 10TB+ of file storage. I can't use a clustered file server for file storage, as I don't have any shared storage on these two servers. Likewise
    I can't run a HA single DFSR target for the same reason (no shared storage) - and in any case, this doesn't solve the problem of replicating files between the two hosts for HA & DR. DFSR is the solution for replicating files storage across servers with
    non-shared storage.
    Why would there be a restriction against using DFSR between multiple hosts in a cluster, so long as you are not trying to replicate folders in a shared storage target accessible to both hosts (which would obviously be a problem)? So long as you are not replicating
    folders in c:\ClusterStorage, there should be no conflict. 
    Is there a workaround or alternative solution?

    Yes, I read that series. But it doesn't address the issue. The article is about making a DFSR target highly available. That won't help me here.
    I need to be able to use DFSR to replicate files between two different servers, with those servers being in a WSFC for the purpose of providing other clustered services (Hyper-V, SQL availability groups, etc.). DFSR should not interfere with this, but it
    is being blocked between nodes in the same WSFC for a reason that is not clear to me.
    This is a valid use case and I can't see an alternative solution in the case where you only have two physical servers. Windows needs to be able to provide HA, DR, and replication of everything - VMs, SQL, and file folders. But it seems that this artificial
    barrier is causing us to need to choose either clustered services or DFSR between nodes. But I can't see any rationale to block DFSR between cluster nodes - especially those without shared storage.
    Perhaps this blanket block should be changed to a more selective block at the DFSR folder level, not the node level.

  • Filter AD Security Group and add member through visual webpart

    Hi All,
    I want to know how to Filter AD Security Group and add members to it from SharePoint 2013 Visual webpart, where i have multiple domains as well.
    Regards
    Rathanavel
    Rathanavel

    SP doesn't interrogate AD groups (DL's or SG's)... you'll need to query AD directly (ADSI).
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Adding multiple users into one security group at one shot

    Hi,
    Is there any way we can add multiple users into one security group at one shot into PWA.
    For example: I want 100 create 100 users in EPM and Providing them with custom define Team defined permissions and can I add Time sheet Manager as well while creating bulk user through resource template in Project server 2010.
    Thanks,
    Prashant

    Hi Prashant,
    In order to add users in a security group, you can open the group, select all the appropriate resources (pressing CTRL key) and add them to the group. There is no other easy way. Otherwise a powershell script could do the job.
    For the timesheet manager, if all the 100 resources have the same timesheet manager, you can go to the resource center, select the resources (sorting by resource ID will give you together the latest resources added), bulk edit the resources and select the
    timesheet manager for the selected resources.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Add multiple users to AD Group using AddRange

    All,
    I am trying to add multiple users to an AD security group using AddRange method but no luck.
    Reason why I am using AddRange method is, the memberlist is pretty big (30K users) and Quest or MSFT AD Cmdlets taking plenty of time to add them.
    I am following the instruction per http://msdn.microsoft.com/en-in/library/ms180904(v=vs.80).aspx but no luck.
    Code snippet:
    $groupmembers = Get-Content C:\Temp\MemberDN.txt
    $getgroup = [ADSI]"LDAP://CN=MYADGROUP,OU=GROUPS,DC=CONTOSO,DC=COM"
    $getgroup.properties.member.AddRange($groupmembers)
    #$getgroup.properties["member"].AddRange($groupmembers)
    $getgroup.CommitChanges()
    #$getgroup.SetInfo()
    I tried using ADSPATH as well but no luck.
    Any help or pointers are appreciated.
    Thanks.

    Hi PSPR,
    I agree with David .
    Also I tested that on my server2012r2 , please refer to :
    $user="cn=test1,cn=users,dc=test,dc=com","cn=test2,cn=users,dc=test,dc=com"
    $obj=[adsi]"LDAP://cn=test,cn=users,dc=test,dc=com"
    $obj.member.addrange($user)
    $obj.commitchanges()
    Hope it helps
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How do I add multiple contacts to a group?

    How do I add multiple contacts to a group on my Ipad?

    See if this thread helps.
    https://discussions.apple.com/thread/4114588
    Matt

  • Add Multiple records to G/L account group.

    Dear ABAP Experts,
    i have requirement that is using  BDC recording file  the Functional People wants to add records to the G/L Account group. The FI consultant gave the recording file, based on the recording file i developed a BDC program. This BDC program will work for single record. After creating single record system will ask for transport request .
    REPORT  ZDP_ACC_GRP.
    TYPES: BEGIN OF TY_TAB,
            KTOPL TYPE KTOPL,
            KTOKS TYPE KTOKS,
            TXT30 TYPE TXT30,
            VONNR TYPE VONNR,
            BISNR TYPE BISNR,
           TRKORR TYPE TRKORR,
       END OF TY_TAB.
    data: lt_tab type table of ty_tab,
           wa_tab type ty_tab.
    data: begin of record,
    * data element: KTOPL
             KTOPL_01_001(004),
    * data element: KTOKS
             KTOKS_01_002(004),
    * data element: TXT30_077T
             TXT30_01_003(030),
    * data element: VONNR_077S
             VONNR_01_004(010),
    * data element: BISNR_077S
             BISNR_01_005(010),
    * data element: TRKORR
             TRKORR_006(020),
           end of record.
    *       Batchinputdata of single transaction
    DATA:   BDCDATA type table of BDCDATA  WITH HEADER LINE.
    *       messages of call transaction
    DATA:   MESSTAB type table of BDCMSGCOLL  WITH HEADER LINE.
    *       error session opened (' ' or 'X')
    DATA:   E_GROUP_OPENED.
    *       message texts
    TABLES: T100.
    data:lv_file type string.
    parameters: p_fname type IBIPPARMS-PATH.
    at selection-screen on value-request for p_fname.
    CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        = SYST-CPROG
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = 'P_FNAME'
      IMPORTING
        FILE_NAME           = p_fname .
    start-of-selection.
    lv_file = p_fname.
    CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         FILENAME                      = LV_FILE
    *   FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
       TABLES
         DATA_TAB                      = LT_TAB
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_READ_ERROR               = 2
        NO_BATCH                      = 3
        GUI_REFUSE_FILETRANSFER       = 4
        INVALID_TYPE                  = 5
        NO_AUTHORITY                  = 6
        UNKNOWN_ERROR                 = 7
        BAD_DATA_FORMAT               = 8
        HEADER_NOT_ALLOWED            = 9
        SEPARATOR_NOT_ALLOWED         = 10
        HEADER_TOO_LONG               = 11
        UNKNOWN_DP_ERROR              = 12
        ACCESS_DENIED                 = 13
        DP_OUT_OF_MEMORY              = 14
        DISK_FULL                     = 15
        DP_TIMEOUT                    = 16
        OTHERS                        = 17  .
    LOop at  lt_tab into wa_tab.
    perform bdc_dynpro      using 'SAPL0F09' '0020'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'V_T077S-TXT30(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=NEWL'.
    perform bdc_dynpro      using 'SAPL0F09' '0020'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'V_T077S-BISNR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=SAVE'.
    perform bdc_field       using 'V_T077S-KTOPL(01)'
                                   WA_TAB-KTOPL."record-KTOPL_01_001.
    perform bdc_field       using 'V_T077S-KTOKS(01)'
                                   WA_TAB-KTOKS."record-KTOKS_01_002.
    perform bdc_field       using 'V_T077S-TXT30(01)'
                                   WA_TAB-TXT30."record-TXT30_01_003.
    perform bdc_field       using 'V_T077S-VONNR(01)'
                                   WA_TAB-VONNR."record-VONNR_01_004.
    perform bdc_field       using 'V_T077S-BISNR(01)'
                                   WA_TAB-BISNR."record-BISNR_01_005.
    perform bdc_dynpro      using 'SAPLSTRD' '0300'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'KO008-TRKORR'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=LOCK'.
    perform bdc_field       using 'KO008-TRKORR'
                                   WA_TAB-TRKORR."record-TRKORR_006.
    perform bdc_dynpro      using 'SAPL0F09' '0020'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'V_T077S-KTOPL(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=BACK'.
    perform bdc_dynpro      using 'SAPL0F09' '0020'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'V_T077S-KTOPL(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=BACK'.
    perform bdc_transaction using 'OBD4'.
    ENDLOOP.
    FORM BDC_TRANSACTION USING TCODE.
       DATA: L_MSTRING(480).
       DATA: L_SUBRC LIKE SY-SUBRC.
    * batch input session
    * call transaction using
         REFRESH MESSTAB.
         CALL TRANSACTION 'OBD4' USING BDCDATA
                          MODE  'A'" CTUMODE
                          UPDATE 'S'"CUPDATE
                          MESSAGES INTO MESSTAB.
         L_SUBRC = SY-SUBRC.
           LOOP AT MESSTAB.
             SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
                                       AND   ARBGB = MESSTAB-MSGID
                                       AND   MSGNR = MESSTAB-MSGNR.
             IF SY-SUBRC = 0.
               L_MSTRING = T100-TEXT.
               IF L_MSTRING CS '&1'.
                 REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
                 REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
                 REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
                 REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
               ELSE.
                 REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
                 REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
                 REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
                 REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
               ENDIF.
               CONDENSE L_MSTRING.
               WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).
             ELSE.
               WRITE: / MESSTAB.
             ENDIF.
           ENDLOOP.
       REFRESH BDCDATA.
    ENDFORM.
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
       CLEAR BDCDATA.
       BDCDATA-PROGRAM  = PROGRAM.
       BDCDATA-DYNPRO   = DYNPRO.
       BDCDATA-DYNBEGIN = 'X'.
       APPEND BDCDATA.
    ENDFORM.
    FORM BDC_FIELD USING FNAM FVAL.
         CLEAR BDCDATA.
         BDCDATA-FNAM = FNAM.
         BDCDATA-FVAL = FVAL.
         APPEND BDCDATA.
    ENDFORM.
    But the FI consultant wants to add multiple records to 'G/L account group'.After adding records before saving the system need to ask transport request at the last.
    How can I write code ...??
    Please help me.

    Hi Srikanth,
    Thanks for reply,
    You  are right we need to load hierarchy for G/L then we can see all the G/L's for all G/L groups.
    I have one more question when I check in RSA3 for the G/L account numbers, I could not find them.
    I am using the datasource fi_gl_4 and in rsa3 I can see 1000 records data and when I put filter on G/L account and search for the G/L number I needed I cant see it, but it is there in the functional transaction(f.01)?
    How to check for the required G/L's in rsa3 ?
    Thx

  • How to create a site and add security groups through code: scripts, csom, ... ?

    Hi,
    I'm new to CSOM and are looking for a way to create sites in SharePoint Office365 and especially add user to it with a specific role eg. 'visitor' or 'owner'.
    I use this code to add sites from a csv file, so far so good.
    But now I want to add security groups based on the csv file and assign a role. The security groups allready exists.
    and also how to add a user with a 'owner' role for some sites.
    That would make my life easier :-)
    so thank you in advance!
    # load assemblies
    #[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    #[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
    # site collection
    $siteUrl = “https://mysharepoint.com”
    # admin
    $username = "[email protected]"
    $password = Read-Host -Prompt "Enter password" -AsSecureString
    # get clientcontext as object
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
    # assign credentials to clientcontext object
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $ctx.Credentials = $credentials
    # create site from template 'teamsite' => STS#0
    $data = Import-Csv "c:\tools\CSOM\vakwerking_test.csv"
    foreach ($row in $data) {
    $webCreationInformation = New-Object Microsoft.SharePoint.Client.WebCreationInformation
    $webCreationInformation.Url = $row.vakwerkingurl
    $webCreationInformation.Title = $row.vakwerkingnaam
    $webCreationInformation.WebTemplate = "STS#0"
    $webCreationInformation.UseSamePermissionsAsParentSite = $false
    $newWeb = $ctx.Web.Webs.Add($webCreationInformation)
    Write-Host "Title" $newWeb.Title
    #send to sharepoint
    $ctx.Load($newWeb)
    $ctx.ExecuteQuery()

    Hi,
    The command above about creating a group only works for the root site of the site collection, because the scope of the user group is site collection level, these groups
    can be used in all the sites in this site collection.
    With the existing groups in the root site, we can add users into them and grant specific permissions of a specific sub site to these groups.
    Here is a demo about how to assign permission to a group using Client Object Model(though in C#) for your reference:
    http://www.c-sharpcorner.com/UploadFile/54db21/set-permission-to-group-in-sharepoint-2010-programmatically/
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • How to validate numbers in char field.

    Hello all, I have one database column with char data type. This field should allow insert only numbers [ zero to nine] and plus symbol .. how to validate this? Pls help me.. I.m using oracle 9i database. So it does not allow REG-EXP and WITH methods.

  • Acrobat 6 "Save As" settings weirdness

    Hi - I'm trying to save/export a PDF as either a Word or, basically, any sort of text document. I'm getting an error message saying: "This document is not a tagged PDF. Please set your Save As preferences to generate tags for untagged documents." Whe

  • Sorry if this has already been asked. Just got the newest i-pad had a bit of difficulty getting the charger in and now nothing not charging. HELP

    Sorry if this has already been asked. Just got the newest i-pad had a bit of difficulty getting the charger in and now nothing not charging. HELP

  • XPath: doesn't work for SOAP message?

    My method      * Get value of the node specified by an XPath.      * @param item The starting context (e.g. document, node, node list).      * @param xPath XPath to select single node value (e.g. "/root/data/value[1]/text()")      * @return Result of

  • Mouse click not always recognized

    Adobe is slow to recognize my mouse clicks when selecting items. For example I will have selected 1.jpg, then get ready to work on 2.jpg, but I will have to click three to four times before 2.jpg will show in my properties window. Although I can see