예제 #1
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Update-EmailAddressPolicy", parms));
 }
예제 #2
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Set-UserPhoto", parms));
 }
예제 #3
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("New-AddressBookPolicy", parms));
 }
예제 #4
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("Get-MailboxStatistics", parms));
 }
예제 #5
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Remove-TransportRule", parms));
 }
예제 #6
0
        protected static ICollection <PSObject> ExecuteCmdlet(string cmdlet, bool isNeedDC, PSParameters parms)
        {
            if (isNeedDC)
            {
                //parms.Add(new PSParameter("DomainController", PreferDC));
            }
            if (cmdlet == null)
            {
                throw new ArgumentNullException("cmdlet");
            }
            if (cmdlet.Length == 0)
            {
                throw new ArgumentException("cmdlet length is zero", "cmdlet");
            }

            Command item = new Command(cmdlet);

            foreach (PSParameter parameter in parms)
            {
                if (parameter.Value == null)
                {
                    item.Parameters.Add(parameter.Name);
                }
                else
                {
                    item.Parameters.Add(parameter.Name, parameter.Value);
                }
            }

            ICollection <PSObject> is2 = null;
            Pipeline      pipeline     = null;
            List <object> errorList    = new List <object>();

            try
            {
                lock (sync)
                {
                    if (_runspace.RunspaceStateInfo.State == RunspaceState.Broken)
                    {
                        _runspace.Close();
                        ReOpen();
                    }

                    SubmitSecurity subSecurity = new SubmitSecurity();
                    if (subSecurity.impersonateValidUser(DomainAdmin, Domain, DomainAdminPass))
                    {
                        pipeline = _runspace.CreatePipeline();
                        using (Pipeline pipeline2 = pipeline)
                        {
                            pipeline.Commands.Add(item);
                            is2 = pipeline.Invoke();

                            if (pipeline.Error != null && pipeline.Error.Count > 0)
                            {
                                foreach (object item1 in pipeline.Error.ReadToEnd())
                                {
                                    errorList.Add(item1);
                                    string errorMessage = string.Format("Invoke error: {0}", item1);
                                    Log4netHelper.Error(errorMessage);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                pipeline = null;
            }
            return(is2);
        }
예제 #7
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Get-ActiveSyncDeviceStatistics", parms));
 }
예제 #8
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("New-MoveRequest", parms));
 }
예제 #9
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("Set-CASMailBox", parms));
 }
예제 #10
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("Enable-MailContact", parms));
 }
예제 #11
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("Get-DistributionGroup", parms));
 }
예제 #12
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Remove-AcceptedDomain", parms));
 }
예제 #13
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Set-OfflineAddressBook", parms));
 }
예제 #14
0
        protected static ICollection <PSObject> ExecuteCmdlet(string cmdlet, PSParameters parms)
        {
            parms.Add(new PSParameter("DomainController", PreferDC));
            if (cmdlet == null)
            {
                throw new ArgumentNullException("cmdlet");
            }
            if (cmdlet.Length == 0)
            {
                throw new ArgumentException("cmdlet length is zero", "cmdlet");
            }

            Command item = new Command(cmdlet);

            foreach (PSParameter parameter in parms)
            {
                item.Parameters.Add(parameter.Name, parameter.Value);
            }

            ICollection <PSObject> is2    = null;
            Pipeline pipeline             = null;
            PipelineReader <object> error = null;
            PSObject    obj2       = null;
            ErrorRecord baseObject = null;

            try
            {
                lock (sync)
                {
                    SubmitSecurity subSecurity = new SubmitSecurity();
                    if (subSecurity.impersonateValidUser(DomainAdmin, Domain, DomainAdminPass))
                    {
                        pipeline = _runspace.CreatePipeline();
                        using (Pipeline pipeline2 = pipeline)
                        {
                            pipeline.Commands.Add(item);
                            is2   = pipeline.Invoke();
                            error = pipeline.Error;
                            if (error.Count == 1)
                            {
                                obj2       = (PSObject)error.Read();
                                baseObject = (ErrorRecord)obj2.BaseObject;
                                throw baseObject.Exception;
                            }
                            if (error.Count <= 1)
                            {
                                return(is2);
                            }
                            int         count   = error.Count;
                            int         num2    = 0;
                            ErrorRecord record2 = null;
                            while (error.Count > 0)
                            {
                                obj2       = (PSObject)error.Read();
                                baseObject = (ErrorRecord)obj2.BaseObject;
                                if (record2 == null)
                                {
                                    record2 = baseObject;
                                }
                                num2++;
                            }
                            throw record2.Exception;
                        }
                    }
                    return(is2);
                }
            }
            finally
            {
                pipeline = null;
            }
        }
예제 #15
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Get-ComplianceSearchAction", false, parms));
 }
예제 #16
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(PSCommandBase.ExecuteCmdlet("Set-MailboxRegionalConfiguration", parms));
 }
예제 #17
0
 public static ICollection <PSObject> ExecuteCmdlet(PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet("Remove-AddressList", parms));
 }
예제 #18
0
 public new static ICollection <PSObject> ExecuteCmdlet(string cmdlet, PSParameters parms)
 {
     return(WSCommandBase.ExecuteCmdlet(cmdlet, parms));
 }