Making your own functions are a great way to invoke your own scripts in a simple, easy to use way.
You can use logic to build out functions with more complex capabilities. A few examples are:
foreach ($var in $vars) { $script }
Runs $script for each object on a list.
if ($true) { $script }
elseif ($var -eq $false) { $script }
else { $script }
If and elseif check if the given criteria is met and run the script if it is, otherwise will move on. Else will run the script when none of the previous criteria was met.
for ($i = 0; $i -eq 3; $i += 1) { $script }
Run $script for a set amount of loops.
try { $script }
catch { $script }
finally { $script }
Try $script, if it has an error it will run catch $script, then it will run finally $script no matter what.
return $var
Ends a script or function and returns $var