Simple mount
!STARTUP_BEFORE_PS1=$user = "net user"^|$pass = ConvertTo-SecureString "password" -AsPlainText -Force^|$cred = New-Object System.Management.Automation.PSCredential -ArgumentList ($user, $pass)^|if ( (Test-Path "H:") -eq $False) {^|New-PSDrive -Name "H" -Root "\\10.0.0.111\shared_dir" -Persist -PSProvider "FileSystem" -Credential $cred^|}
Per-user access
In the below example, each user has a specific subfolder under the storage file share, using each user's USER_SHORTID and USER_KEY environment variables are login and password. USER_KEY is a per-user secret key known & accessible only to that user's context.
!STARTUP_BEFORE_PS1=$stdomain = "file-server"^|$stserver = "10.0.0.111"^|$cuuser = $env:USER_SHORTID^|$cupass = $env:USER_KEY^|$cucred = New-Object System.Management.Automation.PSCredential -ArgumentList ("$stdomain\$cuuser", ($cupass | ConvertTo-SecureString -AsPlainText -Force))^|$drive = New-PSDrive -Name "S" -Root "\\$stserver\Storage\$cuuser" -Persist -PSProvider "FileSystem" -Credential $cucred !FILEDIALOG_EXTRA=Storage>0>S:\