Filespace permissions can be created in bulk via our command-line interface. You will require Admin (or root) user credentials, along with a ';' delimited text file in the format example provided.
Please note, as of Filespace format 2.2 the legacy term “Shares” has been changed to “Permissions.” This script will automatically detect Filespace format.
Powershell:
# ------------------------------------------------------------------
# AUTHOR: [LucidLink Support]
# NAME: bulkpermissions.ps1
# VERSION: 2.0
# DESCRIPTION: Lists permissions/shares entries from file
# and imports and assigns accordingly Filespace.
#
# THE SCRIPT IS PROVIDED “AS IS” AND “AS AVAILABLE” AND IS WITHOUT
# WARRANTY OF ANY KIND. PLEASE REVIEW ALL TERMS AND CONDITIONS.
# https://www.lucidlink.com/legal-documents
# ------------------------------------------------------------------
Param(
[string]$FILE,
[string]$PASSWORD
)
# --- Ensure file and password arguments are provided ---
if ([string]::IsNullOrEmpty($FILE) -or [string]::IsNullOrEmpty($PASSWORD)) {
Write-Host "Usage: .\bulkpermissions.ps1 <file> <password> `r`nRequest failed with: Bad Request `r`nEmpty required parameter 'file' or 'password' is not allowed!"
exit 1;
}
# --- Identify Filespace format ---
$PERMISSIONVER="2.2"
$INSTANCESTATUS = lucid status
$FSFORMAT = $INSTANCESTATUS -match "Filespace format:" -replace "[^0-9-.]" , ''
if ($PERMISSIONVER -gt $FSFORMAT) {
$COMMAND="share"
$COLUMNS="`$USER, `$FSPATH, `$PERMISSIONS = `$LINES -split ';' -replace '^\s*|\s*$'"
$OPTION="--permissions"
} else {
$COMMAND="permission"
$COLUMNS="`$USER, `$FSPATH, `$PERMISSIONS = `$LINES -split ';' -replace '^\s*|\s*$'"
$OPTION="--access"
}
# --- Ensure permissions file exists ---
if (!(Test-Path $FILE)) {
Write-Host "Error: your $FILE file does not exist." -ForegroundColor darkred -BackgroundColor black
exit 1
}
# --- Import the contents of file and assign permissions accordingly ---
$PERMISSIONS = Get-Content $FILE
foreach ($LINES in $PERMISSIONS) {
Invoke-Expression $COLUMNS
Start-Process -WindowStyle hidden -FilePath "C:\Program Files\Lucid\Resources\Lucid.exe" -ArgumentList "$COMMAND --set ""$FSPATH"" --user ""$USER"" $OPTION $PERMISSIONS --password ""$PASSWORD""" -Wait -RedirectStandardOutput permissions_output.txt -RedirectStandardError permissions_error.txt
Get-Content permissions_output.txt, permissions_error.txt
Remove-Item permissions_output.txt, permissions_error.txt
}
exit
Usage:
./bulkpermissions.ps1 d:\permissions.txt <password>
Example text file:
user1 ; / ; read,write user2 ; /data ; read
user3 ; /path/with space ; read,write