So you want to run a custom PowerShell function.. This is how it’s done.

 

Original Script:

  1. Save the PowerShell “Function” to somewhere your user account has access to. In my case this is C:\1\ – and the file name is “LoggedInUser.ps1”.
  2.  Then you want to browse to where your script is saved. As such:
  3. and then we want to “dot source” the function (more from a good friend, Ed Wilson here: https://blogs.technet.microsoft.com/heyscriptingguy/2010/08/10/how-to-reuse-windows-powershell-functions-in-scripts/)
    1.  
  4. And now you will be able to call the function from intellisense (tab completion) This function name was defined in line 1) of the script.