protected override void ProcessRecord() { if (ParameterSetName.Is("Name")) { foreach (var index in ContentSearchManager.Indexes) { if (!index.Name.Is(Name)) { continue; } RebuildIndex(index); if (IncludeRemoteIndex) { RebuildIndex(index, true); } } } else if (ParameterSetName.Is("Instance") && Index != null) { RebuildIndex(Index); if (IncludeRemoteIndex) { RebuildIndex(Index, true); } } }
protected override void ProcessRecord() { if (ParameterSetName.Is("ID") || ParameterSetName.Is("Session")) { base.ProcessRecord(); return; } if (Current.IsPresent) { var currentSessionId = CurrentSessionId; if (!string.IsNullOrEmpty(currentSessionId)) { WriteObject(ScriptSessionManager.GetAll().Where(s => currentSessionId.Equals(s.ID, StringComparison.OrdinalIgnoreCase)), true); } } else if (Id != null && Id.Length > 0) { foreach (var id in Id) { if (ScriptSessionManager.SessionExistsForAnyUserSession(id)) { ScriptSessionManager.GetMatchingSessionsForAnyUserSession(id).ForEach(ProcessSession); } else { WriteError(typeof(ObjectNotFoundException), $"The script session with with Id '{id}' cannot be found.", ErrorIds.ScriptSessionNotFound, ErrorCategory.ResourceBusy, Id); } } } else { ScriptSessionManager.GetAll().ForEach(ProcessSession); } }