Test-sqmTsmConnection Configuration

Tests the connection to an IBM Spectrum Protect (TSM) server by locating dsmadmc.exe, reading dsm.opt for credentials, and running a 'show version' command — locally or via WinRM on a remote computer.

Execution Flow

START _FindDsmadmcPath: Registry → DSM_DIR → defaults dsmadmc found? ERROR + return NO Missing user/pwd/server? → Get-sqmTsmConfiguration (reads dsm.opt) UserName resolved? ERROR + return NO Password resolved? ERROR + return NO _SecureToPlain → plaintext password (in-memory) Build: -id= -password= -se= -dataonly=yes show version isLocal? (localhost check) if isLocal ProcessStartInfo + RedirectOutput NO if remote New-PSSession + Invoke-Command ExitCode=0 && "IBM Spectrum Protect"? Success=true YES Success=false NO Return $result [PSCustomObject] DONE

Synopsis

Locates dsmadmc.exe via registry (HKLM:\SOFTWARE\IBM\ADSM\CurrentVersion), the %DSM_DIR% environment variable, or standard install paths. Reads the TSM configuration from dsm.opt for any parameters not supplied explicitly, then executes dsmadmc show version to verify connectivity. Remote computers are accessed via WinRM (New-PSSession / Invoke-Command).

Does not require dbatools. Uses Invoke-sqmLogging and an internal helper Get-sqmTsmConfiguration to read dsm.opt.

Syntax

Test-sqmTsmConnection
    [-ComputerName <String>]
    [-DsmadmcPath <String>]
    [-UserName <String>]
    [-Password <SecureString>]
    [-ServerName <String>]
    [-DsmOptPath <String>]
    [-Credential <PSCredential>]
    [-EnableException]

Parameters

ParameterTypeDefaultDescription
-ComputerNameString$env:COMPUTERNAMETarget computer where the connection test is performed.
-DsmadmcPathStringauto-detectFull path to dsmadmc.exe. Detected automatically from registry/env if omitted.
-UserNameStringdsm.opt USERIDTSM user name. Read from dsm.opt USERID if not supplied.
-PasswordSecureStringdsm.opt PASSWORDTSM password. Read from dsm.opt PASSWORD if not supplied.
-ServerNameStringdsm.opt TCPServeraddressTSM server address. Read from dsm.opt if not supplied.
-DsmOptPathStringauto-detectFull path to dsm.opt. Detected automatically if not specified.
-CredentialPSCredentialWindows credential for WinRM access to a remote computer.
-EnableExceptionSwitchfalseThrow terminating exceptions instead of returning a failure object.

Return Value

PropertyTypeDescription
SuccessBoolTrue if dsmadmc exited with code 0 and output contains "IBM Spectrum Protect".
MessageStringHuman-readable result or error description.
DsmadmcPathStringPath to the dsmadmc.exe that was used.
ServerNameStringTSM server address that was contacted.
UserNameStringTSM user name that was used.
OutputStringStandard output from dsmadmc.
ErrorOutputStringStandard error output from dsmadmc.

Examples

# Test local TSM connection (reads all settings from dsm.opt)
Test-sqmTsmConnection

# Test remote computer with explicit user and password
Test-sqmTsmConnection -ComputerName "SQL01" `
    -UserName "tsm_admin" -Password (Read-Host -AsSecureString)

# Test with explicit dsmadmc path and WinRM credential
Test-sqmTsmConnection -ComputerName "BACKUP01" `
    -DsmadmcPath "C:\IBM\TSM\baclient\dsmadmc.exe" `
    -Credential (Get-Credential)

dsmadmc.exe Auto-Detection Order

PrioritySourcePath / Key
1RegistryHKLM:\SOFTWARE\IBM\ADSM\CurrentVersion\InstallPath + dsmadmc.exe
2Environment%DSM_DIR%\dsmadmc.exe
3Default (Tivoli)C:\Program Files\Tivoli\TSM\baclient\dsmadmc.exe
4Default (IBM TSM)C:\Program Files\IBM\TSM\baclient\dsmadmc.exe
5Default (Spectrum)C:\Program Files\IBM\SpectrumProtect\baclient\dsmadmc.exe