File size: 2,170 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;

using Microsoft.PowerShell.LocalAccounts;

namespace Microsoft.PowerShell.Commands
{
    /// <summary>
    /// Describes a Local Group.
    /// Objects of this type are provided to and returned from group-related Cmdlets.
    /// </summary>
    public class LocalGroup : LocalPrincipal
    {
        #region Public Properties
        /// <summary>
        /// A short description of the Group.
        /// </summary>
        public string Description { get; set; }
        #endregion Public Properties

        #region Construction
        /// <summary>
        /// Initializes a new LocalGroup object.
        /// </summary>
        public LocalGroup()
        {
            ObjectClass = Strings.ObjectClassGroup;
        }

        /// <summary>
        /// Initializes a new LocalUser object with the specified name.
        /// </summary>
        /// <param name="name">Name of the new LocalGroup.</param>
        public LocalGroup(string name)
          : base(name)
        {
            ObjectClass = Strings.ObjectClassGroup;
        }

        /// <summary>
        /// Construct a new LocalGroup object that is a copy of another.
        /// </summary>
        /// <param name="other"></param>
        private LocalGroup(LocalGroup other)
          : this(other.Name)
        {
            Description = other.Description;
        }
        #endregion Construction

        #region Public Methods
        /// <summary>
        /// Provides a string representation of the LocalGroup object.
        /// </summary>
        /// <returns>
        /// A string containing the Group Name.
        /// </returns>
        public override string ToString()
        {
            return Name ?? SID.ToString();
        }

        /// <summary>
        /// Create a copy of a LocalGroup object.
        /// </summary>
        /// <returns>
        /// A new LocalGroup object with the same property values as this one.
        /// </returns>
        public LocalGroup Clone()
        {
            return new LocalGroup(this);
        }
        #endregion Public Methods
    }
}