I am receiving the following error message:
Cannot bind argument to parameter 'FilePath' because it is an empty string.
from this code:
$image = "image"
$logfile_name = "log.txt"
cleanup $image $logfile_name
function cleanup($image, $logfile) {
log_message "message" $logfile
}
function log_message($msg, $logfile) {
$msg | Tee-Object -Append -FilePath "$logfile"
}
I've tried with and without the quotes, what am I doing wrong?
Edit: I've tried to echo the value and it existing but when I ran it in the log_message command it says its null/empty string.