Periodic errors checking for status of get file #100
-
I have a script which collects data off the host, uses a get request to upload the output to CS and then downloads that data from CS to one of our servers. Occasionally I have failures while my script is running a loop checking whether the get file has uploaded to CS. Here is a snippet of the code that is running:
What's odd is that the error that I see when this fails is as follows:
Any idea why it can't find the Request-FalconToken function? The script works the majority of times without issue and even when it fails that function has been called multiple times before failing. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
The PSFalcon module will not automatically import to PowerShell (I think because the module adds 'Falcon' as a prefix rather than having it in the command names). I'm not sure if that's the cause of the problem, but the error you're getting is acting like PowerShell can't find PSFalcon. I don't see any code showing that you're importing the module as part of the script. Have you tried a requires statement? Forcing the module to be present should stop that error from showing up... |
Beta Was this translation helpful? Give feedback.
-
Yep I'm importing it in the beginning of the script. I have a ton of other stuff that occurs in the script prior to the part where it's failing that uses PSFalcon so I would think if it was an issue with the module not being available it would have failed prior to that. |
Beta Was this translation helpful? Give feedback.
-
If you're using |
Beta Was this translation helpful? Give feedback.
-
alright cool I'll give that a shot. |
Beta Was this translation helpful? Give feedback.
If you're using
Import-Module
, try using a requires statement instead and see if that fixes it. The error makes me suspect that somehow PowerShell is creating a separate process at some point which doesn't have the module loaded. There's not really any reason in the code of PSFalcon that this should be happening, so I can't really offer any advice beyond trying a few different methods to make sure the module is imported and see if you can narrow it down...