Exemplo n.º 1
0
        protected override void ProcessRecord()
        {
            try
            {
                ManagementPackClass       clsAnnouncement = SMHelpers.GetManagementPackClass(ClassTypes.System_Announcement_Item, SMHelpers.GetManagementPack(ManagementPacks.System_AdminItem_Library, _mg), _mg);
                ManagementPackEnumeration enumPriority    = null;
                switch (_Priority)
                {
                case "Low":
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Low, _mg);
                    break;

                case "Critical":
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Critical, _mg);
                    break;

                case "Medium":
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Medium, _mg);
                    break;

                default:
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Medium, _mg);
                    break;
                }

                CreatableEnterpriseManagementObject emo = new CreatableEnterpriseManagementObject(_mg, clsAnnouncement);

                emo[clsAnnouncement, "Id"].Value = System.Guid.NewGuid().ToString();
                if (_DisplayName != null)
                {
                    emo[clsAnnouncement, "DisplayName"].Value = _DisplayName;
                }
                emo[clsAnnouncement, "Title"].Value = _DisplayName;

                if (_Body != null)
                {
                    emo[clsAnnouncement, "Body"].Value = _Body;
                }
                emo[clsAnnouncement, "Priority"].Value       = enumPriority.Id;
                emo[clsAnnouncement, "ExpirationDate"].Value = _ExpirationDate;

                emo.Commit();
                if (_passThru)
                {
                    WriteObject(ServiceManagerObjectHelper.AdaptManagementObject(this, _mg.EntityObjects.GetObject <EnterpriseManagementObject>(emo.Id, ObjectQueryOptions.Default)));
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
 protected override void ProcessRecord()
 {
     try
     {
         ManagementPackClass clsAnnouncement = SMHelpers.GetManagementPackClass(ClassTypes.System_Announcement_Item, SMHelpers.GetManagementPack(ManagementPacks.System_AdminItem_Library, _mg), _mg);
         foreach (EnterpriseManagementObject emo in _mg.EntityObjects.GetObjectReader <EnterpriseManagementObject>(clsAnnouncement, ObjectQueryOptions.Default))
         {
             WriteObject(ServiceManagerObjectHelper.AdaptManagementObject(this, emo));
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 3
0
        protected override void BeginProcessing()
        {
            // the base.BeginProcesing must come first as it sets up the enterprisemanagementgroup!
            base.BeginProcessing();
            ManagementPackClass clsAnnouncement = SMHelpers.GetManagementPackClass(ClassTypes.System_Announcement_Item, SMHelpers.GetManagementPack(ManagementPacks.System_AdminItem_Library, _mg), _mg);

            // Compare the string case insenstively
            if (_Priority != null)
            {
                if (String.Compare(_Priority, "low", true) == 0)
                {
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Low, _mg);
                }
                else if (String.Compare(_Priority, "critical", true) == 0)
                {
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Critical, _mg);
                }
                else if (String.Compare(_Priority, "medium", true) == 0)
                {
                    enumPriority = SMHelpers.GetEnum(Enumerations.System_Announcement_PriorityEnum_Medium, _mg);
                }
                else
                {
                    ThrowTerminatingError(new ErrorRecord(new ArgumentException("Priority"), "Priority must be low/medium/critical", ErrorCategory.InvalidOperation, _Priority));
                }
            }
        }
Exemplo n.º 4
0
        protected override void ProcessRecord()
        {
            // If nothing has changed, stop
            if (!hasChanged)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new ArgumentException("No values have changed, please provide new values for the incident"),
                        "Incident",
                        ErrorCategory.InvalidOperation,
                        "NoNewValues")
                    );
            }
            try
            {
                systemMp = _mg.ManagementPacks.GetManagementPack(SystemManagementPack.System);

                try
                {
                    clsIncident = SMHelpers.GetManagementPackClass(ClassTypes.System_WorkItem_Incident, SMHelpers.GetManagementPack(ManagementPacks.System_WorkItem_Incident_Library, _mg), _mg);
                }
                catch
                {
                    try
                    {
                        // last ditch try to get a class (this happens if a debug build is used
                        clsIncident = _mg.EntityTypes.GetClasses(new ManagementPackClassCriteria("Name = 'System.WorkItem.Incident'")).First();
                    }
                    catch (Exception e)
                    {
                        ThrowTerminatingError(new ErrorRecord(e, "badclass", ErrorCategory.ObjectNotFound, "System.WorkItem.Incident"));
                    }
                }

                int i = 1;
                if (InputObject != null)
                {
                    foreach (var item in this.InputObject)
                    {
                        ProgressRecord prog = new ProgressRecord(1, "Updating " + item.Object.DisplayName, String.Format("{0} of {1}", i, this.InputObject.Length.ToString()));
                        WriteProgress(prog);
                        SMHelpers.UpdateIncident(_mg, clsIncident, item, this.Impact, this.Urgency, this.Status, this.Classification, this.Source, this.SupportGroup, this.Comment, this.UserComment, this.Description, this.AttachmentPath);
                        i++;
                    }
                }
                else
                {
                    WriteDebug("No input object passed");
                    if (this._ID != null)
                    {
                        UpdateNamedIncident(_mg, this._ID);
                    }
                }
            }
            catch (Exception ex)
            {
                ThrowTerminatingError(new ErrorRecord(ex, "BadSet", ErrorCategory.InvalidOperation, InputObject));
            }
        }
