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 - Help needed on PSEnsure (works on Plan but not on Configuration)
-
Hello
I made a small PSEnsure script to create an AD Group - test case -
Running directly from an Otter Plan it is working as expected:- if the group exists, it does nothing
- if the group doesn't exist, it creates the group
From a configuration Plan inside a Role
- the Verify step works as expected
- the Remediation step returns an error
Powershell Script: New-ADGroup
<# .DESCRIPTION Create AD Group .AHCONFIGKEY $Name .AHEXECMODE $ExecMode #> Param( [Parameter(Mandatory=$false)] [string]$Name="TEST", [Parameter(Mandatory=$false)] [string]$GroupCategory="Security", [Parameter(Mandatory=$false)] [string]$GroupScope="DomainLocal", [Parameter(Mandatory=$false)] [string]$DisplayName="TEST", [Parameter(Mandatory=$false)] [string]$Path="OU=Serveurs,OU=Groupes,DC=OCAPIAT,DC=FR", [Parameter(Mandatory=$false)] [string]$Description="Test" ) if ($ExecMode -eq "Configure") { if ([bool](Get-ADGroup -filter "Name -eq '$($Name)'")){ return $true} else { New-ADGroup -Name $Name -GroupCategory $GroupCategory -GroupScope $GroupScope -DisplayName $DisplayName -Path $Path -Description $Description -Verbose } }else{ if ([bool](Get-ADGroup -filter "Name -eq '$($Name)'")){ return $true} else { return $false } }
Otter Plan : TESTPLAN
##AH:UseTextMode PSEnsure New-ADGroup ( Name: TEST2 );
Role : TESTROLE
##AH:UseTextMode PSEnsure New-ADGroup ( Name: TEST2 );
Prerequisite on the server : RSAT-AD-Powershell feature
I can't figure out what I am doing wrong, any help would be appreciate
Best Regards
Philippe
-
@philippe-camelio_3885 thanks for sharing all the logs!
Can you confirm... which version of the Scripting extension are you using? I see @apxltd made a pre-release version (1.10.2-rc.3) but it's not yet released.
-
@atripp @philippe-camelio_3885 whoops!
This error should be fixed already, and I just published 1.10.2 - please try that!
-
@apxltd
Thank you, problem fixed