From 58ac71fd95a21a824033f46d8a83a2b7cb7f9ed6 Mon Sep 17 00:00:00 2001 From: DamonStamper Date: Mon, 27 Nov 2017 18:11:54 -0500 Subject: [PATCH] Search for CSV in calling script's directory When importing a module $PSScriptRoot is set to the module's directory not that of the calling script. Thus when you import remotely then look for $PSScriptRoot/machineConfig.CSV you aren't going to pull the config from the same directory as the calling script. This is IMHO a 'must have' feature for remotely. --- Remotely.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Remotely.psm1 b/Remotely.psm1 index e38de50..a5e05a3 100644 --- a/Remotely.psm1 +++ b/Remotely.psm1 @@ -81,7 +81,8 @@ param( $script:sessionsHashTable = @{} } - $machineConfigFile = Join-Path $PSScriptRoot "machineConfig.CSV" + $CallingScriptsDirectory = [System.IO.Path]::GetDirectoryName($MyInvocation.PSCommandPath) + $machineConfigFile = Join-Path $CallingScriptsDirectory "machineConfig.CSV" CreateSessions -machineConfigFile $machineConfigFile