私はそれを理解しました。私は次のようなことをすることになりました:
// This Guid is the uuid of the coclass in WinsshdCfgManip.idl (depends on your WinSSHD version)
dynamic config = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("A3E7581A-5182-41C4-9AFD-2DFF07F06167"), server, true));
config.SetSite("WinSSHD");
config.LockWinsshdSettings();
config.LoadWinsshdSettings();
config.ProcessInstruction(@"access.virtAccounts.New.virtAccount """ + username + @"""");
config.ProcessInstruction(@"access.virtAccounts.New.virtPassword.Set """ + password + @"""");
config.ProcessInstruction(@"access.virtAccounts.New.group ""Virtual Users""");
config.ProcessInstruction(@"access.virtAccounts.New.useDefaultWinAccount false");
config.ProcessInstruction(@"access.virtAccounts.New.winDomain """ + winDomain + @"""");
config.ProcessInstruction(@"access.virtAccounts.New.winAccount """ + winAccount + @"""");
config.ProcessInstruction(@"access.virtAccounts.New.loginAllowed yes");
config.ProcessInstruction(@"access.virtAccounts.New.passwordAuth required");
config.ProcessInstruction(@"access.virtAccounts.New.permitRemoteAdmin no");
config.ProcessInstruction(@"access.virtAccounts.New.mapRemoteHomeDir no");
config.ProcessInstruction(@"access.virtAccounts.New.allowSessionJobBreakaway no");
config.ProcessInstruction(@"access.virtAccounts.New.permitTerminalShell no");
config.ProcessInstruction(@"access.virtAccounts.New.permitExecRequests no");
config.ProcessInstruction(@"access.virtAccounts.New.permitSftp yes");
config.ProcessInstruction(@"access.virtAccounts.New.sfsMap.useDefaultSfsMap false");
// Backslashes in rootPath need to be escaped as \\ for ProcessInstruction
// E.g.:
// string rootPath = @"C:\\FTP\\MyFtpFolder";
config.ProcessInstruction(@"access.virtAccounts.New.sfsMap.mountPoints.1.realRootPath """ + rootPath + @"""");
config.ProcessInstruction(@"access.virtAccounts.NewCommit");
config.SaveWinsshdSettings(1);
config.UnlockWinsshdSettings();