Пример #1
0
        private static void CloneScaleUnitWebRoot(ScaleUnitInstance scaleUnit)
        {
            CheckForAdminAccess.ValidateCurrentUserIsProcessAdmin();

            string cmd =
                $@"robocopy {Config.HubScaleUnit().SiteRoot()} {scaleUnit.SiteRoot()} /MIR /MT; ";

            CommandExecutor ce = new CommandExecutor();

            ce.RunCommand(cmd, new List <int>()
            {
                0, 1
            });
        }
        private static void EnsureCertificateWithSubjectExists(string certificateSubject)
        {
            CheckForAdminAccess.ValidateCurrentUserIsProcessAdmin();

            string cmd = "New-SelfSignedCertificate -NotBefore (Get-Date) -NotAfter (Get-Date).AddYears(1)"
                         + " -Subject " + CommandExecutor.Quotes + certificateSubject + CommandExecutor.Quotes
                         + " -KeyAlgorithm " + CommandExecutor.Quotes + "RSA" + CommandExecutor.Quotes + " -KeyLength 2048"
                         + " -HashAlgorithm " + CommandExecutor.Quotes + "SHA256" + CommandExecutor.Quotes
                         + " -CertStoreLocation " + CommandExecutor.Quotes + @"Cert:\LocalMachine\My" + CommandExecutor.Quotes
                         + " -KeyUsage KeyEncipherment -FriendlyName " + CommandExecutor.Quotes + "HTTPS development certificate" + CommandExecutor.Quotes
                         + " -TextExtension @(" + CommandExecutor.Quotes + "2.5.29.19={critical}{text}" + CommandExecutor.Quotes
                         + "," + CommandExecutor.Quotes + "2.5.29.37={critical}{text}1.3.6.1.5.5.7.3.1" + CommandExecutor.Quotes
                         + "," + CommandExecutor.Quotes + "2.5.29.17={critical}{text}DNS=" + certificateSubject + CommandExecutor.Quotes + ")";

            CommandExecutor ce = new CommandExecutor();

            ce.RunCommand(cmd);
        }