private string GetScriptExtension(ScriptType scriptType)
        {
            switch (scriptType)
            {
            case ScriptType.Batch:
                return(".bat");

            case ScriptType.PowerShell:
                return(".ps1");

            default:
                throw new Exception("Unknown ScriptType [{0}].".FormatString(scriptType.GetName()));
            }
        }
        private string ExecuteScriptRemotely(string scriptBody, ScriptType scriptType,
                                             string computerName, int portNumber, string targetKey)
        {
            var command = new ScriptExecutionCommand
            {
                ScriptBody  = scriptBody,
                ScriptType  = scriptType.GetName(),
                CommandTime = DateTime.UtcNow
            };

            var encriptionKey  = targetKey;
            var encriptionSalt = DomainContext.ServerKey;

            return(_targetCommandSender.Send(computerName, portNumber, command, encriptionKey, encriptionSalt));
        }
Ejemplo n.º 3
0
 private string GetScriptExtension(ScriptType scriptType)
 {
     switch (scriptType)
     {
         case ScriptType.Batch:
             return ".bat";
         case ScriptType.PowerShell:
             return ".ps1";
         default:
             throw new Exception("Unknown ScriptType [{0}].".FormatString(scriptType.GetName()));
     }
 }
        private string ExecuteScriptRemotely(string scriptBody, ScriptType scriptType,
            string computerName, int portNumber, string targetKey)
        {
            var command = new ScriptExecutionCommand
                {
                    ScriptBody = scriptBody,
                    ScriptType = scriptType.GetName(),
                    CommandTime = DateTime.UtcNow
                };

            var encriptionKey = targetKey;
            var encriptionSalt = DomainContext.ServerKey;

            return _targetCommandSender.Send(computerName, portNumber, command, encriptionKey, encriptionSalt);
        }