/// <summary> /// Creates a dsmadmc with username, password and custom optionfile. /// </summary> /// <returns>The with option file.</returns> /// <param name="Username">Username to connect to tsm server as.</param> /// <param name="Password">Password to connect to tsm server as.</param> /// <param name="OptionFile">Option file with connection parameters. For Unix see remarks.</param> /// <remarks> /// Although the linux/mac client can use custom option file with '-optfile' there are some rules to its usage. /// In the same directory as the customer optionfile parameter this must be supplied. /// 1. dsm.sys : Doesn't matter what the optionfile is named, a dsm.sys file must exist with matching server stanza. /// 2. libs : The shared libs needed to run dsmadmc must be copied or symlinked to this folder. /// 3. working dir: The working directory must be set to the same path. /// (which currently is not possible). /// </remarks> public static clsDsmAdmc CreateWithOptionFile(string Username, string Password, string OptionFile) { if(!File.Exists(OptionFile)) throw new FileNotFoundException("OptionFile", OptionFile); var admc = new clsDsmAdmc(); admc.Username = Username; admc.pPassword = Password; admc.pOptFile = OptionFile; return admc; }
/// <summary> /// Creates a dsmadmc with username, password and server. /// </summary> /// <returns>The with server.</returns> /// <param name="Username">Username to connect to tsm server as.</param> /// <param name="Password">Password to connect to tsm server as.</param> /// <param name="Server">On Windows, ip or hostname. On Unix this is ServerStanza.</param> /// <param name="Port">On Windows optionally port to connect to. On Unix this is ignored.</param> public static clsDsmAdmc CreateWithServer(string Username, string Password, string Server, int? Port) { var admc = new clsDsmAdmc(); admc.Username = Username; admc.pPassword = Password; admc.Server = Server; admc.Port = Port; return admc; }
/// <summary> /// Connects to default tsm server and port using specified Admin Username and password. /// </summary> /// <param name="Username"></param> /// <param name="Password"></param> /// <returns></returns> public static clsDsmAdmc CreateWithDefaults(string Username, string Password) { var admc = new clsDsmAdmc(); admc.Username = Username; admc.pPassword = Password; return admc; }