My script is fairly simple. Just clearing out some AD group.
Get-ADGroupMember "ADGroup1" | ForEach-Object {Remove-ADGroupMember "ADGroup1" $_ -Confirm:$false}
Get-ADGroupMember "ADGroup2" | ForEach-Object {Remove-ADGroupMember "ADGroup2" $_ -Confirm:$false}
Get-ADGroupMember "ADGroup3" | ForEach-Object {Remove-ADGroupMember "ADGroup3" $_ -Confirm:$false}
My Actions are also pretty straight forward. And I do have run with highest privileges checked. However i keep getting "Action Failed to start", followed by "Task Failed to start" error and Last Result as "Directory name is invalid(0x8007010B) Any help is greatly appreciated. I am running it on Windows 10. thanks
In powershell 5.1 powershell.exe with no parameter defaults to -Command
and you need to specify -File
. If you're using powershell core 6+ it defaults to -File
and you wouldn't need to specify. I've tested and confirmed you need to add at least -File
for it to work. You can also clean up your script some like this.
"ADGroup1","ADGroup2","ADGroup3" | ForEach-Object {
Remove-ADGroupMember $_ (Get-ADGroupMember $_) -Confirm:$false
}
Could you try
Program/Script:
powershell
Add arguments:
.\ADAutomation.ps1
Start in:
"C:\Dev\"
As you are already changing the Start in directory there is no need to call the whole filepath.
Note the commas in the start in field
User contributions licensed under CC BY-SA 3.0