Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    OTTER 3 - Can't make new PSEnsure working

    Scheduled Pinned Locked Moved Support
    3 Posts 2 Posters 9 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by

      Hello

      I am looking to use the new PSEnsure. but it is not working. - I mean I can't find the right syntax :(
      Any help would be appreciated

      PS SCript

      <# 
      .DESCRIPTION
      Create AD Group 
      
      .AHCONFIGKEY
      $Name
      
      .AHDESIREDVALUE
      True
      
      .AHEXECMODE
      $ExecMode
      #>
      Param(
         [Parameter(Mandatory=$false)]
         [string]$Name, 
      
         [Parameter(Mandatory=$false)]
         [string]$GroupCategory="Security", 
      
         [Parameter(Mandatory=$false)]
         [string]$GroupScope="DomainLocal", 
      
         [Parameter(Mandatory=$false)]
         [string]$DisplayName, 
      
         [Parameter(Mandatory=$false)]
         [string]$Path,
      
         [Parameter(Mandatory=$false)]
         [string]$Description
      )
      if ($ExecMode -eq "Configure") {
          New-ADGroup -Name $Name -GroupCategory $GroupCategory -GroupScope $GroupScope  -DisplayName $DisplayName -Path $Path -Description $Description
      }else{
      if ([bool](Get-ADGroup -filter "Name -eq '$($Name)'")){ return $true} else { return $false }
      }
      

      Configuraiton Plan for a Role

      # Groupes AD
      {
          # Groupe Administrateurs locaux du serveur
          set $Path = OU=Serveurs,OU=Groupes,$DomainNameDC;
          set $Description = Administrateurs locaux du serveur;
          set $Name = SRV-ADM-$ServerName;
      
          PSEnsure Set-ADGroup
          (
              Name: $Name,
              GroupCategory: Security,
              GroupScope: Domainlocal,
              DisplayName: $Name,
              Path: $Path,
              Description: $Description
          );
          set $Name = SRV-USR-$ServerName;
          set $Description = Utilisateurs locaux du serveur;
          PSEnsure Set-ADGroup
          (
              Name: $Name,
              GroupCategory: Security,
              GroupScope: Domainlocal,
              DisplayName: $Name,
              Path: $Path,
              Description: $Description
          );
      }
      

      The partial result of the Collect step is:

      Collecting current configuration from server...
      Importing ExecMode...
      Assigning parameter Name...
      Assigning parameter GroupCategory...
      Assigning parameter GroupScope...
      Assigning parameter DisplayName...
      Assigning parameter Path...
      Assigning parameter Description...
      True
      Storing current configuration...
      Comparing configuration...
      Difference: SRV-ADM-VM008003
       =Template=> True
       = Actual => 
      Configuration drift detected.
      

      A Configuration drift is detected but it should not, what is wrong ?

      1 Reply Last reply Reply Quote 0
      • apxltdA Offline
        apxltd inedo-engineer
        last edited by

        Hey @philippe-camelio_3885 ,

        Ah, looks like this is a bug in the Scripting extension, and will happen if you don't specify the .AHCURRENTVALUE comment block.

        I just patched it real quick (please install Scripting v1.10.2-CI.1), and now at a absolute minimum this would work:

        <# 
        .DESCRIPTION
        Create AD Group 
        
        .AHEXECMODE
        $ExecMode
        #>
        

        Given your script, here are the other values I recommend...

        .AHCONFIGTYPE
        ADGroup
        .AHCONFIGKEY
        $Name
        

        There's something a little funny about the collected Value after remediating drift, but taht's something we'll look at later. For now we need to get these docs published; they're draft for now.

        Anyway please give this a shot and let us know how it goes

        Founder and CEO, Inedo

        1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885
          last edited by

          Thank you Alex

          bug is gone 👏

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post
          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation