Forum Discussion
wpinedo
Jun 17, 2024Copper Contributor
AD cmdlets not working
I'm trying to locate users in Active Directory using a function. When I run the code in either ISE or Visual Studio Code, the lookup works. When I run the script in a PowerShell window the lookup doe...
wpinedo
Copper Contributor
No messages. I'm using the ISE to test version 5.x and VS Code to test version 7.x and they both work. Using both a 5.x or a 7.x window doesn't.
LainRobertson
Jun 18, 2024Silver Contributor
I can't offer any informed suggestions then.
If you run the following command in the native console, are any of the following set to "SilentlyContinue"?
Get-Variable -Name "*preference";
- ErrorActionPreference;
- InformationPreference;
- WarningPreference.
If they are, then set them to "Continue" and re-run your script to see if you get get any messages back.
Otherwise, I can only suggest checking the following locations in Event Viewer to see if it offers any hints as to why nothing at all - even errors or warnings - is being returned.
- Applications and Services/Microsoft/Windows/AppLocker/EXE and Script
- Applications and Services/Microsoft/Windows/PowerShell/Operational
- Applications and Services/PowerShellCore/Operational
- Applications and Services/Windows PowerShell
If there really are zero errors, warning or other forms of feedback, then the only other option is that the script is running without error but simply returning no data to the pipeline.
Cheers,
Lain