Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Import ACL from Excel fails
    • Sign In

    • State Not Answered
    • Replies 4 replies
    • Subscribers 65 subscribers
    • Views 765 views
    • Users 0 members are here

    Import ACL from Excel fails

    Scott Turner
    Offline Scott Turner over 1 year ago

    I am trying to import an ACL from Excel using a PowerShell script. I have two scripts that are identical, save for the Excel files and folders being updated.

    Yesterday I changed the security model on one set of folders such that it inherits security from the parent folder. I have created a spreadsheet from a configured folder, and am trying to use this in my script. When I run the script, for every folder it tries to process and error is thrown indicating there is nothing to import.

    Thinking this may be an issue with the spreadsheet, I tried to manually import it using PWE. This worked fine, the security updated as expected and there were no errors.

    Here is my script and spreadsheet.

    CLS
    New-PWLogin -UseGui
    $FolderName = @("Architectural","Civil","Communication","Control and Instrumentation","Electrical","Environmental","Fire","General","Human Factors","Hydraulic","Mechanical","Security","Structural")
    ForEach ($Folder in $FolderName) {
        $UpdtList = Get-PWFolders -PopulatePaths -FolderPath 'Projects\100345678 - Tarbela T5\50 Design\EM' | WHERE {$_.Name -EQ $Folder}
            ForEach ($Item in $UpdtList) {
                $Path = 'C:\Users\Scott\OneDrive - Mott MacDonald\Documents\Projects\Tarbela\ACL\Submission\Master.xls'
                Write-Host "Importing security for folder: " $Item.FullPath
                #$Bob = Import-Excel $Path
                Import-PWAccessControlFromExcel -InputFolder $Item.FullPath -ImportFileNamePath $Path
                }
    }
    Undo-PWLogin
    Master.xls

    Any ideas? Is this failing because I am trying to set all security to inherit, therefore there is nothing to actually import?

    Thank you for any help,

    Scott

    • Sign in to reply
    • Cancel
    Parents
    • Brian Flaherty
      0 Offline Brian Flaherty Fri, Dec 17 2021 9:35 AM

      Can you provide the error / warning message(s) being returned. I would test the $UpdtList variable to ensure it is getting populated.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Scott Turner
      0 Offline Scott Turner Fri, Dec 17 2021 10:27 AM in reply to Brian Flaherty

      Hi Brian,
      The error is: WARNING: There aren't any access records to import.

      Apologies, I am not very familiar with PowerShell, I do not know how to test the variable. Do I just print it to the screen?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Brian Flaherty
      0 Offline Brian Flaherty Fri, Dec 17 2021 12:32 PM in reply to Scott Turner

      You can use the Get-TablesFromXLSXWorkbook cmdlet to import the content of your spreadsheet and verify it is correct.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Scott Turner
      0 Offline Scott Turner Fri, Dec 17 2021 4:20 PM in reply to Brian Flaherty

      Thank you.
      When I do that, I get this:

      > Get-TablesFromXLSXWorkbook -InputFileName 'C:\Users\Scott\OneDrive - Mott MacDonald\Documents\Projects\Tarbela\ACL\Submission\Master.xls'


      CaseSensitive : False
      IsInitialized : True
      RemotingFormat : Xml
      ChildRelations : {}
      Columns : {Column0, Column1, WorkFlow, WorkFlow State...}
      Constraints : {}
      DataSet : System.Data.DataSet
      DefaultView : {System.Data.DataRowView, System.Data.DataRowView, System.Data.DataRowView, System.Data.DataRowView...}
      DisplayExpression :
      ExtendedProperties : {visiblestate}
      HasErrors : False
      Locale : en-US
      MinimumCapacity : 50
      ParentRelations : {}
      PrimaryKey : {}
      Rows : {System.Data.DataRow, System.Data.DataRow, System.Data.DataRow, System.Data.DataRow...}
      TableName : Directory
      Namespace :
      Prefix :
      Site :
      Container :
      DesignMode : False
      ContainsListCollection : False

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Scott Turner
      0 Offline Scott Turner Fri, Dec 17 2021 4:20 PM in reply to Brian Flaherty

      Thank you.
      When I do that, I get this:

      > Get-TablesFromXLSXWorkbook -InputFileName 'C:\Users\Scott\OneDrive - Mott MacDonald\Documents\Projects\Tarbela\ACL\Submission\Master.xls'


      CaseSensitive : False
      IsInitialized : True
      RemotingFormat : Xml
      ChildRelations : {}
      Columns : {Column0, Column1, WorkFlow, WorkFlow State...}
      Constraints : {}
      DataSet : System.Data.DataSet
      DefaultView : {System.Data.DataRowView, System.Data.DataRowView, System.Data.DataRowView, System.Data.DataRowView...}
      DisplayExpression :
      ExtendedProperties : {visiblestate}
      HasErrors : False
      Locale : en-US
      MinimumCapacity : 50
      ParentRelations : {}
      PrimaryKey : {}
      Rows : {System.Data.DataRow, System.Data.DataRow, System.Data.DataRow, System.Data.DataRow...}
      TableName : Directory
      Namespace :
      Prefix :
      Site :
      Container :
      DesignMode : False
      ContainsListCollection : False

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    No Data

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies