Hey everyone, I've been trying to port a script from Windows 10 to Windows 11, and I'm running into a weird issue. The script runs some executables, and even though it doesn't specify a path, it works fine on Windows 10. I can also execute these commands without a hitch in PowerShell on Windows Terminal. Here's the PowerShell version info for Windows 10:
PSVersion 5.1.19041.6093
But on Windows 11, when I try to run the same executable, I get this error: 'plink: The term 'plink' is not recognized as the name of a cmdlet...' The command works if I prefix it with '.', which leads me to wonder if something changed in PowerShell with Windows 11. Here's the version info for Windows 11:
PSVersion 5.1.26100.4768
I'd love to know why this difference is happening and if it's a change in the Windows 11 PowerShell!
3 Answers
PowerShell has always required that you use the '.' prefix to run executables directly from the current directory. It's likely that your Windows 10 environment had the folder containing 'plink' in the `$env:path`, which allowed you to run commands without specifying the path. That's how commands like 'cmd' and 'ping' work too.
Just so you know, Windows 11 actually comes with OpenSSH built-in, so you don't even need 'putty' or any other SSH client. However, if you do have existing keypairs from putty, you'll need to convert them since it uses a proprietary format.
If you're having issues, make sure you have 'plink.exe' installed correctly or add its path to your user or system environment variables. This isn't necessarily a win10/win11 issue, more about how executables are referenced in PowerShell.
Oh, I'm in the process of switching vendors that use my script—one still on Windows 10 and one moving to Windows 11—so I'll have to keep it compatible for now.