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