# ------------------------------------------------------------------ # AUTHOR: [LucidLink Support] # NAME: jit_shares_script.ps1 # VERSION: 1.0.1 # DESCRIPTION: Lists "Just-in-Time" SSO shares from backup and # imports into JIT SSO integrated 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]$ROOTPWD ) # --- Ensure password --- if ([string]::IsNullOrEmpty($ROOTPWD)) { Write-Host "Usage: .\jit_shares_script.ps1 `r`nRequest failed with: Bad Request `r`nEmpty required parameter 'password' is not allowed!" exit 1; } # --- List and filter JIT share user and group assingments --- $SOURCESHARES = get-content .\jit_shares_backup.txt $SHARES = $SOURCESHARES.replace('read, write','read,write').replace('[user]',';user').replace('[group]',';group') -match "sso\\" -replace '\s{2,}', ';' -replace ' ;', ';' # --- Loop through assigning SSO users and groups to shares --- foreach ($LINES in $SHARES) { $SHAREDPATH, $USERGROUP, $TYPE, $SHAREDAS, $PERMISSIONS = $LINES -split ';' Start-Process -WindowStyle hidden -FilePath "C:\Program Files\Lucid\Resources\Lucid.exe" -ArgumentList "share --set ""$SHAREDPATH"" --$TYPE ""$USERGROUP"" --permissions $PERMISSIONS --password ""$ROOTPWD""" -Wait -RedirectStandardOutput jit_shares_output.txt -RedirectStandardError jit_shares_error_output.txt Get-Content jit_shares_output.txt, jit_shares_error_output.txt Get-Content jit_shares_output.txt, jit_shares_error_output.txt | Out-File jit_shares_log.txt -Append } exit