Exemplo n.º 5
0
        private void UpdateNamedIncident(EnterpriseManagementGroup emg, string id)
        {
            // Define the type projection that you want to query for.
            // This example queries for type projections defined by the System.WorkItem.Incident.ProjectionType
            // type in the ServiceManager.IncidentManagement.Library management pack.
            ManagementPackTypeProjection incidentTypeProjection = SMHelpers.GetManagementPackTypeProjection(TypeProjections.System_WorkItem_Incident_ProjectionType, SMHelpers.GetManagementPack(ManagementPacks.ServiceManager_IncidentManagement_Library, emg), emg);

            // Define the query criteria string.
            // This is XML that validates against the Microsoft.EnterpriseManagement.Core.Criteria schema.
            string incidentCriteria = String.Format(@"
                <Criteria xmlns=""http://Microsoft.EnterpriseManagement.Core.Criteria/"">
                  <Reference Id=""System.WorkItem.Library"" PublicKeyToken=""{0}"" Version=""{1}"" Alias=""WorkItem"" />
                      <Expression>
                            <SimpleExpression>
                              <ValueExpressionLeft>
                                <Property>$Context/Property[Type='WorkItem!System.WorkItem']/Id$</Property>
                              </ValueExpressionLeft>
                              <Operator>Equal</Operator>
                              <ValueExpressionRight>
                                <Value>" + _ID + @"</Value>
                              </ValueExpressionRight>
                            </SimpleExpression>
                      </Expression>
                </Criteria>
                ", workitemMp.KeyToken, workitemMp.Version.ToString());


            WriteDebug(incidentCriteria);
            // Define the criteria object by using one of the criteria strings.
            ObjectProjectionCriteria criteria = new ObjectProjectionCriteria(incidentCriteria, incidentTypeProjection, emg);

            EnterpriseManagementObjectProjection emop = null;

            // For each retrieved type projection, display the properties.
            foreach (EnterpriseManagementObjectProjection projection in
                     emg.EntityObjects.GetObjectProjectionReader <EnterpriseManagementObject>(criteria, ObjectQueryOptions.Default))
            {
                emop = projection;
            }

            if (emop != null)
            {
                SMHelpers.UpdateIncident(emg, clsIncident, emop, this.Impact, this.Urgency, this.Status, this.Classification, this.Source, this.SupportGroup, this.Comment, this.UserComment, this.Description, this.AttachmentPath);
            }
            else
            {
                WriteError(new ErrorRecord(new ObjectNotFoundException(_ID), "Incident not found", ErrorCategory.ObjectNotFound, criteria));
                return;
            }
        }
Exemplo n.º 6
0
        protected override void ProcessRecord()
        {
            ManagementPackClass clsIncident = SMHelpers.GetManagementPackClass(ClassTypes.System_WorkItem_Incident, SMHelpers.GetManagementPack(ManagementPacks.System_WorkItem_Incident_Library, _mg), _mg);

            ManagementPack incidentProjectionMp = SMHelpers.GetManagementPack(ManagementPacks.ServiceManager_IncidentManagement_Library, _mg);
            ManagementPackTypeProjection incidentTypeProjection = SMHelpers.GetManagementPackTypeProjection(TypeProjections.System_WorkItem_Incident_ProjectionType, incidentProjectionMp, _mg);

            WriteVerbose("Starting to build search criteria...");
            List <string> criterias    = new List <string>();
            bool          haveCriteria = false;


            // Define the query criteria string.
            // This is XML that validates against the Microsoft.EnterpriseManagement.Core.Criteria schema.
            StringBuilder incidentCriteria = new StringBuilder(String.Format(@"
                <Criteria xmlns=""http://Microsoft.EnterpriseManagement.Core.Criteria/"">
                  <Reference Id=""System.WorkItem.Incident.Library"" PublicKeyToken=""{0}"" Version=""{1}"" Alias=""WorkItem"" />
                      <Expression>", incidentMp.KeyToken, incidentMp.Version.ToString()));

            if (this._ID != null)
            {
                haveCriteria = true;
                WriteVerbose(string.Format("Adding \"ID equal {0}\" to search criteria", this.ID));
                criterias.Add(String.Format(criteriaString, "Id", "Equal", _ID));
            }

            if (this._Title != null)
            {
                haveCriteria = true;
                WriteVerbose(string.Format("Adding \"Title like {0}\" to search criteria", this.Title));
                criterias.Add(String.Format(criteriaString, "Title", "Like", _Title));
            }

            if (this.Impact != null)
            {
                haveCriteria = true;
                ManagementPackEnumeration impEnum = SMHelpers.GetEnum(this.Impact, impactBase);
                WriteVerbose(string.Format("Adding \"Impact equal {0}({1})\" to search criteria", impEnum.DisplayName, impEnum.Id));
                criterias.Add(String.Format(criteriaString, "Impact", "Equal", impEnum.Id));
            }

            if (this.Urgency != null)
            {
                haveCriteria = true;
                ManagementPackEnumeration urgEnum = SMHelpers.GetEnum(this.Urgency, urgencyBase);
                WriteVerbose(string.Format("Adding \"Urgency equal {0}({1})\" to search criteria", urgEnum.DisplayName, urgEnum.Id));
                criterias.Add(String.Format(criteriaString, "Urgency", "Equal", urgEnum.Id));
            }

            if (this.Status != null)
            {
                haveCriteria = true;
                ManagementPackEnumeration statEnum = SMHelpers.GetEnum(this.Status, statusBase);
                WriteVerbose(string.Format("Adding \"Status equal {0}({1})\" to search criteria", statEnum.DisplayName, statEnum.Id));
                criterias.Add(String.Format(criteriaString, "Status", "Equal", statEnum.Id));
            }

            if (this.Classification != null)
            {
                haveCriteria = true;
                ManagementPackEnumeration classificationEnum = SMHelpers.GetEnum(this.Classification, classificationBase);
                WriteVerbose(string.Format("Adding \"Classification equal {0}({1})\" to search criteria", classificationEnum.DisplayName, classificationEnum.Id));
                criterias.Add(String.Format(criteriaString, "Classification", "Equal", classificationEnum.Id));
            }

            if (this.CreatedBefore != DateTime.MinValue)
            {
                haveCriteria = true;
                CultureInfo enUsInfo = new CultureInfo("en-US");
                WriteVerbose(string.Format("Adding \"CreatedDate less than {0}\" to search criteria", this.CreatedBefore.ToString()));
                criterias.Add(String.Format(criteriaString, "CreatedDate", "Less", CreatedBefore.ToUniversalTime()));
            }

            if (this.CreatedAfter != DateTime.MinValue)
            {
                haveCriteria = true;
                CultureInfo enUsInfo = new CultureInfo("en-US");
                WriteVerbose(string.Format("Adding \"CreatedDate greater than {0}\" to search criteria", this.CreatedAfter.ToString()));
                criterias.Add(String.Format(criteriaString, "CreatedDate", "Greater", this.CreatedAfter.ToUniversalTime()));
            }

            if (criterias.Count > 1)
            {
                haveCriteria = true;
                for (int i = 0; i < criterias.Count; i++)
                {
                    criterias[i] = "<Expression>" + criterias[i] + "</Expression>";
                }
            }

            if (criterias.Count > 1)
            {
                incidentCriteria.AppendLine("<And>");
            }

            foreach (var item in criterias)
            {
                incidentCriteria.AppendLine(item);
            }

            if (criterias.Count > 1)
            {
                incidentCriteria.AppendLine("</And>");
            }

            incidentCriteria.AppendLine(@"</Expression>
                </Criteria>");

            WriteDebug("Search criteria: " + incidentCriteria.ToString());

            ObjectProjectionCriteria criteria = null;

            if (haveCriteria)
            {
                // Define the criteria object by using one of the criteria strings.
                criteria = new ObjectProjectionCriteria(incidentCriteria.ToString(), incidentTypeProjection, _mg);
                WriteVerbose("Criteria is: " + incidentCriteria.ToString());
            }
            else
            {
                criteria = new ObjectProjectionCriteria(incidentTypeProjection);
                WriteVerbose("Criteria is Projection");
            }
            string[] EnumPropertiesToAdapt = { "Urgency", "Impact", "TierQueue", "Classification", "Status" };
            // For each retrieved type projection, display the properties.
            List <EnterpriseManagementObjectProjection> result = new List <EnterpriseManagementObjectProjection>();

            foreach (EnterpriseManagementObjectProjection projection in
                     _mg.EntityObjects.GetObjectProjectionReader <EnterpriseManagementObject>(criteria, ObjectQueryOptions.Default))
            {
                if (this.InactiveFor == TimeSpan.Zero || projection.Object.LastModified.Add(this.InactiveFor) < DateTime.UtcNow)
                {
                    //if (this.OlderThan == TimeSpan.Zero || projection.Object.TimeAdded.Add(this.OlderThan) < DateTime.UtcNow)
                    //{
                    //result.Add(projection);
                    WriteVerbose(String.Format("Adding incident \"{0}\" to the pipeline", projection.Object.Name));
                    // WriteObject(projection, false);
                    PSObject o = new PSObject();
                    o.Members.Add(new PSNoteProperty("__base", projection));
                    o.Members.Add(new PSScriptMethod("GetAsXml", ScriptBlock.Create("[xml]($this.__base.CreateNavigator().OuterXml)")));
                    o.Members.Add(new PSNoteProperty("Object", ServiceManagerObjectHelper.AdaptManagementObject(this, projection.Object)));
                    o.Members.Add(new PSNoteProperty("ID", projection.Object[null, "Id"]));
                    o.Members.Add(new PSNoteProperty("Title", projection.Object[null, "Title"]));
                    o.Members.Add(new PSNoteProperty("Description", projection.Object[null, "Description"]));
                    o.Members.Add(new PSNoteProperty("DisplayName", projection.Object[null, "DisplayName"]));
                    o.Members.Add(new PSNoteProperty("Priority", projection.Object[null, "Priority"]));
                    foreach (string s in EnumPropertiesToAdapt)
                    {
                        o.Members.Add(new PSNoteProperty(s, GetEnumerationDisplayString(projection.Object[null, s])));
                    }

                    o.Members.Add(new PSNoteProperty("CreatedDate", projection.Object[null, "CreatedDate"]));
                    o.Members.Add(new PSNoteProperty("LastModified", projection.Object.LastModified.ToLocalTime()));
                    // add the relationship values
                    foreach (KeyValuePair <ManagementPackRelationshipEndpoint, IComposableProjection> helper in projection)
                    {
                        // EnterpriseManagementObject myEMO = (EnterpriseManagementObject)helper.Value.Object;
                        WriteVerbose("Adapting relationship objects: " + helper.Key.Name);
                        String   myName     = helper.Key.Name;
                        PSObject adaptedEMO = ServiceManagerObjectHelper.AdaptManagementObject(this, helper.Value.Object);
                        if (helper.Key.MaxCardinality > 1)
                        {
                            // OK, this is a collection, so add the critter
                            // This is so much easier in PowerShell
                            if (o.Properties[myName] == null)
                            {
                                o.Members.Add(new PSNoteProperty(myName, new ArrayList()));
                            }
                            ((ArrayList)o.Properties[myName].Value).Add(adaptedEMO);
                        }
                        else
                        {
                            try
                            {
                                o.Members.Add(new PSNoteProperty(helper.Key.Name, adaptedEMO));
                            }
                            catch (ExtendedTypeSystemException e)
                            {
                                WriteVerbose("Readapting relationship object -> collection :" + e.Message);
                                // We should really only get this exception if we
                                // try to add a create a new property which already exists
                                Object    currentPropertyValue = o.Properties[myName].Value;
                                ArrayList newValue             = new ArrayList();
                                newValue.Add(currentPropertyValue);
                                newValue.Add(adaptedEMO);
                                o.Properties[myName].Value = newValue;

                                // WriteError(new ErrorRecord(e, "AddAssociatedObject", ErrorCategory.InvalidOperation, p));
                            }
                        }
                    }


                    o.TypeNames[0] = String.Format(CultureInfo.CurrentCulture, "EnterpriseManagementObjectProjection#{0}", incidentTypeProjection.Name);
                    WriteObject(o);
                    //}
                }
            }
        }
Exemplo n.º 7
0
        protected override void ProcessRecord()
        {
            try
            {
                ManagementPackClass clsIncident = SMHelpers.GetManagementPackClass(ClassTypes.System_WorkItem_Incident, SMHelpers.GetManagementPack(ManagementPacks.System_WorkItem_Incident_Library, _mg), _mg);

                EnterpriseManagementObjectProjection incidentProjection = new EnterpriseManagementObjectProjection(_mg, clsIncident);

                WriteVerbose("Setting basic properties");
                incidentProjection.Object[clsIncident, "Id"].Value = incidentPrefix;

                incidentProjection.Object[clsIncident, "Title"].Value = this.Title;

                if (CreatedDate != null)
                {
                    incidentProjection.Object[clsIncident, "CreatedDate"].Value = this.CreatedDate;
                }

                SMHelpers.UpdateIncident(_mg, clsIncident, incidentProjection,
                                         this.Impact, this.Urgency, this.Status, this.Classification, this.Source, this.SupportGroup, null, null, this.Description, null);


                if (AffectedCIs != null)
                {
                    WriteVerbose("Adding affected CIs");
                    foreach (var item in AffectedCIs)
                    {
                        WriteVerbose(string.Format("Adding {0} as affected configuration item.", item.Object.DisplayName));
                        SMHelpers.AddAffectedCI(incidentProjection, item.Object, _mg);
                    }
                }

                if (AffectedUser != null)
                {
                    WriteVerbose(string.Format("Adding {0} as affected configuration item.", AffectedUser));
                    SMHelpers.AddAffectedUser(incidentProjection, this.AffectedUser, _mg);
                }

                // a bulk operation
                // do in batches of toCommit (set above)
                if (Bulk)
                {
                    toCommit++;
                    idd.Add(incidentProjection);
                    if (toCommit >= batchSize)
                    {
                        idd.Commit(_mg);
                        idd      = new IncrementalDiscoveryData();
                        toCommit = 0;
                    }
                }
                else
                {
                    incidentProjection.Commit();
                }

                if (PassThru)
                {
                    //Pass the new object to the pipeline
                    WriteObject(incidentProjection);
                }
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "NewIncident", ErrorCategory.InvalidOperation, Title));
            }
        }
Exemplo n.º 8
0
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     if (Bulk)
     {
         idd = new IncrementalDiscoveryData();
     }
     // If you can't get the prefix, just prepend 'IR'
     try
     {
         ManagementPackClass        incidentSettings         = SMHelpers.GetManagementPackClass("System.WorkItem.Incident.GeneralSetting", SMHelpers.GetManagementPack("ServiceManager.IncidentManagement.Library", _mg), _mg);
         EnterpriseManagementObject incidentSettingsInstance = _mg.EntityObjects.GetObject <EnterpriseManagementObject>(incidentSettings.Id, ObjectQueryOptions.Default);
         incidentPrefix = incidentSettingsInstance[null, "PrefixForId"].Value.ToString() + "{0}";
     }
     catch
     {
         // do nothing - incidentPrefix was already set
         ;
     }
 }
Exemplo n.º 9
0
        //TODO: Add support for this at some point

        /*
         * [Parameter(ValueFromPipeline = false, Mandatory = false)]
         * public ManagementPackImage Image
         * {
         *  get { return _image; }
         *  set { _image = value; }
         * }
         */

        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            //Create a new folder and set it's parent folder and display name
            ManagementPackFolder folder = new ManagementPackFolder(_managementpack, SMHelpers.MakeMPElementSafeUniqueIdentifier("Folder"), ManagementPackAccessibility.Public);

            folder.DisplayName  = _displayname;
            folder.ParentFolder = _parentfolder;

            //TODO: Parameterize this someday
            //Set the systemfolder icon to be the icon that is used
            ManagementPackElementReference <ManagementPackImage> foldericonreference = (ManagementPackElementReference <ManagementPackImage>)_mg.Resources.GetResource <ManagementPackImage>(Images.Microsoft_EnterpriseManagement_ServiceManager_UI_Console_Image_Folder, SMHelpers.GetManagementPack(ManagementPacks.Microsoft_EnterpriseManagement_ServiceManager_UI_Console, _mg));
            ManagementPackImageReference image = new ManagementPackImageReference(folder, foldericonreference, _managementpack);

            //Submit changes
            _managementpack.AcceptChanges();
        }
