use variable insted of tilda

for better compatibility
master
lub 9 months ago
parent b1015a15ef
commit c1c77bd7c1

@ -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
}

Loading…
Cancel
Save