#pragma warning restore 1591 // Enable warnings about missing XML comments #endregion #region Methods /// <summary> /// Uninstalls this instance. /// </summary> /// <returns>System.String.</returns> public string Uninstall() { if (SoftwareCode.StartsWith("{")) { return(oNewBase.GetStringFromPS("Invoke-Expression(\"msiexec.exe /x '" + SoftwareCode + "' REBOOT=ReallySuppress /q\")")); } return(null); }
/// <summary> /// Check if the Folders exists. /// </summary> /// <returns>Boolean.</returns> public Boolean FolderExists() { string sResult = oNewBase.GetStringFromPS("Test-Path \"" + Location + "\""); if (string.IsNullOrEmpty(sResult)) { return(false); } else { return(Boolean.Parse(sResult)); } }
/// <summary> /// Delete BoundaryGroupCache /// </summary> /// <returns>true = success</returns> public bool Delete() { bool bResult = false; try { oNewBase.GetStringFromPS("[wmi]'" + __NAMESPACE + ":" + __RELPATH + "' | remove-wmiobject"); bResult = true; } catch { } return(bResult); }
/// <summary> /// Terminates a process and all of its threads. /// </summary> /// <returns>UInt32.</returns> public UInt32 Terminate() { //Remove cached results string sHash1 = oNewBase.CreateHash(@"Get-Process | Where { $_.Id -Eq " + ProcessId + @" } | Kill -Force"); oNewBase.Cache.Remove(sHash1); oNewBase.GetStringFromPS(@"Get-Process | Where { $_.Id -Eq '" + ProcessId + @"' } | Kill -Force"); //Remove cached results oNewBase.Cache.Remove(sHash1); return(0); }
#pragma warning restore 1591 // Enable warnings about missing XML comments #endregion #region Methods /// <summary> /// Start the Service and wait until it's started /// </summary> /// <returns>0</returns> public UInt32 StartService() { //Remove cached results string sHash1 = oNewBase.CreateHash(string.Format("(Get-Service '{0}').Start()", base.Name)); oNewBase.Cache.Remove(sHash1); string sHash2 = oNewBase.CreateHash(string.Format("(Get-Service '{0}').Status", base.Name)); oNewBase.Cache.Remove(sHash2); oNewBase.GetStringFromPS(string.Format("(Get-Service '{0}').Start()", base.Name)); base.State = oNewBase.GetStringFromPS(string.Format("(Get-Service '{0}').Status", base.Name)); //Remove cached results oNewBase.Cache.Remove(sHash1); oNewBase.Cache.Remove(sHash2); return(0); }