It's too easy for this to happen. When it happens, the task created will have a path to the module pswu.psm1 rather than the script install-allupdates.ps1. That will not run properly after the system reboots.
(Thanks to 'Q3A' from freenode IRC for reporting this.)
moved the gathering of scriptname, scriptpath, and scriptfullpath from pswu.psm1 to install-allupdates.ps1
install-allupdates (the script) passes these back to the pswu install-allupdates function as parameters. By doing this we always collect the name and path of the script rather than the name and path of the module.
There is an additional DontRunThisCmdletManually parameter passed to the function, with a string the user is not expected to know. If that string is not correctly guessed by the user, he/she is warned to run the script rather than the function.
It's too easy for this to happen. When it happens, the task created will have a path to the module pswu.psm1 rather than the script install-allupdates.ps1. That will not run properly after the system reboots.
(Thanks to 'Q3A' from freenode IRC for reporting this.)