From c1c77bd7c1b35e5ddf73dcb3349eb4fdcf434377 Mon Sep 17 00:00:00 2001 From: lub Date: Fri, 4 Aug 2023 15:35:58 +0200 Subject: [PATCH] use variable insted of tilda for better compatibility --- profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profile.ps1 b/profile.ps1 index 31b51de..7af0474 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -142,7 +142,7 @@ function wsh { if (!($session = Get-PSSession -ComputerName $ComputerName -Name 'wsh*' -ErrorAction SilentlyContinue | Where-Object Availability -eq 'Available' | Select-Object -First 1)) { $session = New-PSSession -ComputerName $ComputerName -Name ('wsh'+(Get-Random)) Invoke-Command -Session $session -Command $scriptBlock - Invoke-Command -Session $session -Command {Set-Location ~} + Invoke-Command -Session $session -Command {Set-Location $env:USERPROFILE} } Enter-PSSession $session }