Differences

This shows you the differences between the selected revisions of the page.

2019-05-27 2021-01-01
5.12 Bug 1589 – Use SHA-256 host key fingerprints (martin) powershell core (martin)
Line 2: Line 2:
===== About PowerShell ===== ===== About PowerShell =====
-[[wp>PowerShell| Windows PowerShell]] is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on .NET Framework.+[[wp>PowerShell|PowerShell]] is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on .NET.
-Windows PowerShell is built into Windows 7 and newer; and is optionally available for Windows 98 SP2 and newer.((&wikipedia_ref(PowerShell|PowerShell))) &win9x+Windows PowerShell (''powershell.exe'') is built into Windows 7 and newer; and is optionally available for Windows 98 SP2 and newer.((&wikipedia_ref(PowerShell|PowerShell))) &win9x It uses .NET Framework. Its successor, PowerShell (''pwsh.exe''), previously known as PowerShell Core, aka PowerShell 6/7, is cross-platform and can be optionally installed in Windows. It uses .NET (previously known as .NET Core).
-Windows PowerShell scripts can be directly executed, they do not need to be compiled first.+PowerShell scripts can be directly executed, they do not need to be compiled first.
===== [[scripting]] PowerShell Scripting ===== ===== [[scripting]] PowerShell Scripting =====
-From WinSCP scripting perspective, important aspect of Windows PowerShell (''powershell.exe'') is its ability to run simple, yet powerful, scripts that can make use functionality exposed by WinSCP .NET assembly.+From WinSCP scripting perspective, important aspect of PowerShell is its ability to run simple, yet powerful, scripts that can make use functionality exposed by WinSCP .NET assembly.
-The ''powershell.exe'' is located in ''%WINDIR%\System32\WindowsPowershell\v1.0''.((It's ''v1.0'', disregarding what version you actually use.)) Typically you run ''powershell.exe'' with ''-File'' argument followed by path to your PowerShell script. The script file needs to have ''.ps1'' extension:+Windows PowerShell's ''powershell.exe'' is located in ''%WINDIR%\System32\WindowsPowershell\v1.0''.((It's ''v1.0'', disregarding what version you actually use.)) Typically you run ''powershell.exe'' with ''-File'' argument followed by path to your PowerShell script. The script file needs to have ''.ps1'' extension:
<code> <code>
Line 29: Line 29:
powershell.exe -ExecutionPolicy Unrestricted -File upload.ps1 powershell.exe -ExecutionPolicy Unrestricted -File upload.ps1
</code> </code>
 +
 +PowerShell (Core)'s ''pwsh.exe'' installs into ''C:\Program Files\PowerShell\<version>''.
===== [[install]] Installing the Assembly ===== ===== [[install]] Installing the Assembly =====
First, you need to install the WinSCP .NET assembly. In most cases, all you need to do is [[library_install#downloading|download]] the ''WinSCP-X.X.X-Automation.zip'' package and extract it along with your PowerShell script. First, you need to install the WinSCP .NET assembly. In most cases, all you need to do is [[library_install#downloading|download]] the ''WinSCP-X.X.X-Automation.zip'' package and extract it along with your PowerShell script.
 +
 +The version of ''WinSCPnet.dll'' in the root of the package is .NET Framework build of the assembly. It can be used with Windows PowerShell only. With PowerShell (Core) 6/7, you have to use .NET Standard build of the assembly, which is located in the ''netstandard2.0'' subfolder.
For specific cases, read full instructions to [[library_install|installing the WinSCP .NET assembly]]. For specific cases, read full instructions to [[library_install|installing the WinSCP .NET assembly]].

Last modified: by martin