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
-
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 appreciatedPS 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 ?
-
Hey @philippe-camelio_3885 ,
Ah, looks like this is a bug in the
Scriptingextension, and will happen if you don't specify the.AHCURRENTVALUEcomment 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 $NameThere's something a little funny about the collected
Valueafter 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
-
Thank you Alex
bug is gone

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