Exemplo n.º 1
0
 public wmPackageHelper(string _packageName, string _projType, string _hpp, string _confName, string _webUser)
 {
     try
     {
         _psh = new PSHScriptHelper();
         _psh.ScriptGlobalVariables.Add("packName", _packageName.Trim());
         _psh.ScriptGlobalVariables.Add("projType", _projType.Trim());
         _psh.ScriptGlobalVariables.Add("webUser", _webUser.Trim());
         _psh.ScriptGlobalVariables.Add("HPP", _hpp.Trim());
         _psh.ScriptGlobalVariables.Add("confName", _confName.Trim());
         _psh.ScriptText = _hpp + @"\InvokeScripts\Invoke-NewwMBuildPackage.ps1";
         _results = _psh.RunScript();
     }
     catch (Exception _e)
     {
         _results = _e.ToString();
     }
 }
Exemplo n.º 2
0
        public RCSHelper(string _dbi, string _hpp, string _webUser)
        {
            try
            {
                _psh = new PSHScriptHelper();

                _psh.ScriptGlobalVariables.Add("dbi_num", _dbi.Trim());
                _psh.ScriptGlobalVariables.Add("webUser", _webUser.Trim());
                _psh.ScriptText = _hpp + "\\TestPartner\\ImportAutomation.ps1";

                //_psh.ScriptText = "return $(get-date).ToString(\"yyyyMMdd:hhmmss\")";

                _results = _psh.RunScript();
            }
            catch (Exception _e)
            {
                _results = _e.ToString();
            }
        }
Exemplo n.º 3
0
        public bool IsServiceRunning(string ServerName, string ServiceName)
        {
            try
            {
                _hlog.Write2Log("HPP service started, GetServiceInfo", HloggerCategories.Info, HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("serverName", ServerName);

                _psh.ScriptGlobalVariables.Add("matchString", ServiceName);

                string script = _psh.ScriptGlobalVariables["path2Hpp"] + @"\InvokeScripts\Invoke-IsServiceRunning.ps1";

                _hlog.Write2Log("Running Scripts: " + script, HloggerCategories.Info, HloggerPriority.Low);

                _psh.ScriptText = script;

                string _rval = _psh.RunScript();

                if (_rval.Equals("True"))
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (Exception _ex)
            {
                return false;
            }
        }
Exemplo n.º 4
0
        public string AddInfoPathXsn(string path2Xsn, string mossUrl, string xsnSha1)
        {
            try
            {
                _hlog.Write2Log("Add infopath xsn : " + path2Xsn + " started",
                               HloggerCategories.Info,
                               HloggerPriority.Med);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("path2Xsn", path2Xsn);

                _psh.ScriptGlobalVariables.Add("mossUrl", mossUrl);

                _psh.ScriptGlobalVariables.Add("xsnSha1", xsnSha1);

                _psh.ScriptText = ConfigurationManager.AppSettings.Get("Path2Scripts") + @"\Add-InfoPathForm.ps1";

                _hlog.Write2Log("Running Add infopath xsn : " + path2Xsn,
                              HloggerCategories.Debug,
                              HloggerPriority.Low);

                string _result = _psh.RunScript();

                _hlog.Write2Log(_result,
                               HloggerCategories.Info,
                               HloggerPriority.Med);

                return _result;
            }
            catch (Exception ex)
            {
                return Catcher(ex);
            }
        }
Exemplo n.º 5
0
        public string RunCmd(string Cmd)
        {
            try
            {

                _hlog.Write2Log("HPP service started to at hoc cmd", HloggerCategories.Info, HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _hlog.Write2Log("Running Scripts: " + Cmd, HloggerCategories.Info, HloggerPriority.Low);

                _psh.ScriptText = Cmd;

                return _psh.RunScript();
            }
            catch (Exception _ex)
            {
                return (_ex.ToString());
            }
        }
Exemplo n.º 6
0
        private PSHScriptHelper AddCommonGlobaleVariables(PSHScriptHelper _ph)
        {
            StringBuilder _sb = new StringBuilder();
            string globalIndicator = "pshGlobal_";

            _sb.AppendLine("Set Global Variables:");

            foreach (string key in ConfigurationManager.AppSettings.AllKeys)
            {
                if (key.StartsWith(globalIndicator))
                {
                    string k = key.Remove(0, globalIndicator.Length);
                    string val = ConfigurationManager.AppSettings.Get(key);
                    _ph.ScriptGlobalVariables.Add(k, val);

                    _sb.AppendLine(k + " => " + val);
                }

            }

            _hlog.Write2Log(_sb.ToString(),
                          HloggerCategories.Debug,
                          HloggerPriority.Low);

            return _ph;
        }
Exemplo n.º 7
0
        public string RunScript(string ScriptName, string ParametersXml)
        {
            try
            {
                _hlog.Write2Log("HPP service started", HloggerCategories.Info, HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("pXml", ParametersXml);

                string script = ConfigurationManager.AppSettings.Get("Path2Hpp") + @"\InvokeScripts\" + ScriptName;

                _hlog.Write2Log("Running Scripts: " + script, HloggerCategories.Info, HloggerPriority.Low);

                _psh.ScriptText = script;

                return _psh.RunScript();
            }
            catch (Exception _ex)
            {
                return (_ex.ToString());
            }
        }
Exemplo n.º 8
0
        public void CreateLabel()
        {
            //Here I need to lock the global object to ensure that only one session at a time
            //calls informatica
            //This is not a great solution is usage ramps up in a big way
            //For now it is a solid solution

            lock (Global.infoLockObj)
            {
                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh.ScriptGlobalVariables.Add("LabelType", "APP_" + WiFields["HIC INFORMATICA LABEL TYPE"]);
                _psh.ScriptGlobalVariables.Add("region", WiFields["HIC INFORMATICA LABEL REGION"]);
                _psh.ScriptGlobalVariables.Add("hostName", ConfigurationManager.AppSettings.Get("InfoHostMachine_" + WiFields["HIC INFORMATICA LABEL REGION"]));
                _psh.ScriptGlobalVariables.Add("requestedBy", WiFields["Created By"]);

                string _lab = _psh.RunScript(ConfigurationManager.AppSettings.Get("Path2CreateLabel"));

                if (!_lab.Trim().Equals("False", StringComparison.CurrentCultureIgnoreCase))
                {
                    _label = _lab.Trim();
                    _successful = true;

                    AddLabel2GlobalList(_label, "List - Informatica Labels");
                }
            }
        }
Exemplo n.º 9
0
        private void RunEarDeployment(string _earFile)
        {
            PSHScriptHelper _psh = new PSHScriptHelper();

            _psh.RunScript("write-output \"Hello World\" > C:\\Temp\\HelloWorld.Txt");
        }
Exemplo n.º 10
0
        public string AddSolutionWsp(string Path2Wsp)
        {
            try
            {
                _hlog.Write2Log("WSP Deployment: " + Path2Wsp + " started",
                                HloggerCategories.Info,
                                HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("wspFile", Path2Wsp);

                _psh.ScriptText = ConfigurationManager.AppSettings.Get("Path2Scripts") + @"\Add-WspSolution.ps1";

                string _result =  _psh.RunScript();

                _hlog.Write2Log(_result,
                               HloggerCategories.Info,
                               HloggerPriority.Low);

                return _result;
            }
            catch (Exception ex)
            {
                return Catcher(ex);
            }
        }
Exemplo n.º 11
0
        public string UploadUdcx(string path2UdcxDir,
                                 string dataConnectionLibUrl,
                                 string relSiteUrl,
                                 string webServiceUrl)
        {
            try
            {
                _hlog.Write2Log("Udcx upload to " + dataConnectionLibUrl + " started",
                               HloggerCategories.Info,
                               HloggerPriority.Med);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("path2UdcxDir", path2UdcxDir);

                _psh.ScriptGlobalVariables.Add("dataConnectionLibUrl", dataConnectionLibUrl);

                _psh.ScriptGlobalVariables.Add("relSiteUrl", relSiteUrl);

                _psh.ScriptGlobalVariables.Add("webServiceHost", webServiceUrl);

                _hlog.Write2Log("Method Variables:\npath2UdcxDir => " + path2UdcxDir + "\ndataConnectionLibUrl => " + dataConnectionLibUrl + "\nrelSiteUrl =>" + relSiteUrl + "\nwebServiceUrl =>" + webServiceUrl,
                               HloggerCategories.Debug,
                               HloggerPriority.Low);

                _psh.ScriptText = ConfigurationManager.AppSettings.Get("Path2Scripts") + @"\Upload-MossUdcx.ps1";

                _hlog.Write2Log("Udcx upload to " + dataConnectionLibUrl + "call complete",
                              HloggerCategories.Debug,
                              HloggerPriority.Low);

                string _result = _psh.RunScript();

                _hlog.Write2Log(_result,
                               HloggerCategories.Info,
                               HloggerPriority.Low);

                return _result;
            }
            catch (Exception ex)
            {
                return Catcher(ex);
            }
        }
Exemplo n.º 12
0
        public string RunStsadmCmd(string Cmd)
        {
            try
            {
                _hlog.Write2Log("Run Stsadm Cmd : " + Cmd + " started",
                               HloggerCategories.Info,
                               HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("cmd", Cmd);

                _psh.ScriptText = ConfigurationManager.AppSettings.Get("Path2Scripts") + @"\Run-StsadmCmd.ps1";

                _hlog.Write2Log("Run Stsadm Cmd : " + Cmd + " done",
                               HloggerCategories.Debug,
                               HloggerPriority.Low);

                string _result = _psh.RunScript();

                _hlog.Write2Log(_result,
                               HloggerCategories.Info,
                               HloggerPriority.Low);

                return _result;
            }
            catch (Exception ex)
            {
                return Catcher(ex);
            }
        }
Exemplo n.º 13
0
        public XmlDocument ExecStsadmCmd(string Cmd)
        {
            XmlDocument _xd = new XmlDocument();

            try
            {
                _hlog.Write2Log("Run Stsadm Cmd : " + Cmd + " started",
                               HloggerCategories.Info,
                               HloggerPriority.Low);

                PSHScriptHelper _psh = new PSHScriptHelper();

                _psh = AddCommonGlobaleVariables(_psh);

                _psh.ScriptGlobalVariables.Add("cmd", Cmd);

                _psh.ScriptText = ConfigurationManager.AppSettings.Get("Path2Scripts") + @"\Run-StsadmCmd.ps1";

                _hlog.Write2Log("Run Stsadm Cmd : " + Cmd + " done",
                               HloggerCategories.Debug,
                               HloggerPriority.Low);

                 _xd.InnerText = "<Results><Result>" + _psh.RunScript() + "</Reuslt></Results>";
            }
            catch (Exception ex)
            {
                _xd.InnerText = Catcher(ex);
            }

            return _xd;
        }