<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't get an AD cmdlet to execute in WFA in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15644#M3139</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks sinhaa, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 23:58:43 GMT</pubDate>
    <dc:creator>korns</dc:creator>
    <dc:date>2014-05-15T23:58:43Z</dc:date>
    <item>
      <title>Can't get an AD cmdlet to execute in WFA</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15629#M3137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached is a very small WFA command that uses the Windows ServerManager ActiveDirectory commands to create an AD group. I can cut/paste the try/catch statement to a PoSH window and it executes as expected and creates the group. When I am in WFA and editing the command and use the [Test] button or execute it in a workflow it seems to do nothing and gives no error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: the basic code is pasted below. When I cut/paste the logic to PoSH window I comment the&amp;nbsp; WFALogger command and use the write-output "$errMsg" instead. It runs, and when it runs twice it catches the error that the groupName already exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume the New-ADGroup cmdlet requires administrator privileges but I don't know what prig-level or account WFA command run under.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;param (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="Prefix String")]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; [string] $PrefixString&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#&amp;nbsp;&amp;nbsp; Description: Create AD Groups and ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;# Setup environment to use Active Directory modules&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Import-module servermanager&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-WindowsFeature -Name “RSAT-AD-Powershell” –includeAllSubFeature&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Import-Module activedirectory&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;try {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New-ADGroup -name XYZZY-Group -GroupScope Universal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch&amp;nbsp; [System.Exception] {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $errMsg = "New-ADGroup: could not create group: $($_.Exception)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-WFALogger -message $errMsg -Error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #write-output "$errMsg"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 05:36:18 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15629#M3137</guid>
      <dc:creator>korns</dc:creator>
      <dc:date>2025-06-05T05:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get an AD cmdlet to execute in WFA</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15635#M3138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The command scope is the problem. You have a {} pair before your try-catch. They are marked in RED below and commented out. The below code works as expected.&lt;/P&gt;&lt;P&gt;=======&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;param (&lt;/P&gt;&lt;P&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="Prefix String")]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [string] $PrefixString&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp; Description: Create AD Groups and ...&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;# Setup environment to use Active Directory modules&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Import-module servermanager&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-WindowsFeature -Name “RSAT-AD-Powershell” –includeAllSubFeature&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Import-Module activedirectory&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;#{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New-ADGroup -name XYZZY-Group -GroupScope Universal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch&amp;nbsp; [System.Exception] {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $errMsg = "New-ADGroup: could not create group: $($_.Exception)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-WFALogger -message $errMsg -Error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #write-output "$errMsg"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;#}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=======&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ &lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;I presume the New-ADGroup cmdlet requires administrator privileges but I don't know what prig-level or account WFA command run under.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;======&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;WFA command runs using local system account by default. This of course can be changed. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;@ &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: 'courier new', courier;"&gt;# Setup environment to use Active Directory modules&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: 'courier new', courier; color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Import-module servermanager&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: 'courier new', courier; color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-WindowsFeature -Name “RSAT-AD-Powershell” –includeAllSubFeature&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: 'courier new', courier;"&gt;------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'courier new', courier;"&gt;I don't think this needs to be done at command level, every single time the command executes. RSAT loading could take time and its a one-time activity. So I suggest you do it from outside once and only use Import-module ActiveDirectory in the command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'courier new', courier;"&gt;sinhaa&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial, Helvetica, Verdana, sans-serif; color: #454545; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: 'courier new', courier;"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Abhishek Sinha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 08:55:33 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15635#M3138</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2014-05-13T08:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get an AD cmdlet to execute in WFA</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15644#M3139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks sinhaa, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 23:58:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Can-t-get-an-AD-cmdlet-to-execute-in-WFA/m-p/15644#M3139</guid>
      <dc:creator>korns</dc:creator>
      <dc:date>2014-05-15T23:58:43Z</dc:date>
    </item>
  </channel>
</rss>

