When i ran the below workflow, it give the error
“The term ‘Add-ADPermission’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.”
can some one help me to understand why its fails ? ( i can run the smae command if im not using workflow
Im using workflow to run the jobs in parallal.
Workflow WF-comp{
$Data= Import-Csv X:\Files\comp.csv
ForEach ($item in $Data){
Add-ADPermission $item.ComputerName -User Mydom\JoinQUADAcc -AccessRights Self -Properties DNS-Host-Name,Service-Principal-Name -InheritanceType None
Add-ADPermission $item.ComputerName -User Mydom\JoinQUADAcc -AccessRights DeleteTree,ExtendedRight,Delete,GenericRead,WriteProperty -Properties User-Account-Restrictions,SAM-Account-Name,Display-Name,Description,User-Logon -InheritanceType None
}
}
WF-comp
Hi Sandheep,
The Add-ADPermission cmdlet of the Exchange Management Shell is probably not exposed as Workflow activity but you can wrap your script into an InlineScript block which gets executed in a separate PowerShell host process. Additionally you might need to dot-source the bootstrap script of the Exchange Management Shell before your ForEach block.
Workflow WF-comp{
InlineScript {
$Data= Import-Csv X:\Files\comp.csv
ForEach ($item in $Data){
Add-ADPermission $item.ComputerName -User Mydom\JoinQUADAcc -AccessRights Self -Properties DNS-Host-Name,Service-Principal-Name -InheritanceType None
Add-ADPermission $item.ComputerName -User Mydom\JoinQUADAcc -AccessRights DeleteTree,ExtendedRight,Delete,GenericRead,WriteProperty -Properties User-Account-Restrictions,SAM-Account-Name,Display-Name,Description,User-Logon -InheritanceType None
}
}
}
WF-comp
I hope that helps. Unfortunately, I don’t have access to an Exchange installation.
Best,
Daniel