-
My script runs fine within the IDE but Request-FalconToken returns ERROR 'Unable to find type [ApiClient]' when running the script as Windows Scheduled Task. Confirmed the prior 'Import-Module -Name PSFalcon' command was successful. Not saying there is any issue with the PSFalcon module (using 2.1.3), just wondering if anyone has experienced this issue and has any advice to fix? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
If you're getting the The Generally speaking, if you're trying to set up PSFalcon to be used in a scheduled task, you'll want to ensure that:
|
Beta Was this translation helpful? Give feedback.
-
Yes, the task is running under my profile and I own that folder. I've also tried manually importing from the following locations:
I'll keep on digging and update here if I get it figured out. Thanks for your help. [Edit] |
Beta Was this translation helpful? Give feedback.
-
After some further experimentation it seems the error only occurs when importing PSFalon from within a function. So this works:
This causes the error:
|
Beta Was this translation helpful? Give feedback.
-
Other than that, there is nothing special about using PSFalcon in a scheduled task. Below is the relevant information for the task I’ve scheduled. Feel free to use, change or not use in your Wiki as you see fit. Let me know if you need more info and thanks again for PSFalcon!
|
Beta Was this translation helpful? Give feedback.
Yes, the task is running under my profile and I own that folder. I've also tried manually importing from the following locations:
I'll keep on digging and update here if I get it figured out. Thanks for your help.
[Edit]
I just found this article (https://newbedev.com/powershell-unable-to-find-type-when-using-ps-5-classes) which seems like the issue I'm having although not sure how to implement the suggested fix.