Exemplo n.º 10
0
        protected override void ProcessRecord()
        {
            try
            {
                base.ProcessRecord();

                ManagementPackView view = new ManagementPackView(ManagementPack, SMHelpers.MakeMPElementSafeUniqueIdentifier("View"), ManagementPackAccessibility.Internal);
                view.DisplayName = _DisplayName;     //Set the display name according to what the user specified
                view.Target      = _Class;           //Set the class according to what the user specified

                //TODO: Parameterize these later
                view.Visible       = true;
                view.Accessibility = ManagementPackAccessibility.Public;
                view.Enabled       = true;
                view.Category      = "NotUsed";

                //Set the parent folder that was passed in
                ManagementPackFolderItem folderitem = new ManagementPackFolderItem(view, _Folder);

                //Add the management pack references to the MP
                if (_ManagementPackReferences != null)
                {
                    foreach (KeyValuePair <string, ManagementPackReference> kvp in _ManagementPackReferences)
                    {
                        _ManagementPack.References.Add(kvp);
                    }
                }

                //Get the Grid view type and set it for the view
                ManagementPack mpConsole = SMHelpers.GetManagementPack(ManagementPacks.Microsoft_EnterpriseManagement_ServiceManager_UI_Console, _mg);
                view.TypeID = mpConsole.GetViewType("GridViewType");

                #region DataAdapters

                DataAdapter daEMO          = new DataAdapter();
                DataAdapter daAdvancedList = new DataAdapter();

                if (_Projection != null)
                {
                    daEMO.Name = "dataportal:EnterpriseManagementObjectAdapter";
                    daEMO.Type = "Microsoft.EnterpriseManagement.UI.SdkDataAccess.DataAdapters.EnterpriseManagementObjectProjectionAdapter";
                }
                else
                {
                    daEMO.Name = "dataportal:EnterpriseManagementObjectProjectionAdapter";
                    daEMO.Type = "Microsoft.EnterpriseManagement.UI.SdkDataAccess.DataAdapters.EnterpriseManagementObjectAdapter";
                }

                daEMO.Assembly = "Microsoft.EnterpriseManagement.UI.SdkDataAccess";

                daAdvancedList.Name     = "viewframework://Adapters/AdvancedList";
                daAdvancedList.Assembly = "Microsoft.EnterpriseManagement.UI.ViewFramework";
                daAdvancedList.Type     = "Microsoft.EnterpriseManagement.UI.ViewFramework.AdvancedListSupportAdapter";

                Collection <DataAdapter> collDataAdpaters = new Collection <DataAdapter>();
                collDataAdpaters.Add(daEMO);
                collDataAdpaters.Add(daAdvancedList);

                #endregion DataAdapters

                view.Configuration = CreateViewConfiguration(collDataAdpaters, _columns);

                foreach (Column column in _columns)
                {
                    ManagementPackStringResource mpsr = new ManagementPackStringResource(view.GetManagementPack(), column.DisplayNameId);
                    mpsr.DisplayName = column.DisplayNameString;
                }

                //Set the image
                if (_image != null)
                {
                    ManagementPackElementReference <ManagementPackImage> viewIconReference = (ManagementPackElementReference <ManagementPackImage>)_mg.Resources.GetResource <ManagementPackImage>(_image.Name, _image.GetManagementPack());
                    ManagementPackImageReference imageref = new ManagementPackImageReference(view, viewIconReference, view.GetManagementPack());
                }

                view.GetManagementPack().AcceptChanges();

                if (PassThru)
                {
                    //Pass the new object to the pipeline
                    WriteObject(view);
                }
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "NewView", ErrorCategory.InvalidOperation, DisplayName));
            }
        }