I am trying to schedule a function that checks disk space on servers. To run the function I am likely not doing it the best way as I run:
- import-module .\get-freespace.ps1
- .\get-freespace.ps1 -computers c:\scripts\computers.txt -To email@example.com -From firstname.lastname@example.org -smtpserver mail.test.local
I’ve tried changing this to a .psm1 as a module, but running it manually I get an error that it’s “unknown”, and I realize I should change it to a .psm1 and then edit the “myfunctions” file in my profile, is that right?
I’ve tried running it in a batch file and also from within another posh script using the dot source method, but I can’t get this function or any function to work like that.
I’m using powershell 3.0 on Windows 2012.