Afternoon folks
I have a simple Powershell script to extract information from Active Directory, which, before we upgraded our project from Windows Legacy to Windows was working without issue, and continues to work if we roll back to the original issue.
The script (saved as a .ps1 file) is as below
Get-ADUser -Filter * -properties EmailAddress -SearchBase $Container | Select-Object Name, SamAccountName, EmailAddress, DistinguishedName, Enabled | Export-Csv $FilePath -NoTypeInformation
with the parameters $Container and $FilePath either being included in the ps1 file or passed as parameters.
If I run the script in a Powershell window, it runs without issue
If I run it from the Invoke Powershell Activity, it fails and returns an error
Invoke Power Shell: File C:\powershell\GetADUsersSubset1.ps1 cannot be loaded because running scripts is disabled on this system.
The execution policies are set as follows
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Bypass
Any assistance appreciate please
Many thanks