#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); }
/// <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); }