Differences

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

2016-02-04 2016-02-27
hashtable style sessionoptions initilization (martin) https (martin)
Line 18: Line 18:
</code> </code>
-Note that by default, executing PowerShell scripts is disabled. To override that, you can either lift the restriction by typing using ''[[http://technet.microsoft.com/en-us/library/hh849812.aspx|Set-ExecutionPolicy]]'' cmdlet on PowerShell administrator console((Run ''powershell.exe'' as Administrator to get PowerShell console.)):+Note that by default, executing PowerShell scripts is disabled. To override that, you can either lift the restriction by typing using ''[[https://technet.microsoft.com/en-us/library/hh849812.aspx|Set-ExecutionPolicy]]'' cmdlet on PowerShell administrator console((Run ''powershell.exe'' as Administrator to get PowerShell console.)):
<code powershell> <code powershell>
Line 39: Line 39:
==== [[loading]] Loading Assembly ==== ==== [[loading]] Loading Assembly ====
-PowerShell script needs to load the assembly before it can use classes the assembly exposes. To load assembly use ''[[http://technet.microsoft.com/en-us/library/hh849914.aspx|Add-Type]]'' cmdlet.((In PowerShell 1.0, use ''[[msdn>System.Reflection.Assembly.LoadFrom]]'' method.))+PowerShell script needs to load the assembly before it can use classes the assembly exposes. To load assembly use ''[[https://technet.microsoft.com/en-us/library/hh849914.aspx|Add-Type]]'' cmdlet.((In PowerShell 1.0, use ''[[msdn>System.Reflection.Assembly.LoadFrom]]'' method.))
<code powershell> <code powershell>
Line 45: Line 45:
</code> </code>
-Had you need to run the script from other directory, you need to specify a full path to the assembly. You can derive the path from the script file path using ''[[http://technet.microsoft.com/en-us/library/hh847768.aspx|$PSScriptRoot]]'' automatic variable:((In PowerShell 2.0, use ''%%Add-Type -Path (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "WinSCPnet.dll")%%''))+Had you need to run the script from other directory, you need to specify a full path to the assembly. You can derive the path from the script file path using ''[[https://technet.microsoft.com/en-us/library/hh847768.aspx|$PSScriptRoot]]'' automatic variable:((In PowerShell 2.0, use ''%%Add-Type -Path (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "WinSCPnet.dll")%%''))
<code powershell> <code powershell>
Line 61: Line 61:
If you need to make use of these events: If you need to make use of these events:
  * Define event handling function;   * Define event handling function;
-  * Associate the event handling function with an instance of ''Session'' class using ''.add_Event'' method, where ''Event'' is a name of the event.((Avoid using ''[[http://technet.microsoft.com/en-us/library/hh849929.aspx|Register-ObjectEvent]]'' cmdlet, as it introduces threading problems and possible crashes.))+  * Associate the event handling function with an instance of ''Session'' class using ''.add_Event'' method, where ''Event'' is a name of the event.((Avoid using ''[[https://technet.microsoft.com/en-us/library/hh849929.aspx|Register-ObjectEvent]]'' cmdlet, as it introduces threading problems and possible crashes.))
See following code snippet: See following code snippet:
Line 87: Line 87:
==== [[module]] PowerShell Module ==== ==== [[module]] PowerShell Module ====
-There is a third-party PowerShell module, [[http://dotps1.github.io/WinSCP/|WinSCP PowerShell Wrapper]], that provides a cmdlet interface on top of the .NET assembly.+There is a third-party PowerShell module, [[https://dotps1.github.io/WinSCP/|WinSCP PowerShell Wrapper]], that provides a cmdlet interface on top of the .NET assembly.
Example: Example:

Last modified: by martin