Welcome › Forums › General PowerShell Q&A › Controller Script & Module
Could someone please help with a little guidance.
I recently built approximately 14 functions (12 public/ 2 private), however now i would like to create scheduled task on each server to execute the functions, then output the data to a sql database.
I thought just create a control script to do this however i was wondering where i should store this?
Inside a module folder or separate?
Should i create a separate module imports the first module, creates a scheduled task on the server?
Any suggestion or help would be greatly appreciated.
IMHO, you should keep the module and the script separate. If you set up an internal repository, then you can host a module and script in a central location:
Then you can create a script on your worker servers that will automatically update the module and script during execution:
Task 1: Get the latest script
Task 2: Execute PS1, something like:
Install-Module -Name MyModule -Repository MyRepository -Scope CurrentUser
$stuff = Get-MyModuleStuff