# If there's an error in a call such as $cfg.settings.Lock(), it is important that the script stops. # Continuing while another application is also potentially modifying settings may corrupt them. # Alternately, your script can also handle errors in a Try/Catch block. $ErrorActionPreference = "Stop" # Check BssCfgManip.htm in your SSH Server installation directory for the correct COM object name for your installation. # The PowerShell instance executing this script needs to run elevated, as administrator, to access SSH Server settings. $cfg = new-object -com "BssCfg815.BssCfg815" # This example only walks through settings, so does not need to lock them. If you're going to use methods that alter # settings or keypairs, make sure to lock the appropriate portion of settings before loading them or changing them. # For example, execute the following at start of script: # # $cfg.settings.Lock() # $result = $cfg.settings.Load() # # Then follow up with the following at end of script: # # $cfg.settings.Save() # $cfg.settings.Unlock() # # If you lock settings and do not unlock them, no other process will be able to edit settings until the object is released. $result = $cfg.settings.Load() if ($result.failure) { Write-Error $result.Describe() } foreach ($account in $cfg.settings.access.virtAccounts.entries) { if ($account.xfer.mountPoints.Count -eq 0) { Write-Host "Virtual account $($account.virtAccount) defines no mount points" } else { foreach ($mountPoint in $account.xfer.mountPoints.entries) { Write-Host "Virtual account $($account.virtAccount) defines mount point `"$($mountPoint.sfsMountPath)`" mapped to `"$($mountPoint.realRootPath)`"" } } }