Execution Flow
Synopsis
Locates the dsm.opt IBM TSM client option file via the private helper _FindDsmOptPath (or accepts an explicit path). Reads the file through _ReadRemoteFile which handles UNC paths for remote targets. Parses all non-comment key-value pairs into a hashtable and extracts TCPServeraddress, USERID, and PASSWORD. The password is always returned as a SecureString; plain text is available only when -IncludePasswordPlain is set.
No dbatools required. Requires private helpers
_FindDsmOptPath and _ReadRemoteFile (both internal to sqmSQLTool). For remote computers, the caller must have access to the UNC path of the target's file system or the helpers handle WinRM-based transfer. On any error Success = $false is returned unless -EnableException is set.Syntax
Get-sqmTsmConfiguration [-ComputerName <String>] # default $env:COMPUTERNAME [-DsmOptPath <String>] # explicit path; skips auto-detect [-IncludePasswordPlain] [-Credential <PSCredential>] [-EnableException]
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| -ComputerName | String | $env:COMPUTERNAME | Target computer. Local when matching $env:COMPUTERNAME, localhost, 127.0.0.1, or .. |
| -DsmOptPath | String | — | Explicit path to dsm.opt. When provided, _FindDsmOptPath is skipped. |
| -IncludePasswordPlain | Switch | false | Also populate PasswordPlain in the result. Off by default for security. |
| -Credential | PSCredential | — | Credential for accessing a remote file via UNC. |
| -EnableException | Switch | false | Throw terminating exceptions instead of returning Success=$false. |
Return Value
| Property | Description |
|---|---|
| Success | $true on success; $false on any error. |
| ErrorMessage | Error description when Success = $false, otherwise $null. |
| FilePath | Resolved path to the dsm.opt file that was read. |
| ServerName | Value of TCPServeraddress from the option file. |
| UserName | Value of USERID from the option file. |
| Password | Password as [SecureString]; $null if not set in the file. |
| PasswordPlain | Plain-text password — populated only when -IncludePasswordPlain is set. |
| AllOptions | Hashtable of all parsed key-value pairs from the option file. |
| RawContent | Array of non-comment lines from the file as parsed. |
Examples
# Read TSM config from local machine (auto-detect path) Get-sqmTsmConfiguration # Read from remote SQL server Get-sqmTsmConfiguration -ComputerName "SQL01" # Explicit path + plain-text password for scripting Get-sqmTsmConfiguration -DsmOptPath 'C:\Program Files\Tivoli\TSM\baclient\dsm.opt' -IncludePasswordPlain # Use server name from result $tsm = Get-sqmTsmConfiguration Write-Host "TSM Server: $($tsm.ServerName), User: $($tsm.UserName)"