Importing a custom module and using it in your script:   Download or Copy Get-LoggedOnUsers.ps1 https://gallery.technet.microsoft.com/scriptcenter/d46b1f3b-36a4-4a56-951b-e37815a2df0c Get-LoggedOnUsers.ps1 function Get-LoggedOnUser { #Requires -Version 2.0 [CmdletBinding()] Param ( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true,