示例#1
0
        public override void ExecuteCmdlet()
        {
            var groupCreateParams = new GroupCreateParameters()
            {
                DisplayName  = DisplayName,
                MailNickname = MailNickname
            };

            ExecutionBlock(() =>
            {
                if (ShouldProcess(target: DisplayName, action: string.Format("Creating a new AD group with display name '{0}'", DisplayName)))
                {
                    WriteObject(ActiveDirectoryClient.CreateGroup(groupCreateParams));
                }
            });
        }
示例#2
0
        public override void ExecuteCmdlet()
        {
            var groupCreateParams = new GroupCreateParameters()
            {
                DisplayName          = DisplayName,
                MailNickname         = MailNickname,
                AdditionalProperties = new System.Collections.Generic.Dictionary <string, object>()
            };

            if (!string.IsNullOrEmpty(Description))
            {
                groupCreateParams.AdditionalProperties.Add("description", Description);
            }

            ExecutionBlock(() =>
            {
                if (ShouldProcess(target: DisplayName, action: string.Format("Creating a new AD group with display name '{0}'", DisplayName)))
                {
                    WriteObject(ActiveDirectoryClient.CreateGroup(groupCreateParams));
                }
            });
        }